clean-architecture
Complete toolkit for building .NET Clean Architecture applications with FastEndpoints, Repository pattern, and Domain-Driven Design
What this skill does
# .NET Clean Architecture Skill
This skill helps you build, migrate, and maintain .NET monolithic applications following Clean Architecture principles and Domain-Driven Design patterns, based on Microsoft's eShopOnWeb reference application.
## Commands
### `/clean-arch:new`
**Interactive project scaffolding wizard**
Scaffold a new Clean Architecture solution from scratch with your choice of API style, database, and testing setup.
### `/clean-arch:migrate`
**Brownfield migration assistant**
Analyze and migrate existing codebases to Clean Architecture, guiding you through layer separation and refactoring.
### `/clean-arch:add-feature <EntityName>`
**Feature generator**
Generate a complete CRUD feature across all layers: entity, repository, specifications, service, API endpoints, and tests.
### `/clean-arch:audit`
**Architecture validator**
Scan your project for architecture violations, dependency issues, and anti-patterns with actionable fix suggestions.
### `/clean-arch:patterns`
**Pattern library browser**
Browse and copy proven Clean Architecture patterns: Repository, Specification, Domain Events, DI, Testing, and more.
## Prerequisites
- .NET 10 SDK or later
- Basic understanding of C#, ASP.NET Core, and Entity Framework Core
- Familiarity with SOLID principles
---
# Section A: Clean Architecture Overview
## What is Clean Architecture?
Clean Architecture is an architectural pattern that separates concerns into distinct layers with clear dependency rules:
```
┌─────────────────────────────────────────┐
│ Presentation (API/Web) │ ← User Interface
│ Controllers/Endpoints, Pages, ViewModels│
└────────────┬────────────────────────────┘
│ depends on ↓
┌────────────▼────────────────────────────┐
│ Application Core (Domain) │ ← Business Logic
│ Entities, Interfaces, Services, │
│ Specifications, Domain Events │
└────────────┬────────────────────────────┘
│ depends on ↓
┌────────────▼────────────────────────────┐
│ Infrastructure (Data) │ ← External Concerns
│ DbContext, Repositories, Identity, │
│ Email, File System, External APIs │
└──────────────────────────────────────────┘
```
**Key Principle:** Dependencies point INWARD. The Application Core has NO dependencies on external layers.
## Project Structure
```
MySolution/
├── src/
│ ├── ApplicationCore/ # Domain layer (no dependencies)
│ │ ├── Entities/ # Domain entities & aggregates
│ │ ├── Interfaces/ # Service & repository contracts
│ │ ├── Services/ # Business logic
│ │ ├── Specifications/ # Query objects
│ │ ├── Events/ # Domain events
│ │ └── Exceptions/ # Domain exceptions
│ │
│ ├── Infrastructure/ # Data access & external concerns
│ │ ├── Data/ # EF Core DbContext, migrations
│ │ │ ├── Config/ # Entity configurations
│ │ │ └── Migrations/ # EF migrations
│ │ ├── Identity/ # ASP.NET Identity
│ │ └── Services/ # Infrastructure services (email, etc.)
│ │
│ └── API/ # Presentation layer (FastEndpoints)
│ ├── Endpoints/ # API endpoints
│ │ ├── ProductEndpoints/
│ │ ├── OrderEndpoints/
│ │ └── AuthEndpoints/
│ ├── Extensions/ # DI registration
│ └── Program.cs # Application startup
│
└── tests/
├── UnitTests/ # Fast, isolated tests
│ ├── ApplicationCore/
│ └── Builders/ # Test data builders
├── IntegrationTests/ # Repository + DB tests
└── FunctionalTests/ # API end-to-end tests
```
## Dependency Rules
1. **ApplicationCore** → No dependencies (pure domain logic)
2. **Infrastructure** → References ApplicationCore only
3. **API/Web** → References ApplicationCore and Infrastructure
4. **Tests** → Can reference any project
---
# Section B: Command Implementation Guides
## Command: `/clean-arch:new`
When the user invokes this command, follow this workflow:
### Step 1: Gather Project Information
Use `AskUserQuestion` to gather:
```xml
<question 1>
Question: "What is your project name?"
Header: "Project Name"
Options:
- Enter custom name (text input)
Default: MySolution
</question>
<question 2>
Question: "Which API style do you prefer?"
Header: "API Style"
Options:
- FastEndpoints (Recommended for new projects)
- Minimal APIs (Lightweight, built-in)
- Controllers (Traditional MVC)
</question>
<question 3>
Question: "Which database will you use?"
Header: "Database"
Options:
- SQL Server (LocalDB for development)
- PostgreSQL
- In-Memory (for testing/prototyping)
</question>
<question 4>
Question: "Include authentication setup?"
Header: "Authentication"
Options:
- Yes, with JWT Bearer authentication
- Yes, with ASP.NET Identity
- No, I'll add it later
</question>
```
### Step 2: Generate Solution Structure
Create the directory structure and solution file:
```bash
mkdir -p src/ApplicationCore src/Infrastructure src/API tests/UnitTests tests/IntegrationTests
dotnet new sln -n {ProjectName}
dotnet new classlib -n ApplicationCore -o src/ApplicationCore
dotnet new classlib -n Infrastructure -o src/Infrastructure
dotnet new webapi -n API -o src/API
dotnet new xunit -n UnitTests -o tests/UnitTests
dotnet new xunit -n IntegrationTests -o tests/IntegrationTests
dotnet sln add src/ApplicationCore/ApplicationCore.csproj
dotnet sln add src/Infrastructure/Infrastructure.csproj
dotnet sln add src/API/API.csproj
dotnet sln add tests/UnitTests/UnitTests.csproj
dotnet sln add tests/IntegrationTests/IntegrationTests.csproj
```
### Step 3: Configure Project References
```bash
# Infrastructure depends on ApplicationCore
dotnet add src/Infrastructure/Infrastructure.csproj reference src/ApplicationCore/ApplicationCore.csproj
# API depends on both
dotnet add src/API/API.csproj reference src/ApplicationCore/ApplicationCore.csproj
dotnet add src/API/API.csproj reference src/Infrastructure/Infrastructure.csproj
# Tests depend on what they test
dotnet add tests/UnitTests/UnitTests.csproj reference src/ApplicationCore/ApplicationCore.csproj
dotnet add tests/IntegrationTests/IntegrationTests.csproj reference src/Infrastructure/Infrastructure.csproj
```
### Step 4: Add NuGet Packages
**ApplicationCore** (domain layer - minimal dependencies):
```bash
cd src/ApplicationCore
dotnet add package Ardalis.GuardClauses
dotnet add package Ardalis.Specification
dotnet add package Ardalis.Result
dotnet add package MediatR
```
**Infrastructure** (data access):
```bash
cd ../Infrastructure
dotnet add package Microsoft.EntityFrameworkCore.SqlServer # or .Npgsql for PostgreSQL
dotnet add package Microsoft.EntityFrameworkCore.InMemory
dotnet add package Ardalis.Specification.EntityFrameworkCore
dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore
```
**API** (presentation):
```bash
cd ../API
# If FastEndpoints chosen:
dotnet add package FastEndpoints
dotnet add package FastEndpoints.Swagger
# If Minimal APIs chosen: (no extra package needed)
# Common packages:
dotnet add package AutoMapper.Extensions.Microsoft.DependencyInjection
dotnet add package Microsoft.AspNetCore.Authentication.JwtBearer
```
**Tests**:
```bash
cd ../../tests/UnitTests
dotnet add package NSubstitute
dotnet add package xunit
dotnet add package xunit.runner.visualstudio
dotnet add package coverlet.collector
cd ../IntegrationTests
dotnet add package Microsoft.EntityFrameworkCore.InMemory
dotnet add package xunit
```
### Step 5: Generate Base Code Files
Create the following files using the patterns in Section D:
**ApplicationCore**:
- `Entities/BaseEntity.cs`
- `Interfaces/IAggregateRoot.cs`
- `Interfaces/IRepository.cs`
- `Interfaces/IReadRepository.cs`
**Infrastructure**:
- Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.