microservice-architecture-ai-kit

Design .NET Clean Architecture microservices with CQRS and architectural dependency tests.

Updated May 11, 2026
One-click install
npx skills add https://github.com/ducthang-hub/nw-ai-kit --skill microservice-architecture-ai-kit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: microservice-architecture-ai-kit
Source: https://github.com/ducthang-hub/nw-ai-kit/tree/main/.agents/skills/microservice-architecture-ai-kit
Command: npx skills add https://github.com/ducthang-hub/nw-ai-kit --skill microservice-architecture-ai-kit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you structure .NET microservices so teams stay maintainable as complexity grows, preventing broken dependencies between API, Application, Domain, Infrastructure, and (optionally) Persistence.

Core Features & Use Cases

  • Clean Architecture + CQRS microservice blueprint: Enforces layer separation and CQRS patterns using Mediator (commands/queries/handlers).
  • Versioned REST API + controller conventions: Standardizes v{version}/routing and controller behavior via shared conventions.
  • Dependency injection per layer: Supports per-layer Add* registration (Api/Application/Infrastructure/Persistence) to keep wiring consistent.
  • Architectural test guardrails: Uses architectural tests (e.g., NetArchTest) to validate layer dependency rules before changes land.
  • Database-aware guidance: Provides explicit persistence integration points (EF Core context interface/implementation, configurations, migrations) when a database is included.

Use it when you are building a domain-owning backend service that persists data (EF Core) and exposes APIs to other services or a BFF, and you want consistent structure plus automated architectural enforcement.

Quick Start

Ask for a ready-to-implement solution structure by saying: "Generate a Clean Architecture + CQRS .NET microservice skeleton for an AssetPrice domain using Mediator, versioned controllers, per-layer Add* DI, and architectural dependency tests, including EF Core persistence when a database is required."

Frequently Asked Questions about microservice-architecture-ai-kit

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

FAQPage Schema
How do I structure a .NET microservice using Clean Architecture and CQRS?

Structure a .NET Clean Architecture microservice by separating API, Application, Domain, Infrastructure, and Persistence layers, using Mediator for CQRS command/query handler patterns. This enforces strict layer dependencies and consistent controller conventions to keep backend services maintainable as complexity grows.

How do I prevent invalid cross-layer dependencies in a .NET microservice?

Prevent invalid cross-layer dependencies in a .NET microservice by using architectural tests like NetArchTest to validate layer dependency rules before changes land. This automated guardrail ensures API, Application, Domain, and Infrastructure layers remain strictly separated during development.

Does Clean Architecture work with EF Core persistence in microservices?

Clean Architecture works with EF Core persistence in microservices by providing explicit persistence integration points, including EF Core context interfaces, implementations, configurations, and migrations. The per-layer dependency injection registration keeps database wiring consistent across the Domain and Infrastructure layers.

What is the best way to enforce CQRS patterns with Mediator in .NET?

The best way to enforce CQRS patterns with Mediator in .NET is to standardize command/query/handler implementations across the Application layer. Combined with per-layer Add* dependency injection registration, this maintains consistent Mediator wiring and separates read operations from write operations effectively.

How do I set up versioned REST APIs in a .NET Clean Architecture project?

Set up versioned REST APIs in a .NET Clean Architecture project by standardizing v{version}/ routing and controller behavior via shared conventions. This ensures consistent API exposure across microservices that communicate with other services or a Backend-for-Frontend.

When do I need architectural testing for microservices?

You need architectural testing for microservices when building domain-owning backend services and want automated enforcement of layer dependency rules. It validates that API, Application, Domain, and Infrastructure layers maintain strict separation before code changes land in the repository.