Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use the free built-in .NET SDK analyzers and analysis levels with gradual Roslyn warning promotion. USE FOR: the repo wants first-party .NET analyzers; CI should fail on analyzer warnings; the team needs AnalysisLevel or AnalysisMode guidance. DO NOT USE FOR: third-party analyzer selection by itself; formatting-only work. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.
.claude/skills/managedcode-code-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-16 | ✗→✓ | ▲ Improved | 94% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 78% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 157% | 0% |
| case-19 | ✗→✓ | ▲ Improved | 92% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 22% | 0% |
AnalysisLevel or AnalysisMode guidanceAGENTS.mdDirectory.Build.propsNon-negotiable. Violating these undermines the user's explicit intent.
TreatWarningsAsErrors or WarningsAsErrors if the project has set them. Do not comment them out, set to false, wrap in a condition, or add <TreatWarningsAsErrors>false</TreatWarningsAsErrors> to make the build pass.<NoWarn> or #pragma warning disable for warnings the user chose to treat as errors, unless the user explicitly approves the suppression..editorconfig (e.g. error to warning or none) to make a build succeed.mermaidflowchart TD A[Start] --> B{New or legacy project?} B -->|New| C[TreatWarningsAsErrors=true immediately] B -->|Legacy| D[dotnet build, count warnings by ID] D --> E{"< 30 warnings?"} E -->|Yes| F[Fix all, then enable TreatWarningsAsErrors] E -->|No| G[Report counts to user, ask which batch first] G --> H[Add selected IDs to WarningsAsErrors] H --> I[Fix that batch, verify build] I --> J{More batches?} J -->|Yes| G J -->|No| F C --> K[Set AnalysisLevel latest-recommended] F --> K K --> L[Promote security CA3xxx/CA5xxx to error in .editorconfig] L --> M[Validate: build + CI green]
EnableNETAnalyzers, AnalysisLevel, AnalysisMode in Directory.Build.props..editorconfig.dotnet build is the analyzer gate in CI.Set these in Directory.Build.props immediately:
TreatWarningsAsErrors = trueAnalysisLevel = latest-recommended.editorconfigFix all warnings before merging.
Blanket TreatWarningsAsErrors on a legacy codebase produces hundreds/thousands of errors. An agent cannot fix them all at once — context floods, fix quality drops. Promote in batches.
Mechanical fixes, lowest effort:
Add to WarningsAsErrors: CS8019;CS0219;CS0168. Fix all, then Phase 2.
Ask: "Which categories next — Nullability, Performance, or Reliability?" Add selected IDs to WarningsAsErrors, fix, repeat.
Set in .editorconfig regardless of project maturity:
editorconfig[*.cs] dotnet_analyzer_diagnostic.category-Security.severity = error
Covers CA3001 (SQL injection), CA3002 (XSS), CA3003 (path injection), CA3075 (insecure DTD), CA5350/CA5351 (weak crypto), CA5394 (insecure randomness).
Once all batches pass, transition to:
xml<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <WarningsNotAsErrors>CA1707</WarningsNotAsErrors> <!-- explicit exceptions only -->
dotnet build, count warnings by ID.WarningsAsErrors.Never skip the ask step. The user decides the pace.
dotnet --inforg -n "EnableNETAnalyzers|AnalysisLevel|AnalysisMode|TreatWarningsAsErrors|WarningsAsErrors" -g '*.csproj' -g 'Directory.Build.*' .dotnet build SOLUTION_OR_PROJECT 2>&1 — count warnings by IDEnableNETAnalyzers, AnalysisLevel, AnalysisMode in MSBuild config..editorconfig.dotnet build, return status: configured or status: improved.status: not_applicable.TreatWarningsAsErrors, WarningsAsErrors, or severity settings removed/weakened without user approvalstatus: not_applicable.status: complete | clean | improved | configured | not_applicable | blockedplan: concise plan and current stepactions_taken: concrete changesvalidation_skills: final skills run or skipped with reasonsverification: commands, checks, or review evidenceremaining: unresolved items or noneOther measured skills in the registry, with their headline benchmark lift.