
csharp-upgrade
by zadazorg
SKILL.md
name: csharp-upgrade description: > Upgrade project configuration to latest C# standards. Compares Directory.Build.props, .editorconfig, analyzers with templates. Shows diff and optionally applies updates. Use for "/upgrade". user-invocable: true allowed-tools:
- Read
- Write
- Edit
- Bash
- Grep
- Glob
- AskUserQuestion metadata: author: csharp-standards version: "3.0.0"
Project Configuration Upgrade
Upgrade your .NET project to the latest C# 14 standards configuration.
Files to Check
| File | Purpose |
|---|---|
Directory.Build.props | Build settings, analyzers, strict mode |
Directory.Packages.props | Central Package Management versions |
.editorconfig | Code style rules (K&R, file-scoped namespaces) |
BannedSymbols.txt | Forbidden APIs (DateTime.Now, etc.) |
Makefile | Standard targets (lint, fix, test) |
Workflow
Step 1: Scan Existing Files
# Find all config files
ls -la Directory.Build.props Directory.Packages.props .editorconfig BannedSymbols.txt Makefile 2>/dev/null
Step 2: Compare with Templates
For each file that exists, compare with template:
# Show differences
diff -u Directory.Build.props templates/Directory.Build.props
diff -u Directory.Packages.props templates/Directory.Packages.props
diff -u .editorconfig templates/.editorconfig
diff -u BannedSymbols.txt templates/BannedSymbols.txt
diff -u Makefile templates/Makefile
Step 3: Generate Report
Create a summary table:
┌─────────────────────────┬──────────┬─────────────────────────┐
│ File │ Status │ Action │
├─────────────────────────┼──────────┼─────────────────────────┤
│ Directory.Build.props │ Outdated │ 3 properties missing │
│ Directory.Packages.props│ MISSING │ Create new │
│ .editorconfig │ OK │ Up to date │
│ BannedSymbols.txt │ Outdated │ 2 bans missing │
│ Makefile │ OK │ Up to date │
└─────────────────────────┴──────────┴─────────────────────────┘
Status meanings:
- OK — File matches template (or has all required settings)
- Outdated — File exists but missing new settings
- MISSING — File does not exist
Step 4: Ask User What to Update
Use AskUserQuestion:
What would you like to update?
○ All files (recommended)
○ Select individually
○ Skip — just show report
Step 5: Apply Updates
For each selected file:
# If MISSING — copy template
cp templates/Directory.Packages.props ./
# If Outdated — show diff and ask to replace or merge
# For props files, prefer full replacement to avoid conflicts
Step 6: Verify
dotnet restore
dotnet build
Key Properties to Check
Directory.Build.props
Must have these settings:
<!-- Language -->
<LangVersion>preview</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Strict Analysis -->
<AnalysisLevel>latest-all</AnalysisLevel>
<AnalysisMode>All</AnalysisMode>
<WarningLevel>9999</WarningLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<!-- AOT-Readiness (v2.3.0+) -->
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<EnableRequestDelegateGenerator>true</EnableRequestDelegateGenerator>
<!-- Unified Output (v2.3.1+) -->
<UseArtifactsOutput>true</UseArtifactsOutput>
<!-- NuGet Security (v2.4.0+) -->
<NuGetAudit>true</NuGetAudit>
<NuGetAuditLevel>moderate</NuGetAuditLevel>
<NuGetAuditMode>all</NuGetAuditMode>
<!-- Lock Files (v2.4.0+) -->
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
Must have these analyzers:
- Roslynator.Analyzers
- SonarAnalyzer.CSharp
- Microsoft.CodeAnalysis.BannedApiAnalyzers
- Microsoft.VisualStudio.Threading.Analyzers
Directory.Packages.props
Must have:
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
Check for outdated package versions with:
dotnet outdated
.editorconfig
Key settings:
csharp_new_line_before_open_brace = none
csharp_style_namespace_declarations = file_scoped:warning
csharp_prefer_simple_using_statement = true:warning
BannedSymbols.txt
Must ban:
DateTime.NowDateTime.UtcNowThread.SleepTask.ResultTask.Wait
After Upgrade
# Review changes
git diff
# Run tests
dotnet test
# Commit
git add -A
git commit -m "chore: upgrade to csharp-standards v3.0.0"
Templates Reference
Full templates are in templates/ directory:
templates/Directory.Build.propstemplates/Directory.Packages.propstemplates/.editorconfigtemplates/BannedSymbols.txttemplates/Makefile
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon