dotnet-idioms
Skill157 starsChanged 3 months agoMITView on GitHub
.NET 8+ framework architecture: Minimal APIs, EF Core data access, IOptions configuration, middleware pipelines, and WebApplicationFactory testing. Use when building ASP.NET Core services, Web APIs, or .NET cloud backends. Pair with csharp-idioms.
In this repository59 other files it gives its agents.
- github-pages/agents.mdAGENTS.md
- adrSkill
- agent-protocolsSkill
- angular-idiomsSkill
- api-documentationSkill
- axum-idiomsSkill
- browser-automationSkill
- chaos-testingSkill
- ci-cdSkill
- cli-developmentSkill
- code-auditSkill
- code-reviewSkill
- cpp-idiomsSkill
- csharp-idiomsSkill
- data-engineeringSkill
- debugging-protocolSkill
- django-idiomsSkill
- elixir-idiomsSkill
- embedded-systemsSkill
- feature-flagsSkill
- flutter-idiomsSkill
- frontend-designSkill
- git-commit-integritySkill
- go-idiomsSkill
- guardrailsSkill
- hono-idiomsSkill
- incident-responseSkill
- java-idiomsSkill
- javascript-idiomsSkill
- kotlin-idiomsSkill
- laravel-idiomsSkill
- logging-implementationSkill
- ml-engineeringSkill
- mobile-designSkill
- mobile-testingSkill
- nextjs-idiomsSkill
- parallel-dispatchSkill
- payment-integrationSkill
- perf-optimizationSkill
- php-idiomsSkill
- postgres-idiomsSkill
- python-idiomsSkill
- rails-idiomsSkill
- react-idiomsSkill
- refactoring-patternsSkill
- research-methodologySkill
- ruby-idiomsSkill
- rust-idiomsSkill
- security-auditSkill
- sequential-thinkingSkill
- spring-boot-idiomsSkill
- sql-idiomsSkill
- structured-specSkill
- supply-chain-securitySkill
- swift-idiomsSkill
- testability-patternsSkill
- testing-strategySkill
- typescript-idiomsSkill
- vue-idiomsSkill
The file
Files
.NET Idioms and Patterns
.NET 8+ rewards minimal APIs, DI, and async-first design. Idiomatic .NET = clean, performant, cloud-native.
Scope: .NET framework patterns. For C#:
@.agents/skills/csharp-idioms/SKILL.md.
Minimal APIs
- Minimal APIs for simple endpoints:
app.MapGet("/api/tasks/{id}", async (string id, ITaskService service) => await service.GetByIdAsync(id) is Task task ? Results.Ok(task) : Results.NotFound()); app.MapPost("/api/tasks", async (CreateTaskRequest request, ITaskService service) => { var task = await service.CreateAsync(request); return Results.Created($"/api/tasks/{task.Id}", task); }); - Controllers for complex endpoints with filters, model binding, etc.
Entity Framework Core
- DbContext per request (scoped lifetime).
- Migrations via CLI:
dotnet ef migrations add AddTaskPriority dotnet ef database update AsNoTracking()for read-only queries.- Compiled queries for hot paths.
Configuration
IOptions<T>pattern for strongly-typed config:builder.Services.Configure<DatabaseOptions>(builder.Configuration.GetSection("Database"));- User secrets for local development, Key Vault for production.
Middleware
- Custom middleware for cross-cutting concerns (logging, correlation IDs).
UseExceptionHandlerfor global error handling.
Testing
For universal testing principles, see
.agents/rules/testing-strategy.md. Below: language-specific patterns only.
- xUnit + FluentAssertions:
[Fact] public async Task GetTask_ReturnsOk_WhenExists() { var client = _factory.CreateClient(); var response = await client.GetAsync("/api/tasks/1"); response.StatusCode.Should().Be(HttpStatusCode.OK); } WebApplicationFactory<T>for integration tests.- Respawn for database cleanup.
Formatting and Static Analysis
| Tool | Purpose | Command |
dotnet format | Formatting | dotnet format |
| Roslyn analyzers | Analysis | Built-in |
dotnet list package --vulnerable | CVE scanning | Built-in |
Related
- C# Idioms @.agents/skills/csharp-idioms/SKILL.md
- API Design Principles @.agents/rules/api-design-principles.md
- Database Design Principles @.agents/rules/database-design-principles.md
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.

