Claude Code Plugins

Community-maintained marketplace

Feedback

dotnet-clean-architecture

@DoubleslashSE/claude-workflows
0
0

.NET Clean Architecture patterns with CQRS, MediatR, and FluentValidation. Use when implementing features, designing components, or reviewing code in this codebase.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name dotnet-clean-architecture
description .NET Clean Architecture patterns with CQRS, MediatR, and FluentValidation. Use when implementing features, designing components, or reviewing code in this codebase.

.NET Clean Architecture Patterns

Architecture Layers

API Layer (Controllers/Endpoints)
    ↓
Application Layer (Commands, Queries, Handlers, Validators)
    ↓
Infrastructure Layer (EF Core, External Services)
    ↓
Core Layer (Entities, Value Objects, Interfaces)

Dependency Rule: Dependencies flow INWARD only. Core has no external dependencies.

File Organization

Commands

Application/{Feature}/Commands/{Action}/
├── {Action}{Entity}Command.cs
├── {Action}{Entity}CommandHandler.cs
└── {Action}{Entity}CommandValidator.cs

Queries

Application/{Feature}/Queries/{Action}/
├── {Action}{Entity}Query.cs
├── {Action}{Entity}QueryHandler.cs
└── {Action}{Entity}QueryResult.cs

Naming Conventions

Type Pattern Example
Command {Action}{Entity}Command CreateAuctionCommand
Handler {Action}{Entity}CommandHandler CreateAuctionCommandHandler
Validator {Action}{Entity}CommandValidator CreateAuctionCommandValidator
Query {Action}{Entity}Query GetAuctionDetailsQuery
Repository I{Entity}Repository IAuctionRepository

Code Patterns

Command Example

public record CreateAuctionCommand(
    Guid SellerId,
    string Title,
    decimal StartingPrice,
    DateTime EndDate
) : IRequest<Guid>;

Entity Example

public class Auction : Entity
{
    public Guid SellerId { get; private set; }
    public string Title { get; private set; } = string.Empty;

    private Auction() { } // EF Core

    public static Auction Create(Guid sellerId, string title, ...)
    {
        return new Auction { ... };
    }
}

Anti-Patterns to Avoid

  • DO NOT reference Infrastructure from Core
  • DO NOT put business logic in controllers
  • DO NOT bypass Application layer from API
  • DO NOT use async void (except event handlers)
  • DO NOT use Task.Result or Task.Wait()
  • DO NOT create N+1 query patterns
  • DO NOT forget AsNoTracking() for read-only queries

Additional Resources

For detailed code examples and patterns, see patterns.md.