/prompt-dotnet
.NET project-aware prompt perfection. Scans your project files before asking any questions — framework version, architecture, auth, ORM, and Docker are pre-filled automatically.
Updated in v4.6
- HARD-GATE — verifies
.csprojwas read before stating any .NET version or package names - Project Scan on startup — reads
.csproj,Program.cs,appsettings.json,Dockerfile,docker-compose.yml - Zero repeated questions — detects framework, auth, ORM, DB, Docker without asking
- Stack-aware best practices — applies detected .NET version, EF Core, PostgreSQL, JWT rules automatically
- Consistency-first recommendations — suggests patterns already in use in your project
Overview
| Aspect | Details |
|---|---|
| Speed | ~3 seconds |
| Version | v2.0 |
| Format | .claude/skills/prompt-dotnet/SKILL.md |
| Best For | C# APIs, EF Core migrations, middleware, auth, .NET features |
| Related | /prompt-react for the React frontend, /prompt-technical for architecture |
Usage
/prompt-dotnet [describe what you want to implement or fix]How It Works
Step 1 — Project Scan (always first)
Before any analysis, the skill reads your project:
.csproj— TargetFramework, key NuGet packagesProgram.cs— Minimal API vs controllers, DI registrations, middleware, auth setupappsettings.json— connection strings, config keysDockerfile(if present) — build/runtime imagedocker-compose.yml(if present) — service name, ports, networks.claude/memory/project-profile.md(if present)
Output displayed before analysis:
PROJECT SCAN COMPLETE
Framework: net10.0
Architecture: Minimal API
Auth: JWT
ORM: EF Core | DB: PostgreSQL — ConnectionStrings:Default
Docker: yes — stack: myapp
Packages: FluentValidation, Serilog, MediatRStep 2 — Completeness Check (pre-filled)
| Criterion | Status | Source |
|---|---|---|
| Framework version | ✓ pre-filled | .csproj |
| Architecture pattern | ✓ pre-filled | Program.cs |
| Auth mechanism | ✓ pre-filled | Program.cs |
| ORM / DB access | ✓ pre-filled | packages |
| Specific goal | ❓ from user | |
| Affected files | ❓ inferred or asked | |
| Expected behavior | ❓ from user |
Step 3 — Clarification (only unknown items)
Only asks for what the scan cannot determine. If multiple valid approaches exist, marks ⭐ the one consistent with your existing project (consistency over personal preference).
Step 4 — Best Practices Applied Automatically
Based on the detected stack, applies rules without asking:
General .NET 10:
- Async/await throughout — no
.Resultor.Wait() CancellationTokenon all async IO methodsILogger<T>injection, not static loggingrecordtypes for DTOs where appropriateIResultreturn types for Minimal API endpoints
If EF Core detected:
ToListAsync(),FirstOrDefaultAsync(),SaveChangesAsync()AsNoTracking()for read-only queries- Explicit
.Include()— no lazy loading in APIs
If PostgreSQL detected:
snake_casenaming convention if configuredNpgsql.EntityFrameworkCore.PostgreSQLprovider conventions
If JWT detected:
[Authorize]attribute usage- Claims extraction patterns
- Token validation in middleware, not controllers
If Docker detected:
- No hardcoded connection strings — env vars /
IConfiguration - Health check endpoints (
/health) if missing - Port from
ASPNETCORE_URLS
Examples
Add an API Endpoint
/prompt-dotnet Add a PATCH endpoint for updating user profileScan detects: net10.0, Minimal API, JWT, EF Core + PostgreSQL, Docker
Output:
PROJECT SCAN COMPLETE
Framework: net10.0 | Architecture: Minimal API
Auth: JWT | ORM: EF Core | DB: PostgreSQL
Docker: yes
What changes do you want to make to the user profile?
(framework, auth, ORM pre-filled — only asking about specifics)
Clarification:
1. Which fields should be patchable? (name, email, avatar, all)
2. Should the endpoint validate ownership (user can only edit own profile)?
✨ Perfected .NET Prompt:
Goal: Add PATCH /users/{id}/profile endpoint that updates user profile fields
Project Context (from scan):
- Framework: net10.0, Minimal API pattern
- Auth: JWT — ownership validated via claims
- ORM: EF Core async + AsNoTracking for reads
Scope:
- Modify: Program.cs (route registration)
- Create: Features/Users/UpdateProfileHandler.cs
- Modify: Data/AppDbContext.cs (if new query needed)
Best Practices:
- async/await with CancellationToken
- IResult return type
- [Authorize] on endpoint
- FluentValidation for request body (already in project)
Proceed? [y / modify / no]EF Core Migration
/prompt-dotnet Add CreatedAt and UpdatedAt audit columns to all entitiesOutput:
PROJECT SCAN COMPLETE
Framework: net10.0 | ORM: EF Core | DB: PostgreSQL
snake_case convention: yes
Clarification:
1. Should CreatedAt be set automatically (shadow property vs explicit)?
2. Update UpdatedAt via SaveChanges override or manually?
✨ Perfected .NET Prompt:
Goal: Add audit columns to all entities via base class or interface
Best Practices:
- IAuditableEntity interface pattern
- Override SaveChangesAsync in DbContext
- PostgreSQL: timestamp with time zone (not DateTime)
- Migration: dotnet ef migrations add AddAuditColumns
Proceed? [y / modify / no]Bug Fix
/prompt-dotnet Fix N+1 query on the orders endpointOutput:
Detected: EF Core + PostgreSQL, Minimal API
Analysis: N+1 typically caused by missing .Include() on navigation properties.
Clarification:
1. Which endpoint? (GET /orders, GET /orders/{id}, other)
2. Which navigation properties are loaded (OrderItems, Customer, etc.)?
✨ Perfected .NET Prompt:
Add explicit .Include() chain, verify with AsNoTracking(), consider projection to DTO.Comparison
| Feature | /prompt | /prompt-dotnet | /prompt-technical |
|---|---|---|---|
| Project scan | No | .NET files | Codebase-wide |
| Pre-fills context | Memory only | .csproj + Program.cs | Agent exploration |
| .NET best practices | No | Yes (auto) | Manual |
| Speed | ~2s | ~3s | 5-30s |
| Agent spawning | No | No | Yes (complex) |
When to Use
Good For
- Adding API endpoints, services, repositories
- EF Core migrations and query optimization
- Middleware and DI configuration
- JWT auth implementation
- Fixing .NET-specific bugs (N+1, async pitfalls, DI issues)
- Docker / deployment preparation
Not Ideal For
- React/frontend work → Use
/prompt-react - Deep architectural decisions across many files → Use
/prompt-technical - Security audits → Use
/prompt-research
Tips
Let the Scan Do the Work
Don't include stack details in your prompt — the scan handles it:
# Not needed
/prompt-dotnet Add endpoint using EF Core with async/await and CancellationToken for PostgreSQL
# Just describe what you want
/prompt-dotnet Add endpoint to export user activity as CSVPair with /prompt-react for Full-Stack Work
# Backend
/prompt-dotnet Add POST /api/items endpoint with FluentValidation
# Frontend
/prompt-react Add form that calls POST /api/items with error handlingRelated Commands
- /prompt-react — for the React frontend
- /prompt-technical — for broader architectural decisions
- /prompt-hybrid — for complex cross-cutting changes
- /prompt-research — for security audits and deep analysis