|
| 1 | +--- |
| 2 | +name: analyzer-config |
| 3 | +description: "Use a repo-root `.editorconfig` to configure free .NET analyzer and style rules. Use when a .NET repo needs rule severity, code-style options, section layout, or analyzer ownership made explicit. USE FOR: the repo needs a root .editorconfig; analyzer severity and style ownership are unclear; the team wants one source of truth for rule configuration. DO NOT USE FOR: choosing analyzers with no config change; formatting-only execution with no config ownership question. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made." |
| 4 | +compatibility: "Requires a .NET SDK-based repository; respects the repo's `AGENTS.md` commands first." |
| 5 | +--- |
| 6 | + |
| 7 | +# .NET Analyzer Configuration |
| 8 | + |
| 9 | +## Trigger On |
| 10 | + |
| 11 | +- the repo needs a root `.editorconfig` |
| 12 | +- analyzer severity and style ownership are unclear |
| 13 | +- the team wants one source of truth for rule configuration |
| 14 | + |
| 15 | +## Value |
| 16 | + |
| 17 | +- produce a concrete project delta: code, docs, config, tests, CI, or review artifact |
| 18 | +- reduce ambiguity through explicit planning, verification, and final validation skills |
| 19 | +- leave reusable project context so future tasks are faster and safer |
| 20 | + |
| 21 | +## Do Not Use For |
| 22 | + |
| 23 | +- choosing analyzers with no config change |
| 24 | +- formatting-only execution with no config ownership question |
| 25 | + |
| 26 | +## Inputs |
| 27 | + |
| 28 | +- the nearest `AGENTS.md` |
| 29 | +- current `.editorconfig` |
| 30 | +- any `Directory.Build.props` overrides |
| 31 | + |
| 32 | +## Quick Start |
| 33 | + |
| 34 | +1. Read the nearest `AGENTS.md` and confirm scope and constraints. |
| 35 | +2. Run this skill's `Workflow` through the `Ralph Loop` until outcomes are acceptable. |
| 36 | +3. Return the `Required Result Format` with concrete artifacts and verification evidence. |
| 37 | + |
| 38 | +## Workflow |
| 39 | + |
| 40 | +1. Prefer one repo-root `.editorconfig` with `root = true`. |
| 41 | +2. Add nested `.editorconfig` files when a subtree has a clear scoped purpose, such as stricter rules, different generated-code handling, or a different policy for tests or legacy code. |
| 42 | +3. Keep severity in `.editorconfig`, not scattered through IDE settings. |
| 43 | +4. Write the file as real EditorConfig, not as a made-up `.NET` variant: |
| 44 | + - lowercase filename `.editorconfig` |
| 45 | + - `root = true` in the preamble |
| 46 | + - no inline comments |
| 47 | + - forward slashes in globs |
| 48 | +5. Keep bulk switches such as `EnableNETAnalyzers` in MSBuild files, not in `.editorconfig`. |
| 49 | +6. Treat `.globalconfig` as an exceptional case, not the normal repo setup. |
| 50 | + |
| 51 | +## Bootstrap When Missing |
| 52 | + |
| 53 | +If analyzer configuration is requested but not structured yet: |
| 54 | + |
| 55 | +1. Detect current state: |
| 56 | + - `rg --files -g '.editorconfig' -g '.globalconfig'` |
| 57 | + - `rg -n "EnableNETAnalyzers|AnalysisLevel|AnalysisMode" -g '*.csproj' -g 'Directory.Build.*' .` |
| 58 | +2. Create or normalize one repo-root `.editorconfig` with `root = true`. |
| 59 | +3. Move rule severity into `.editorconfig` and keep bulk analyzer switches in project or MSBuild config. |
| 60 | +4. Add nested `.editorconfig` files only when a subtree really needs different scoped policy. |
| 61 | +5. Run `dotnet build SOLUTION_OR_PROJECT` and return `status: configured` or `status: improved`. |
| 62 | +6. If the repo intentionally uses another documented analyzer-config ownership model, return `status: not_applicable`. |
| 63 | + |
| 64 | +## Deliver |
| 65 | + |
| 66 | +- one explicit analyzer configuration ownership model |
| 67 | +- a root `.editorconfig` layout that agents can extend safely |
| 68 | + |
| 69 | +## Validate |
| 70 | + |
| 71 | +- rule severity is reproducible in local and CI builds |
| 72 | +- IDE-only settings do not silently override repo policy |
| 73 | +- the default path is a root `.editorconfig`, not a surprise alternative |
| 74 | + |
| 75 | +## Ralph Loop |
| 76 | + |
| 77 | +Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work. |
| 78 | + |
| 79 | +1. Plan first (mandatory): |
| 80 | + - analyze current state |
| 81 | + - define target outcome, constraints, and risks |
| 82 | + - write a detailed execution plan |
| 83 | + - list final validation skills to run at the end, with order and reason |
| 84 | +2. Execute one planned step and produce a concrete delta. |
| 85 | +3. Review the result and capture findings with actionable next fixes. |
| 86 | +4. Apply fixes in small batches and rerun the relevant checks or review steps. |
| 87 | +5. Update the plan after each iteration. |
| 88 | +6. Repeat until outcomes are acceptable or only explicit exceptions remain. |
| 89 | +7. If a dependency is missing, bootstrap it or return `status: not_applicable` with explicit reason and fallback path. |
| 90 | + |
| 91 | +### Required Result Format |
| 92 | + |
| 93 | +- `status`: `complete` | `clean` | `improved` | `configured` | `not_applicable` | `blocked` |
| 94 | +- `plan`: concise plan and current iteration step |
| 95 | +- `actions_taken`: concrete changes made |
| 96 | +- `validation_skills`: final skills run, or skipped with reasons |
| 97 | +- `verification`: commands, checks, or review evidence summary |
| 98 | +- `remaining`: top unresolved items or `none` |
| 99 | + |
| 100 | +For setup-only requests with no execution, return `status: configured` and exact next commands. |
| 101 | + |
| 102 | +## Load References |
| 103 | + |
| 104 | +- [references/analyzer-config.md](references/analyzer-config.md) |
| 105 | +- [references/template.md](references/template.md) |
| 106 | +- [references/rules.md](references/rules.md) |
| 107 | + |
| 108 | +## Example Requests |
| 109 | + |
| 110 | +- "Make `.editorconfig` the source of truth." |
| 111 | +- "Write a proper root `.editorconfig` for this repo." |
| 112 | +- "Fix conflicting analyzer severities in this .NET repo." |
0 commit comments