jdanigo/hydraia/dotnet-patterns
Claude Code and agent skill by jdanigo/hydraia
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install jdanigo/hydraia/dotnet-patternsSKILL.md
The same SKILL.md was published earlier as jdanigo/hydraia/dotnet-patterns.
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.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/dotnet-patterns/SKILL.md
Popularity
- Repository stars
- 8
- 7-day trend score
- 11
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jdanigo/hydraia/dotnet-patterns)