dotnet-conventions
Skill1 starsChanged 3 months agoMITView on GitHub
Writes new C# and .NET code to current best practice for the project's target framework while leaving existing code untouched - neighbours set structure and naming, never quality. Use this skill whenever the user says "fix this C# bug", "fix this .NET issue", "add an endpoint", "add a service", "add a repository", "review this C# diff", "review my .cs changes", or mentions "EF Core migration", "async", "dependency injection" or a background worker - even if they don't explicitly say "conventions". Not for creating a new solution from scratch (that is dotnet-onion-api).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- NicoGenti/opencode-orchestrator-kittheir own version, first seen Nov 8, 2026
- techmefr/mentistheir own version, first seen Sep 11, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- NicoGenti/opencode-orchestrator-kit★ 9same name
- techmefr/mentis★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository38 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-contract-reviewSkill
- autopilotSkill
- backlog-plannerSkill
- codebase-explainerSkill
- code-reviewSkill
- context-dietSkill
- conventional-commitsSkill
- create-prSkill
- design-briefSkill
- diagnoseSkill
- dotnet-onion-apiSkill
- draw-optionsSkill
- e2e-verifySkill
- githubSkill
- goal-runnerSkill
- grill-with-docsSkill
- handoffSkill
- humanizerSkill
- improve-codebase-architectureSkill
- maestro-mobile-testSkill
- migration-safetySkill
- model-inventorySkill
- nextjs-app-routerSkill
- plan-and-buildSkill
- record-browser-testSkill
- regression-huntSkill
- safe-refactorSkill
- security-reviewSkill
- ship-itSkill
- sql-reviewSkill
- task-executorSkill
- tauri-2-appSkill
- think-like-fableSkill
- upgrade-depsSkill
- worktree-sandboxSkill
- write-a-skillSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Do not use it to create a new solution or project from scratch - dotnet-onion-api (if installed) owns that.
- Very specific: line 22
Use only what the target supports: Never raise TargetFramework or LangVersion, add a package, or switch a library (serializer, ORM, test …
- Distinctive: line 55
If a test project exists, add tests for the behavior you add, in its own framework and style: sibling naming, fakes and layout, no new …
- Distinctive: line 56
Run unit tests only. A test that needs a database or an external service runs only when the user asks.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
.NET Conventions
New code follows current best practice for the project's target framework, taken from Microsoft's own guidance. Existing code sets the structure (layering, naming, folder layout, data-access technology) and is never edited to meet this rule.
When to use this skill
- "fix this C# bug" / "fix this .NET issue"
- "add an endpoint" / "add a service" / "add a repository" in an existing .NET codebase
- "review this C# diff" / "review my .cs changes"
- EF Core migration, async, dependency-injection or background-worker work
Do not use it to create a new solution or project from scratch - dotnet-onion-api (if installed) owns that.
Workflow
- Detect the stack from files, then state it in one line: the
.csprojtarget (net472/net48= .NET Framework;net6.0or later = modern .NET),LangVersion, the data-access path, whether dependencies are injected, whether neighbours are sync or async, and whether a test project exists. A stack you did not read from a file is "assumed", never "detected". - Use only what the target supports. Never raise
TargetFrameworkorLangVersion, add a package, or switch a library (serializer, ORM, test framework). - Write new code to best practice; match the neighbours' structure and naming, not their quality. Read the reference for each area your change touches:
references/async-and-cancellation.md- I/O, blocking,CancellationToken,ConfigureAwaitreferences/errors.md- catch, throw, rethrow, logging exceptionsreferences/di-and-settings.md- injection, lifetimes, options, hosted servicesreferences/data-and-http.md- EF Core, SQL,HttpClient, serializationreferences/aspnet-request-scope.md-HttpContext, request bodies, large results, background workreferences/security.md- queries, authorization, input, secretsreferences/style-and-layout.md- names, member order, namespaces, new files and folders, syntax formsreferences/dotnet-framework.md- also read this when the target is .NET Framework (net4x): async policy, EF6, Web API 2 DI,HttpClient, language limits- ❌ New
ListActiveends incatch (Exception) { }and returns an empty list "to matchFind". - ✅ New method lets the exception propagate, like
Getbeside it; the report flagsFind.
- Leave existing code alone. Never edit an existing method to make it best practice. When new code needs a better form of something that exists only in a worse form, add a sibling beside it. The one permitted edit: an optional
CancellationToken ct = defaultparameter on an existing async method your new code calls (it breaks no caller), listed underChanged.- ❌
Getchanged from sync toasyncso the new code can await it. - ✅
GetAsync(id, ct)added besideGet;Getand its callers are unchanged.
- ❌
- If best practice is out of reach without editing existing code, follow the neighbour for that one point and record it under
Deviations. - Do exactly what was asked. No new public surface (endpoint, controller, public interface) unless the task names it. Style follows
.editorconfigand the neighbouring files. If the code needs no comment, add none. A comment is for a genuinely non-obvious why only, and is one short line (seereferences/style-and-layout.md). - Verify with the build and tests below, then report.
Verify
From the repository root, audit the lines you added. Fix every real hit and rerun.
bash <this skill's directory>/scripts/audit.shIt lists added catch blocks, blocking calls, async void and async methods with no CancellationToken (test code is ignored), in modified files and in new untracked ones. For each changed file it finds the nearest .csproj; on an SDK-style project targeting net5.0 or later it builds with the analyzers on and reports only CA1849 (blocking in async), CA2016 (token not forwarded), CA1031 (general catch), CA2200 (throw ex) and CA2000 (not disposed), and only on lines you added. It says why it skipped a project, for example a .NET Framework target. Every added catch must log or rethrow; a no-token hit is expected on .NET Framework and a defect on modern .NET.
Then build and run the tests. A project you cannot build here is not built, never passed; quote the summary line.
Tests
- If a test project exists, add tests for the behavior you add, in its own framework and style: sibling naming, fakes and layout, no new package. Assert computed values on the happy path and cover the not-found or failure path.
- Run unit tests only. A test that needs a database or an external service runs only when the user asks. Exclude it with the filter that matches the project's tag:
| Framework | Tag | Filter |
| xUnit | [Trait("Category", "Integration")] | --filter "Category!=Integration" |
| NUnit | [Category("Integration")] | --filter "TestCategory!=Integration" |
| MSTest | [TestCategory("Integration")] | --filter "TestCategory!=Integration" |
- The
Passedtotal must equal the count of non-integration tests in the source. A larger total means an integration test ran - say so.
Report
Five slots, every one required; write none rather than omitting one.
Stack: <what you read, from which file>
Changed: <files, including each sibling or optional parameter you added>
Verified: <command + quoted summary line + names of new tests, or "not built: <why>">
Deviations: <each place the new code is not best practice, and why>
Flagged, not changed: <one line per defect you saw in existing code and left alone>Example
User: "Add an endpoint that returns details for an item." The repository, service and controller are sync, and the repository reads a file with File.ReadAllText.
Claude: modern .NET with sync neighbours doing blocking I/O. Adds GetAsync(id, ct) beside Get, GetDetailsAsync(id, ct) in the service and an async action taking ct; Get and every caller are unchanged. The service's Find swallows every error, so the new path does not go through it. Report: Deviations: none; Flagged, not changed: ItemRepository.Get blocks on file I/O; ItemService.Find swallows all exceptions.
Anti-patterns
| Excuse | Reality |
| "It matches the surrounding code" | Match structure and naming, never quality. |
| "The neighbours are sync / carry no token" | New code on modern .NET is async with ct; add a sibling, do not edit the old method. |
| "Quick one" | Quick limits scope, not the verification or the test. |
| "Fixing it would change existing behaviour" | True - flag it; do not copy it and do not fix it here. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

