agentleFS
solakpetrisolakpetri/Enzo.Ai.Skills/skills/dotnet-backend/SKILL.md

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

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. ai4brands-design/claude-skills★ 2same name
    2. 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.

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
  1. Distinctive:

    Use this skill when working on production .NET backend systems.

    line 9
  2. Distinctive:

    Keep business logic separate from transport and infrastructure concerns.

    line 15
  3. Distinctive:

    Keep controllers and endpoints thin.

    line 16
  4. Distinctive:

    Put domain and application rules where they can be reused and tested without HTTP concerns.

    line 17
  5. Distinctive:

    When modifying an existing system, preserve working behavior unless the task explicitly changes it.

    line 19
  6. Distinctive:

    Use current C# features already accepted in the repository when they improve clarity.

    line 23
  7. Distinctive:

    Prefer clear types and names over cleverness.

    line 24
  8. Distinctive:

    Use nullable reference types correctly.

    line 26
  9. Very specific:

    Use required, pattern matching, switch expressions, and collection expressions when they improve readability and match repo style.

    line 27
  10. Distinctive:

    Keep API handlers focused on HTTP concerns: binding, status codes, headers, auth context, and result translation.

    line 31
  11. Distinctive:

    Put business rules in application or domain services, not controllers.

    line 32
  12. Distinctive:

    Keep transport validation at the boundary, but enforce business invariants in application or domain logic as well so they are not HTTP-only.

    line 35
  13. Distinctive:

    Do not let controllers, endpoints, or handlers accumulate persistence and orchestration logic.

    line 43
  14. Distinctive:

    Prefer simple solutions over unnecessary abstractions.

    line 44
  15. Very specific:

    Avoid generic repository abstractions that merely duplicate DbContext.

    line 45
  16. Distinctive:

    Use singleton only for services that are thread-safe and do not depend on scoped state.

    line 52
  17. Very specific:

    Treat DbContext as scoped.

    line 53
  18. Distinctive:

    Do not capture scoped services in singletons.

    line 54
  19. Distinctive:

    Prefer constructor injection.

    line 55
  20. Distinctive:

    Use async APIs for I/O.

    line 59
  21. Very specific:

    Avoid .Result, .Wait(), and sync-over-async.

    line 60
  22. Very specific:

    Do not fake async with Task.Run in server code unless there is a specific CPU-bound reason and it is understood.

    line 68
  23. Very specific:

    Use one DbContext per logical unit of work.

    line 72
  24. Very specific:

    Never execute concurrent operations against the same EF Core DbContext.

    line 73
  25. Very specific:

    Treat DbContext as not thread-safe.

    line 74
  26. Very specific:

    Use AsNoTracking() for appropriate read-only queries.

    line 75
  27. Distinctive:

    Prefer server-side filtering, sorting, aggregation, and pagination.

    line 78
  28. Distinctive:

    Keep transactions as short as practical.

    line 86
  29. Distinctive:

    Treat database constraints as part of protecting concurrency-sensitive invariants.

    line 87
  30. Distinctive:

    Use unique indexes, foreign keys, check constraints, and concurrency tokens where they enforce correctness.

    line 88
  31. Distinctive:

    Consider optimistic concurrency for update races.

    line 89
  32. Distinctive:

    If the project already uses repositories, follow the existing pattern.

    line 95
  33. Very specific:

    If it does not, prefer direct DbContext usage over adding a generic repository layer that adds no value.

    line 96
  34. Distinctive:

    Create repository abstractions only when they encapsulate real query logic, aggregate persistence rules, or boundary concerns.

    line 97
  35. Very specific:

    Use IHttpClientFactory rather than creating an HttpClient per request.

    line 101
  36. Distinctive:

    Keep external API mapping and error translation out of controllers.

    line 104
  37. Distinctive:

    Treat remote responses as unreliable input.

    line 105
  38. Distinctive:

    Consider idempotency for operations that may be retried or replayed.

    line 106
  39. Distinctive:

    Do not retry non-idempotent operations blindly.

    line 112
  40. Distinctive:

    Use backoff and limits. Avoid infinite or overly aggressive retries.

    line 113
  41. Very specific:

    Use ProblemDetails or the repository's established equivalent for API error payloads.

    line 120
  42. Distinctive:

    Use configuration binding patterns already present in the repository.

    line 128
  43. Distinctive:

    Never log secrets or credentials.

    line 131
  44. Distinctive:

    Prefer secret managers and environment-specific configuration over checked-in sensitive values.

    line 132
  45. Distinctive:

    Do not expose internal exception details to clients.

    line 144
  46. Distinctive:

    Use batching, projection, and pagination where appropriate.

    line 150
  47. Distinctive:

    Do not trade maintainability for speculative micro-optimizations.

    line 151
  48. Distinctive:

    Start by reading the existing flow end to end.

    line 155
  49. Distinctive:

    Avoid broad rewrites when a targeted fix will do.

    line 159
  50. Distinctive:

    If the current design has issues, improve the local area without forcing a full architecture migration.

    line 160
  51. Distinctive:

    Update or add tests when the repository has test coverage for the affected area.

    line 166
  52. Distinctive:

    If feasible, run the relevant tests for the changed area.

    line 168
  53. Distinctive:

    Do queries avoid N+1 behavior and over-fetching?

    line 180

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 ProblemDetails for 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 DbContext as 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 CancellationToken where appropriate from the request boundary through application, infrastructure, database, and external calls.
  • Accept CancellationToken in async methods that perform cancellable work.
public Task<OrderDto> GetOrderAsync(Guid id, CancellationToken cancellationToken)
  • Do not fake async with Task.Run in server code unless there is a specific CPU-bound reason and it is understood.

EF Core

  • Use one DbContext per logical unit of work.
  • Never execute concurrent operations against the same EF Core DbContext.
  • Treat DbContext as 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 SaveChangesAsync calls 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 DbContext usage 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 IHttpClientFactory rather than creating an HttpClient per 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 ProblemDetails or 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 CancellationToken propagated where appropriate?
  • Is EF Core usage safe, including DbContext lifetime 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 ProblemDetails where 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?

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.