dotnet-patterns
Skill8 starsChanged 2 months agoMITView on GitHub
Use when writing C#/.NET backend code — ASP.NET Core APIs (minimal APIs or MVC), workers, EF Core data access. Builder playbook: layout, DI lifetimes, async/cancellation, EF Core discipline, options pattern, error contract, testing shape. Complements csharp-reviewer.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- renepf/claude-skillstheir own version, first seen Oct 25, 2026
- davidanthonyn/claude-skillstheir own version, first seen Oct 20, 2026
- gongyijie85/dsh-ecctheir own version, first seen Oct 13, 2026
- Fmarzochi/EGCtheir own version, first seen Sep 16, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- Fmarzochi/EGC★ 61same name
- gongyijie85/dsh-ecc★ 8same name
- ronmkr/PromptBook★ 2same name
- Rojios/everything-claude-code★ 1same name
- SamuelNDCE/claude-super-skill-library★ 1same name
- davidanthonyn/claude-skills★ 0same name
- renepf/claude-skills★ 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 repository51 other files it gives its agents.
- adrSkill
- agency-tier-uiSkill
- api-designSkill
- banner-designSkill
- brainstormingSkill
- brandSkill
- cavemanSkill
- coding-standardsSkill
- db-optimizationSkill
- designSkill
- design-systemSkill
- design-to-codeSkill
- dispatching-parallel-agentsSkill
- django-securitySkill
- e2e-testingSkill
- executing-plansSkill
- explainmeSkill
- finishing-a-development-branchSkill
- golang-patternsSkill
- greenfield-architectSkill
- hydraiaSkill
- karpathy-guidelinesSkill
- microservices-architectSkill
- mobile-design-framesSkill
- node-patternsSkill
- performance-tuningSkill
- production-auditSkill
- python-patternsSkill
- react-patternsSkill
- receiving-code-reviewSkill
- redesign-upliftSkill
- repo-scanSkill
- requesting-code-reviewSkill
- security-bounty-hunterSkill
- security-reviewSkill
- security-scanSkill
- slidesSkill
- springboot-patternsSkill
- springboot-securitySkill
- story-analysisSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- ui-stylingSkill
- ui-ux-pro-maxSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- web-design-framesSkill
- writing-plansSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
No lazy-loading proxies: load explicitly (Include) so every query's shape is visible — N+1 becomes impossible to miss.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
C#/.NET Backend Patterns
Layout
- Vertical slices (feature folders: endpoint + handler + models per feature) for API-shaped services; full Clean Architecture layering only when the domain genuinely warrants it — record the choice as an ADR either way.
- Minimal APIs for small/medium surfaces; MVC controllers when filters/model-binding complexity earns it.
DI lifetimes (the classic traps)
- Scoped services must NEVER be captured by singletons (captive dependency — resolve via
IServiceScopeFactoryinside the singleton instead). HttpClientviaIHttpClientFactory, nevernew HttpClient()per call (socket exhaustion).- Register by interface at the boundary you intend to fake in tests; concrete elsewhere is fine.
Async all the way
- No
.Result/.Wait()/GetAwaiter().GetResult()on async paths — deadlock and threadpool starvation fuel. CancellationTokenflows from the endpoint through every service and EF call:await db.Orders.ToListAsync(ct). Endpoints accept it; libraries propagate it.ValueTaskonly where profiling justifies it; default isTask.
EF Core discipline
- Reads:
AsNoTracking()by default; project to DTOs withSelect— never return entities from queries that don't update. - No lazy-loading proxies: load explicitly (
Include) so every query's shape is visible — N+1 becomes impossible to miss. - Migrations: one migration per change, reviewed like code; destructive column changes follow expand-contract (see db-optimization skill).
- Transactions explicit where multi-write consistency matters (
ExecutionStrategy+TransactionScope-free patterns withBeginTransactionAsync).
Config — options pattern
IOptions<T>withValidateDataAnnotations().ValidateOnStart()— invalid config fails the boot, not the first request.- Secrets from user-secrets/KeyVault/env — never appsettings committed values.
Error contract
ProblemDetails(RFC 9457) viaAddProblemDetails(); exceptions mapped centrally (exception handler middleware), typed domain exceptions → status codes. No try/catch per controller.- Nullable reference types ON project-wide; warnings as errors for new code.
Testing shape
- xUnit; unit tests fake at the interface boundary.
WebApplicationFactory<Program>for integration tests over the real pipeline (routing, filters, serialization) with a test database (Testcontainers where Docker exists).- Snapshot the API surface where the contract matters (Verify/ApiApprovals) so drift is a failing test.
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.

