dotnet-backend
Skill1 starsChanged 3 months agoMITView on GitHub
Design, implement, refactor, and review production .NET backend applications using C#, ASP.NET Core, dependency injection, asynchronous programming, APIs, persistence, and layered architecture. Use when creating or modifying backend services, endpoints, application services, repositories, domain logic, or infrastructure in a .NET project.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- JAXTech-Labs/claude-code-templatetheir own version, first seen Apr 7, 2026
- ai4brands-design/claude-skillstheir own version, first seen Mar 22, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- ai4brands-design/claude-skills★ 2same name
- JAXTech-Labs/claude-code-template★ 2same 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 repository4 other files it gives its agents.
- architecture-reviewSkill
- code-reviewSkill
- dotnet-testingSkill
- ef-coreSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
53 rules. About 0 are common, 41 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈41
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Use this skill when working on production .NET backend systems.
- Distinctive: line 15
Keep business logic separate from transport and infrastructure concerns.
- Distinctive: line 16
Keep controllers and endpoints thin.
- Distinctive: line 17
Put domain and application rules where they can be reused and tested without HTTP concerns.
- Distinctive: line 19
When modifying an existing system, preserve working behavior unless the task explicitly changes it.
- Distinctive: line 23
Use current C# features already accepted in the repository when they improve clarity.
- Distinctive: line 24
Prefer clear types and names over cleverness.
- Distinctive: line 26
Use nullable reference types correctly.
- Very specific: line 27
Use required, pattern matching, switch expressions, and collection expressions when they improve readability and match repo style.
- Distinctive: line 31
Keep API handlers focused on HTTP concerns: binding, status codes, headers, auth context, and result translation.
- Distinctive: line 32
Put business rules in application or domain services, not controllers.
- Distinctive: line 35
Keep transport validation at the boundary, but enforce business invariants in application or domain logic as well so they are not HTTP-only.
- Distinctive: line 43
Do not let controllers, endpoints, or handlers accumulate persistence and orchestration logic.
- Distinctive: line 44
Prefer simple solutions over unnecessary abstractions.
- Very specific: line 45
Avoid generic repository abstractions that merely duplicate DbContext.
- Distinctive: line 52
Use singleton only for services that are thread-safe and do not depend on scoped state.
- Very specific: line 53
Treat DbContext as scoped.
- Distinctive: line 54
Do not capture scoped services in singletons.
- Distinctive: line 55
Prefer constructor injection.
- Distinctive: line 59
Use async APIs for I/O.
- Very specific: line 60
Avoid .Result, .Wait(), and sync-over-async.
- Very specific: line 68
Do not fake async with Task.Run in server code unless there is a specific CPU-bound reason and it is understood.
- Very specific: line 72
Use one DbContext per logical unit of work.
- Very specific: line 73
Never execute concurrent operations against the same EF Core DbContext.
- Very specific: line 74
Treat DbContext as not thread-safe.
- Very specific: line 75
Use AsNoTracking() for appropriate read-only queries.
- Distinctive: line 78
Prefer server-side filtering, sorting, aggregation, and pagination.
- Distinctive: line 86
Keep transactions as short as practical.
- Distinctive: line 87
Treat database constraints as part of protecting concurrency-sensitive invariants.
- Distinctive: line 88
Use unique indexes, foreign keys, check constraints, and concurrency tokens where they enforce correctness.
- Distinctive: line 89
Consider optimistic concurrency for update races.
- Distinctive: line 95
If the project already uses repositories, follow the existing pattern.
- Very specific: line 96
If it does not, prefer direct DbContext usage over adding a generic repository layer that adds no value.
- Distinctive: line 97
Create repository abstractions only when they encapsulate real query logic, aggregate persistence rules, or boundary concerns.
- Very specific: line 101
Use IHttpClientFactory rather than creating an HttpClient per request.
- Distinctive: line 104
Keep external API mapping and error translation out of controllers.
- Distinctive: line 105
Treat remote responses as unreliable input.
- Distinctive: line 106
Consider idempotency for operations that may be retried or replayed.
- Distinctive: line 112
Do not retry non-idempotent operations blindly.
- Distinctive: line 113
Use backoff and limits. Avoid infinite or overly aggressive retries.
- Very specific: line 120
Use ProblemDetails or the repository's established equivalent for API error payloads.
- Distinctive: line 128
Use configuration binding patterns already present in the repository.
- Distinctive: line 131
Never log secrets or credentials.
- Distinctive: line 132
Prefer secret managers and environment-specific configuration over checked-in sensitive values.
- Distinctive: line 144
Do not expose internal exception details to clients.
- Distinctive: line 150
Use batching, projection, and pagination where appropriate.
- Distinctive: line 151
Do not trade maintainability for speculative micro-optimizations.
- Distinctive: line 155
Start by reading the existing flow end to end.
- Distinctive: line 159
Avoid broad rewrites when a targeted fix will do.
- Distinctive: line 160
If the current design has issues, improve the local area without forcing a full architecture migration.
- Distinctive: line 166
Update or add tests when the repository has test coverage for the affected area.
- Distinctive: line 168
If feasible, run the relevant tests for the changed area.
- Distinctive: line 180
Do queries avoid N+1 behavior and over-fetching?
≈ “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
Dotnet Backend
Use this skill when working on production .NET backend systems.
Inspect the repository before changing code. Follow existing conventions, naming, layering, libraries, and testing patterns before introducing new ones. Do not impose Clean Architecture, CQRS, MediatR, repository layers, or other patterns unless the repository already uses them or the change clearly benefits from them.
General Principles
- Keep business logic separate from transport and infrastructure concerns.
- Keep controllers and endpoints thin. Parse the request, delegate work, translate the result.
- Put domain and application rules where they can be reused and tested without HTTP concerns.
- Optimize based on evidence, not premature optimization.
- When modifying an existing system, preserve working behavior unless the task explicitly changes it.
Modern C#
- Use current C# features already accepted in the repository when they improve clarity.
- Prefer clear types and names over cleverness.
- Favor immutability for request and response models when practical.
- Use nullable reference types correctly. Do not silence warnings without understanding the nullability contract.
- Use
required, pattern matching, switch expressions, and collection expressions when they improve readability and match repo style.
ASP.NET Core APIs
- Keep API handlers focused on HTTP concerns: binding, status codes, headers, auth context, and result translation.
- Put business rules in application or domain services, not controllers.
- Return consistent error responses. Prefer
ProblemDetailsfor server-side API errors. - Validate requests at the boundary before executing business logic.
- Keep transport validation at the boundary, but enforce business invariants in application or domain logic as well so they are not HTTP-only.
- Distinguish between create, update, delete, and query operations clearly.
- Be explicit about route shape, response codes, and contracts.
Architecture And Boundaries
- Respect the existing architecture first.
- Separate transport, application logic, domain logic, and infrastructure concerns even in smaller projects.
- Do not let controllers, endpoints, or handlers accumulate persistence and orchestration logic.
- Prefer simple solutions over unnecessary abstractions.
- Avoid generic repository abstractions that merely duplicate
DbContext. - Introduce abstractions when they isolate a real boundary, external dependency, or complex policy.
Dependency Injection
- Register services with the narrowest lifetime that matches their behavior.
- Prefer stateless services.
- Use singleton only for services that are thread-safe and do not depend on scoped state.
- Treat
DbContextas scoped. - Do not capture scoped services in singletons.
- Prefer constructor injection. Avoid service locator patterns.
Async And Cancellation
- Use async APIs for I/O.
- Avoid
.Result,.Wait(), and sync-over-async. - Propagate
CancellationTokenwhere appropriate from the request boundary through application, infrastructure, database, and external calls. - Accept
CancellationTokenin async methods that perform cancellable work.
public Task<OrderDto> GetOrderAsync(Guid id, CancellationToken cancellationToken)- Do not fake async with
Task.Runin server code unless there is a specific CPU-bound reason and it is understood.
EF Core
- Use one
DbContextper logical unit of work. - Never execute concurrent operations against the same EF Core
DbContext. - Treat
DbContextas not thread-safe. - Use
AsNoTracking()for appropriate read-only queries. - Avoid N+1 queries.
- Project only required database fields where practical.
- Prefer server-side filtering, sorting, aggregation, and pagination.
- Be deliberate about
Include; use it when needed, not by default. - Watch for client-side evaluation and accidental materialization too early.
- Persist changes intentionally; do not scatter
SaveChangesAsynccalls across one workflow without understanding transaction boundaries.
Transactions, Concurrency, And Integrity
- Think explicitly about transaction boundaries.
- Keep transactions as short as practical.
- Treat database constraints as part of protecting concurrency-sensitive invariants.
- Use unique indexes, foreign keys, check constraints, and concurrency tokens where they enforce correctness.
- Consider optimistic concurrency for update races.
- Handle duplicate key and concurrency failures explicitly where they affect behavior.
- Make state transitions explicit and protect invariants in code and in the database.
Repository Usage
- If the project already uses repositories, follow the existing pattern.
- If it does not, prefer direct
DbContextusage over adding a generic repository layer that adds no value. - Create repository abstractions only when they encapsulate real query logic, aggregate persistence rules, or boundary concerns.
HTTP Clients And External APIs
- Use
IHttpClientFactoryrather than creating anHttpClientper request. - Configure named or typed clients when the integration has distinct settings or policies.
- Set explicit timeout behavior and understand where it is enforced.
- Keep external API mapping and error translation out of controllers.
- Treat remote responses as unreliable input. Validate and handle missing or malformed data.
- Consider idempotency for operations that may be retried or replayed.
Resilience
- Apply timeout, retry, circuit breaker, and rate limiting policies where they fit the dependency and failure mode.
- Retry only operations that are safe to retry.
- Do not retry non-idempotent operations blindly.
- Use backoff and limits. Avoid infinite or overly aggressive retries.
- Distinguish transient failures from validation, auth, and permanent business failures.
Validation, Errors, And Authorization
- Validate requests before mutating state.
- Return domain-appropriate failures, not raw exception text.
- Use
ProblemDetailsor the repository's established equivalent for API error payloads. - Reserve exceptions for exceptional cases; do not use them for ordinary control flow.
- Distinguish authentication from authorization.
- Perform authorization server-side.
- Enforce resource-level authorization where needed, not only endpoint-level checks.
Configuration, Secrets, And Logging
- Use configuration binding patterns already present in the repository.
- Fail clearly on missing required configuration.
- Never commit secrets.
- Never log secrets or credentials.
- Prefer secret managers and environment-specific configuration over checked-in sensitive values.
- Use structured logging.
- Log enough context to diagnose failures, but avoid noisy logs and sensitive data.
- Include correlation identifiers or request identifiers when the system already supports them.
Security
- Validate all external input.
- Parameterize database access; do not build SQL unsafely.
- Apply least privilege to service accounts, API keys, and database access.
- Sanitize data crossing trust boundaries.
- Be careful with file access, deserialization, redirects, and user-controlled URLs.
- Do not expose internal exception details to clients.
Performance
- Measure first when performance is the goal.
- Eliminate obvious waste in hot paths: unnecessary allocations, repeated queries, over-fetching, excessive serialization, and chatty network calls.
- Use batching, projection, and pagination where appropriate.
- Do not trade maintainability for speculative micro-optimizations.
Refactoring Existing Systems
- Start by reading the existing flow end to end.
- Match the repository's patterns unless they block the requested change or are clearly unsafe.
- Make the smallest coherent change that preserves behavior.
- Separate cleanup from functional changes when possible.
- Avoid broad rewrites when a targeted fix will do.
- If the current design has issues, improve the local area without forcing a full architecture migration.
Implementation Workflow
- Inspect the affected project structure, startup wiring, tests, and local conventions first.
- Identify the real execution path before editing.
- Update or add tests when the repository has test coverage for the affected area.
- Build the affected projects before considering implementation complete.
- If feasible, run the relevant tests for the changed area.
- Review logs, nullability, cancellation, query shape, transaction boundaries, and auth impact before finishing.
Code Review Checklist
- Does the change follow existing repository conventions?
- Are controllers or endpoints still thin?
- Is business logic separated from transport and infrastructure concerns?
- Are async APIs used for I/O without
.Result,.Wait(), or sync-over-async? - Is
CancellationTokenpropagated where appropriate? - Is EF Core usage safe, including
DbContextlifetime and no concurrent operations on the same context? - Are read-only queries using
AsNoTracking()where appropriate? - Do queries avoid N+1 behavior and over-fetching?
- Are transaction boundaries explicit and correct?
- Are concurrency-sensitive invariants protected in code and by database constraints where needed?
- Are retries applied only to safe operations?
- Is idempotency considered for retried or externally repeated operations?
- Is validation performed at the boundary?
- Are errors translated to the API contract appropriately, including
ProblemDetailswhere used? - Is authorization enforced server-side and at the right resource boundary?
- Are configuration and secrets handled safely?
- Is logging structured and free of secrets?
- Are security and performance risks considered without unnecessary abstraction?
- Was the affected project built, and were relevant tests run if available?
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.

