$npx -y skills add alexei-led/cc-thingz --skill writing-csharpUse only for C# and .NET code. Follow the project's SDK, target frameworks, nullable settings, analyzer config, test stack, and local conventions.
| 1 | # C# /.NET Development |
| 2 | |
| 3 | Use only for C# and .NET code. Follow the project's SDK, target frameworks, |
| 4 | nullable settings, analyzer config, test stack, and local conventions. |
| 5 | |
| 6 | ## Read First |
| 7 | |
| 8 | Read [principles.md](references/principles.md) before writing, changing, or reviewing C# code. Read conditional references only when the change touches that area. |
| 9 | |
| 10 | ## Conditional References |
| 11 | |
| 12 | - [patterns.md](references/patterns.md) — solution layout, ASP.NET Core boundaries, DI, EF access, config, and worker patterns. |
| 13 | - [testing.md](references/testing.md) — adding or reshaping xUnit, NUnit, or MSTest coverage; keep the local `dotnet test` loop fast. |
| 14 | - [linting.md](references/linting.md) — changing `dotnet format`, analyzers, warning policy, or slow verification flow. |
| 15 | - [cli.md](references/cli.md) — writing or changing .NET CLIs. |
| 16 | |
| 17 | ## Project Baseline |
| 18 | |
| 19 | - Inspect the nearest `*.csproj`, `Directory.Build.props`, `global.json`, solution file, CI, and nearby code before using SDK- or framework-specific APIs. |
| 20 | - Keep nullable reference types enabled. Fix the warning or model, not the warning level. |
| 21 | - Prefer the BCL and existing NuGet packages before adding a dependency. |
| 22 | - Use the existing app style: ASP.NET Core controllers vs minimal APIs, records vs classes, MediatR or no mediator, EF or raw SQL, and the configured test framework. |
| 23 | |
| 24 | ## Comments and XML Docs |
| 25 | |
| 26 | - Use XML documentation comments for public APIs when the project emits API docs or enforces CS1591. |
| 27 | - Summarize contracts, invariants, edge cases, and effects. Do not restate member names or signatures. |
| 28 | - Use `//` for brief implementation notes; avoid long `/* */` explanations. |
| 29 | - Keep comments short. Move longer rationale to docs, issue links, or design notes. |
| 30 | - Do not comment obvious code. |
| 31 | - Keep tests readable without comments; add one only for unobvious fixtures, timing, concurrency, external services, or regression context. |
| 32 | |
| 33 | ## Verification |
| 34 | |
| 35 | Run focused `dotnet` checks while editing, then the project-configured build, |
| 36 | tests, analyzers, and formatting checks before final output. Prefer the |
| 37 | narrowest useful project or solution target for the hot loop, then the broader |
| 38 | configured command before final output. |
| 39 | |
| 40 | If a check is unavailable, state that and run the closest configured gate. If a |
| 41 | check fails, quote the failure, diagnose the cause, fix one issue, and rerun the |
| 42 | relevant check. |
| 43 | |
| 44 | ## Failure Cases |
| 45 | |
| 46 | - No clear .NET root: locate the nearest `*.csproj` or containing `*.sln` before choosing files or commands. |
| 47 | - Unknown SDK or language level: inspect `TargetFramework`, `TargetFrameworks`, `LangVersion`, `global.json`, CI, and lockfiles before using newer APIs or syntax. |
| 48 | - New package requested: confirm the BCL or existing packages cannot meet the requirement. |
| 49 | - Broad or risky edit: state the risk and ask before acting. Do not run destructive commands. |
| 50 | |
| 51 | ## Final Response |
| 52 | |
| 53 | Include: |
| 54 | |
| 55 | - changed files |
| 56 | - checks run and results |
| 57 | - checks skipped with reasons |
| 58 | - remaining risks or follow-ups |