/dotnet-analyzers
Run dotnet format to fix code style and analyzer diagnostics (IDE0005, CA*, SA*). Use when fixing unnecessary usings, code style violations, analyzer warnings, or verifying format compliance
$ npx -y skills add NikiforovAll/claude-code-rules --skill dotnet-analyzers --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/dotnet-analyzers
Context preview
The summary Claude sees to decide when to auto-load this skill.
Run dotnet format to fix code style and analyzer diagnostics (IDE0005, CA*, SA*). Use when fixing unnecessary usings, code style violations, analyzer warnings, or verifying format compliance
SKILL.md
dotnet-analyzers.SKILL.mdname: dotnet-analyzers
description: Run dotnet format to fix code style and analyzer diagnostics (IDE0005, CA*, SA*). Use when fixing unnecessary usings, code style violations, analyzer warnings, or verifying format compliance
argument-hint: "[diagnostic ID or 'verify' or 'list' or '--dashboard' or '--sarif']"
allowed-tools: Bash(dotnet format *), Bash(dotnet clean *), Bash(jq *), Bash(bash *generate-report*), Read, Grep, Glob
.NET Analyzers & Code Format
Fix code style and analyzer diagnostics using `dotnet format`.
Arguments: $ARGUMENTS
Key Concepts
- `dotnet format` does its own internal compilation — it does NOT depend on cached build output
- CA*/SA* rules (analyzers) run during build if `EnableNETAnalyzers` is true
Command Reference
| Task | Command | |------|---------| | Fix specific style diagnostic | `dotnet format style --diagnostics IDE0005 --severity warn` | | Fix specific analyzer diagnostic | `dotnet format analyzers --diagnostics CA1305 --severity warn` | | Fix all style issues | `dotnet format style --severity warn` | | Fix all analyzer issues | `dotnet format analyzers --severity warn` | | Fix everything | `dotnet format --severity warn` | | Verify only (CI) | `dotnet format --verify-no-changes --severity warn` | | List violations without fixing | `dotnet format style --verify-no-changes --severity warn -v diag` | | Scope to folder | `dotnet format style --diagnostics IDE0005 --include src/MyProject/` |
Common Diagnostics
Style (IDE*) — use `dotnet format style`
| ID | Description | |----|-------------| | IDE0005 | Unnecessary using directive | | IDE0055 | Fix formatting | | IDE0090 | Simplify `new` expression | | IDE0161 | File-scoped namespace | | IDE0251 | Make member readonly |
Analyzers (CA*) — use `dotnet format analyzers`
| ID | Description | |----|-------------| | CA1305 | Specify IFormatProvider | | CA1822 | Mark members as static | | CA1859 | Use concrete types for performance | | CA2000 | Dispose objects before losing scope |
Workflow
IMPORTANT: Always start in verify/list mode. NEVER auto-fix without explicit user confirmation.
Step 1: List violations (default)
Always start by showing what would change — never fix automatically. Use `--report "$TEMP/dotnet-format"` to get structured JSON, then process with `jq`.
# List all style violations as JSON report
dotnet format style --verify-no-changes --severity warn --report "$TEMP/dotnet-format" <PROJECT_OR_SOLUTION> 2>/dev/null
# List specific diagnostic
dotnet format style --verify-no-changes --diagnostics IDE0005 --severity warn --report "$TEMP/dotnet-format" <PROJECT_OR_SOLUTION> 2>/dev/null
# List analyzer violations
dotnet format analyzers --verify-no-changes --severity warn --report "$TEMP/dotnet-format" <PROJECT_OR_SOLUTION> 2>/dev/null
Process the JSON report with `jq`:
# Summary: count violations per diagnostic ID
jq '[.[].FileChanges[].DiagnosticId] | group_by(.) | map({id: .[0], count: length}) | sort_by(-.count)' "$TEMP/dotnet-format/format-report.json"
# List affected files
jq '[.[].FilePath] | unique | .[]' "$TEMP/dotnet-format/format-report.json"
# Show details for a specific diagnostic
jq '[.[] | {file: .FilePath, changes: [.FileChanges[] | select(.DiagnosticId == "IDE0005")]} | select(.changes | length > 0)]' "$TEMP/dotnet-format/format-report.json"Step 2: Report findings to user
Summarize the violations found using the JSON report and ask the user if they want to apply fixes.
Step 3: Apply fixes (only after user confirms)
dotnet format style --diagnostics IDE0005 --severity warn
Or for analyzer rules:
dotnet format analyzers --diagnostics CA1305 --severity warn
Step 4: Verify build still passes
dotnet build -p:WarningLevel=0 /clp:ErrorsOnly
HTML Dashboard Report (`--dashboard`)
Only generate when user explicitly passes `--dashboard`. Do NOT suggest or run this unprompted.
`--sarif` selects SARIF mode: the script runs its own `dotnet build -t:Rebuild` and harvests `_analyzer-diag.sarif` files. It is NOT a request to run `dotnet build` separately — passing the flag through to `generate-report.sh` is the entire job. Without `--sarif`, the script uses the faster `dotnet format` path. SARIF mode respects editorconfig severity (filters `level=note`/`none` and source-suppressed entries). See [Mode comparison](#mode-comparison) for when to pick which.
Generate an interactive HTML dashboard from live `dotnet format` output. No AI involved — purely deterministic.
Usage
Default mode uses `dotnet format` (fast, fixable diagnostics only):
# From repo root (defaults to current dir, outputs analyzer-dashboard.html)
bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh
# Explicit solution/project path and output
bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh ./MyProject.sln analyzer-dashboard-generated.html
SARIF mode runs `dotnet build -t:Rebuild` and harvests Roslyn ErrorLog SARIF (slower, comprehensive):
# Run ONLY when user explicitly asks for full coverage / "report everything"
bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh --sarif presales.slnx analyzer-dashboard-sarif.html
Flag parsing: `--sarif` and `--dashboard` may appear in any order; `--dashboard` is a no-op (dashboard is always emitted) but accepted so user invocations like `--dashboard --sarif` work as expected. Positional args are `[project] [output.html]`.
When the user asks for **both** dashboards, generate them with distinct output names:
bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh presales.slnx analyzer-dashboard.html
bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh --sarif presales.slnx analyzer-dashboard-sarif.html
Mode comparison
| Aspect | default (`dotnet format`) | `--sarif` (Roslyn ErrorLog) | |--------|----------------------------|-------------------
Read more
name: dotnet-analyzers description: Run dotnet format to fix code style and analyzer diagnostics (IDE0005, CA*, SA*). Use when fixing unnecessary usings, code style violations, analyzer warnings, or verifying format compliance argument-hint: "[diagnostic ID or 'verify' or 'list' or '--dashboard' or '--sarif']" allowed-tools: Bash(dotnet format *), Bash(dotnet clean *), Bash(jq *), Bash(bash *generate-report*), Read, Grep, Glob
.NET Analyzers & Code Format
Fix code style and analyzer diagnostics using `dotnet format`.
Arguments: $ARGUMENTS
Key Concepts
- `dotnet format` does its own internal compilation — it does NOT depend on cached build output
- CA*/SA* rules (analyzers) run during build if `EnableNETAnalyzers` is true
Command Reference
| Task | Command | |------|---------| | Fix specific style diagnostic | `dotnet format style --diagnostics IDE0005 --severity warn` | | Fix specific analyzer diagnostic | `dotnet format analyzers --diagnostics CA1305 --severity warn` | | Fix all style issues | `dotnet format style --severity warn` | | Fix all analyzer issues | `dotnet format analyzers --severity warn` | | Fix everything | `dotnet format --severity warn` | | Verify only (CI) | `dotnet format --verify-no-changes --severity warn` | | List violations without fixing | `dotnet format style --verify-no-changes --severity warn -v diag` | | Scope to folder | `dotnet format style --diagnostics IDE0005 --include src/MyProject/` |
Common Diagnostics
Style (IDE*) — use `dotnet format style`
| ID | Description | |----|-------------| | IDE0005 | Unnecessary using directive | | IDE0055 | Fix formatting | | IDE0090 | Simplify `new` expression | | IDE0161 | File-scoped namespace | | IDE0251 | Make member readonly |
Analyzers (CA*) — use `dotnet format analyzers`
| ID | Description | |----|-------------| | CA1305 | Specify IFormatProvider | | CA1822 | Mark members as static | | CA1859 | Use concrete types for performance | | CA2000 | Dispose objects before losing scope |
Workflow
IMPORTANT: Always start in verify/list mode. NEVER auto-fix without explicit user confirmation.
Step 1: List violations (default)
Always start by showing what would change — never fix automatically. Use `--report "$TEMP/dotnet-format"` to get structured JSON, then process with `jq`.
# List all style violations as JSON report dotnet format style --verify-no-changes --severity warn --report "$TEMP/dotnet-format" <PROJECT_OR_SOLUTION> 2>/dev/null # List specific diagnostic dotnet format style --verify-no-changes --diagnostics IDE0005 --severity warn --report "$TEMP/dotnet-format" <PROJECT_OR_SOLUTION> 2>/dev/null # List analyzer violations dotnet format analyzers --verify-no-changes --severity warn --report "$TEMP/dotnet-format" <PROJECT_OR_SOLUTION> 2>/dev/null
Process the JSON report with `jq`:
# Summary: count violations per diagnostic ID
jq '[.[].FileChanges[].DiagnosticId] | group_by(.) | map({id: .[0], count: length}) | sort_by(-.count)' "$TEMP/dotnet-format/format-report.json"
# List affected files
jq '[.[].FilePath] | unique | .[]' "$TEMP/dotnet-format/format-report.json"
# Show details for a specific diagnostic
jq '[.[] | {file: .FilePath, changes: [.FileChanges[] | select(.DiagnosticId == "IDE0005")]} | select(.changes | length > 0)]' "$TEMP/dotnet-format/format-report.json"Step 2: Report findings to user
Summarize the violations found using the JSON report and ask the user if they want to apply fixes.
Step 3: Apply fixes (only after user confirms)
dotnet format style --diagnostics IDE0005 --severity warn
Or for analyzer rules:
dotnet format analyzers --diagnostics CA1305 --severity warn
Step 4: Verify build still passes
dotnet build -p:WarningLevel=0 /clp:ErrorsOnly
HTML Dashboard Report (`--dashboard`)
Only generate when user explicitly passes `--dashboard`. Do NOT suggest or run this unprompted.
`--sarif` selects SARIF mode: the script runs its own `dotnet build -t:Rebuild` and harvests `_analyzer-diag.sarif` files. It is NOT a request to run `dotnet build` separately — passing the flag through to `generate-report.sh` is the entire job. Without `--sarif`, the script uses the faster `dotnet format` path. SARIF mode respects editorconfig severity (filters `level=note`/`none` and source-suppressed entries). See [Mode comparison](#mode-comparison) for when to pick which.
Generate an interactive HTML dashboard from live `dotnet format` output. No AI involved — purely deterministic.
Usage
Default mode uses `dotnet format` (fast, fixable diagnostics only):
# From repo root (defaults to current dir, outputs analyzer-dashboard.html) bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh # Explicit solution/project path and output bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh ./MyProject.sln analyzer-dashboard-generated.html
SARIF mode runs `dotnet build -t:Rebuild` and harvests Roslyn ErrorLog SARIF (slower, comprehensive):
# Run ONLY when user explicitly asks for full coverage / "report everything" bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh --sarif presales.slnx analyzer-dashboard-sarif.html
Flag parsing: `--sarif` and `--dashboard` may appear in any order; `--dashboard` is a no-op (dashboard is always emitted) but accepted so user invocations like `--dashboard --sarif` work as expected. Positional args are `[project] [output.html]`.
When the user asks for **both** dashboards, generate them with distinct output names:
bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh presales.slnx analyzer-dashboard.html bash ~/.claude/skills/dotnet-analyzers/scripts/generate-report.sh --sarif presales.slnx analyzer-dashboard-sarif.html
Mode comparison
| Aspect | default (`dotnet format`) | `--sarif` (Roslyn ErrorLog) | |--------|----------------------------|-------------------
Showing the first part of this file.
A collection of Claude Code recommendations and practices. Learn practical techniques to enhance your AI-assisted development workflow with Claude Code.
Other skills on claude-code-rules.
- /update-component-reference
This skill should be used when the user wants to add components (commands, agents, skills, hooks, or MCP servers) to the Component Reference section of the website.
Open skill - /version-bump
This skill automates version bumping during the release process for the Claude Code Handbook monorepo. It should be used when the user requests to bump versions, prepare a release, or increment version numbers across the repository.
Open skill - /spec-driven
Guide spec-driven development workflow (Requirements → Design → Tasks → Implementation) with approval gates between phases. Use when user wants structured feature planning or says "use spec-driven" or "follow the spec process".
Open skill - /subagent-review
Review changed code for reuse, quality, and efficiency using three parallel disposable subagents. This skill should be used when the user says "review", "simplify", "code review", or wants a one-shot code review without persistent reviewers.
Open skill - /team-review
Review changed code for reuse, quality, and efficiency using a team of persistent named reviewers. This skill should be used when the user says "team review", "review with team", or wants parallel code review with persistent team members for follow-up questions. Similar to
Open skill - /handbook-discover
This skill should be used when users want to discover, browse, or audit cc-handbook marketplace plugins. Shows all available plugins with installation status, versions, and component breakdown (skills, agents, commands, MCP/LSP servers, hooks). Trigger phrases include "discover
Open skill

