Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add managedcode/dotnet-skills --skill "dotnet-code-analysis"
Install specific skill from multi-skill repository
# Description
Use the free built-in .NET SDK analyzers and analysis levels. Use when a .NET repo needs first-party code analysis, `EnableNETAnalyzers`, `AnalysisLevel`, or warning policy wired into build and CI.
# SKILL.md
name: dotnet-code-analysis
version: "1.0.0"
category: "Code Quality"
description: "Use the free built-in .NET SDK analyzers and analysis levels. Use when a .NET repo needs first-party code analysis, EnableNETAnalyzers, AnalysisLevel, or warning policy wired into build and CI."
compatibility: "Requires a .NET SDK-based repository; respects the repo's AGENTS.md commands first."
.NET Code Analysis
Trigger On
- the repo wants first-party .NET analyzers
- CI should fail on analyzer warnings
- the team needs
AnalysisLevelorAnalysisModeguidance
Value
- produce a concrete project delta: code, docs, config, tests, CI, or review artifact
- reduce ambiguity through explicit planning, verification, and final validation skills
- leave reusable project context so future tasks are faster and safer
Do Not Use For
- third-party analyzer selection by itself
- formatting-only work
Inputs
- the nearest
AGENTS.md - project files or
Directory.Build.props - current analyzer severity policy
Quick Start
- Read the nearest
AGENTS.mdand confirm scope and constraints. - Run this skill's
Workflowthrough theRalph Loopuntil outcomes are acceptable. - Return the
Required Result Formatwith concrete artifacts and verification evidence.
Workflow
- Start with SDK analyzers before adding third-party packages.
- Enable or document:
EnableNETAnalyzersAnalysisLevelAnalysisMode- warning policy such as
TreatWarningsAsErrors - Keep per-rule severity in the repo-root
.editorconfig. - Use
dotnet buildas the analyzer execution gate in CI. - Add third-party analyzers only for real gaps that first-party rules do not cover.
Bootstrap When Missing
If first-party .NET code analysis is requested but not configured yet:
- Detect current state:
dotnet --inforg -n "EnableNETAnalyzers|AnalysisLevel|AnalysisMode|TreatWarningsAsErrors" -g '*.csproj' -g 'Directory.Build.*' .- Treat SDK analyzers as built-in functionality, not as a separate third-party install path.
- Enable the needed properties in the solution's MSBuild config, typically in
Directory.Build.propsor the target project file: EnableNETAnalyzersAnalysisLevelAnalysisModewhen needed- warning policy such as
TreatWarningsAsErrors - Keep rule-level severity in the repo-root
.editorconfig. - Run
dotnet build SOLUTION_OR_PROJECTand returnstatus: configuredorstatus: improved. - If the repo intentionally defers analyzer policy to another documented build layer, return
status: not_applicable.
Deliver
- first-party analyzer policy that is explicit and reviewable
- build-time analyzer execution for CI
Validate
- analyzer behavior is driven by repo config, not IDE defaults
- CI can reproduce the same warnings and errors locally
Ralph Loop
Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.
- Plan first (mandatory):
- analyze current state
- define target outcome, constraints, and risks
- write a detailed execution plan
- list final validation skills to run at the end, with order and reason
- Execute one planned step and produce a concrete delta.
- Review the result and capture findings with actionable next fixes.
- Apply fixes in small batches and rerun the relevant checks or review steps.
- Update the plan after each iteration.
- Repeat until outcomes are acceptable or only explicit exceptions remain.
- If a dependency is missing, bootstrap it or return
status: not_applicablewith explicit reason and fallback path.
Required Result Format
status:complete|clean|improved|configured|not_applicable|blockedplan: concise plan and current iteration stepactions_taken: concrete changes madevalidation_skills: final skills run, or skipped with reasonsverification: commands, checks, or review evidence summaryremaining: top unresolved items ornone
For setup-only requests with no execution, return status: configured and exact next commands.
Load References
- read
references/rules.mdfor SDK analyzer rule categories and severity guidance - read
references/config.mdfor AnalysisLevel, AnalysisMode, and .editorconfig settings
Example Requests
- "Turn on built-in .NET analyzers."
- "Make analyzer warnings fail the build."
- "Set the right
AnalysisLevelfor this repo."
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.