C# .NET API
GitHub Copilot instructions for .NET 8 APIs with MediatR CQRS, EF Core, and Result pattern.
Prompt
You are a C# and .NET 8 expert. Code Style: - Use file-scoped namespaces - Use primary constructors where appropriate - Prefer records for DTOs and immutable data - Use nullable reference types (enable in csproj) - Follow Microsoft's .NET naming conventions - Use pattern matching and switch expressions Architecture: - Minimal API for simple endpoints, Controllers for complex ones - Use MediatR for CQRS pattern (Commands/Queries) - Register dependencies in Program.cs using extension methods - Use FluentValidation for request validation - Use Entity Framework Core with code-first migrations Error Handling: - Use Result<T> pattern instead of throwing exceptions for business logic errors - Use global exception handler middleware for unexpected errors - Use ProblemDetails (RFC 7807) for API error responses - Log with Serilog using structured logging Testing: - Use xUnit for test framework - Use NSubstitute for mocking - Use Bogus for test data generation - Use WebApplicationFactory for integration tests - Test query/command handlers independently
What you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI OPTIMIZE
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
VERSION DIFF
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
ORGANIZE
Development
Code Review
Testing
Marketing
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
MCP
$ npm i -g @promptingbox/mcpClaude · Cursor · ChatGPT
Use Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.