dotnet-backend-patterns

Guide C#/.NET backend development with Clean Architecture, EF Core, and xUnit.

Updated Dec 16, 2025
One-click install
npx skills add https://github.com/EanLee/article-write --skill dotnet-backend-patterns-eanlee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-backend-patterns
Source: https://github.com/EanLee/article-write/tree/main/.github/skills/dotnet-backend-patterns
Command: npx skills add https://github.com/EanLee/article-write --skill dotnet-backend-patterns-eanlee

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to modern C#/.NET backend development patterns, enabling developers to build robust, scalable, and maintainable APIs and enterprise applications.

Core Features & Use Cases

  • Architecture: Implement Clean Architecture principles for organized codebases.
  • DI & Configuration: Master dependency injection lifetimes and the IOptions pattern.
  • Async Programming: Utilize async/await and ValueTask effectively.
  • Data Access: Leverage EF Core and Dapper for efficient data persistence.
  • Caching: Implement multi-level caching strategies with Redis.
  • Testing: Write unit and integration tests using xUnit.
  • Use Case: When starting a new .NET Web API project, use this Skill to structure your solution, configure services, and implement data access layers following best practices.

Quick Start

Use the dotnet-backend-patterns skill to generate a C# service template for a product catalog API.

Frequently Asked Questions about dotnet-backend-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a .NET Web API project using clean architecture?

To structure a .NET Web API project with clean architecture, organize your codebase into distinct layers for domain, application, infrastructure, and presentation. This separation ensures maintainable and scalable enterprise applications.

When should I use Dapper instead of EF Core for .NET data access?

You should use Dapper instead of EF Core for .NET data access when you need high-performance, lightweight micro-ORM capabilities for raw SQL queries, whereas EF Core is better suited for complex object-relational mapping and rapid development.

How do I configure dependency injection lifetimes and the IOptions pattern in C#?

To configure dependency injection lifetimes and the IOptions pattern in C#, register your services in the DI container using scoped, transient, or singleton lifetimes, and bind strongly-typed configuration classes via IOptions<T>.

What is the best way to implement multi-level caching with Redis in a .NET backend?

The best way to implement multi-level caching with Redis in a .NET backend is to combine in-memory caching for frequently accessed, low-latency data with distributed Redis caching for shared state across multiple server instances.

How do I write unit and integration tests for a C# Web API?

To write unit and integration tests for a C# Web API, use the xUnit testing framework to validate individual components and ensure end-to-end API endpoints function correctly through integration tests.

Can I use async/await and ValueTask effectively for scalable .NET backend development?

You can use async/await and ValueTask effectively for scalable .NET backend development to reduce asynchronous state machine allocations. ValueTask is particularly useful when asynchronous operations frequently complete synchronously.