CleanArchitecture
AGENTS.md21k starsChanged 5 years agoMITView on GitHub
Use this guide when changing either this template repository or a solution generated from it. Prefer existing patterns over introducing new abstractions, and keep changes focused on the requested behaviour. This guide is shared by the ca-sln template source and the solutions generated from it. The template supports: In the template source, files containing directives such as #if (UseApiOnly) are not dead code. Preserve the directive comments and consider every affected template variant when editing them. Keep dependencies pointing inward:
Trending
Quiet since September.about the whole repository
Who's talking about jasontaylordev/CleanArchitecture
- Nick Chapsas“How to structure a .NET Solution (project separation & architecture)”YouTube · Feb 1, 2021 · 303k views
- CodeOpinion“Clean Architecture Example & Breakdown - Do I use it?”YouTube · Jun 16, 2021 · 200k views
- Jono Williams“Coding the Backend Of A Web App In One Day!”YouTube · Sep 26, 2020 · 14k views
- Gui Ferreira“Moving from Controllers to .NET Minimal APIs”YouTube · Feb 7, 2023 · 7.1k views
- Tech With Pat“How I structure every ASP.NET Core project (Clean Architecture)”YouTube · Nov 24, 2024 · 3.1k views
The biggest 5 of 66 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 66
Talked about on GitHub, YouTube and Bluesky (66 times).
On GitHub · 44
- Jan 15, 2026 .NET 소프트웨어 아키텍처 완벽 가이드북 위 title명으로 study폴더 내 md파일을 적절한 이름으로 생성해서 아래 내용을 입력하고 pr해줘 — hundong2/csharp_study1 reaction · 1 comment
- Feb 24, 2022Enqueue Jobs that requires the Http Context with a Clean Architecture. — HangfireIO/Hangfire1 reaction · 12 comments
- Aug 20, 2026Adopt CQRS with MediatR + a FluentValidation pipeline behavior — Lazare-Panam/mars-api0 reactions
- Aug 20, 2026Migrate to Clean Architecture layering (Domain/Application/Infrastructure/API) — Lazare-Panam/mars-api0 reactions
- Aug 20, 2026Adopt CQRS with MediatR + a FluentValidation pipeline behavior — Lazare-Panam/hiflux-api0 reactions
39 more on GitHub
- Aug 20, 2026Migrate to Clean Architecture layering (Domain/Application/Infrastructure/API) — Lazare-Panam/hiflux-api0 reactions
- Jul 17, 2026Docs: Init ADR + template — Equindar/LunarEclipse0 reactions · 2 comments
- Mar 5, 2026📝 Task: Create Comprehensive README.md for Inventory Management Service — AdeptOne/omega0 reactions
- Sep 4, 2025Check trending repo: jasontaylordev/CleanArchitecture — uibm/trending-watcher0 reactions · 1 comment
- Sep 4, 2025Check trending repo: jasontaylordev/CleanArchitecture — uibm/trending-watcher0 reactions · 1 comment
- May 20, 2025Use clean architecture — komnav/DurakGameWebApi0 reactions
- Feb 2, 2025Add Seq client Integration into an app with NSwag breaks the app. — microsoft/aspire0 reactions · 4 comments
- Jan 20, 2025Use Clean Architecture project template — romanfabio/Void.Chef0 reactions
- Nov 15, 2024Create dotnet cli templates for quick scaffolding of vertical slice — crafters-cloud/crafters-cloud-reference-architecture0 reactions · 1 comment
- Oct 28, 2024Angular integration example with FastEndpoints — EelcoLos/nx-tinkering0 reactions
- Mar 26, 2024Initial a new project for the Rihal backend challenge — Sabermotamedi/RihalCodeStacker-Backend0 reactions
- Mar 25, 2024Tribbles — wallymathieu/redesigned-octo-tribble0 reactions
- Jan 17, 2024Layer's Dependency — pouyatirdad/SimpleShoppingCart_DDD0 reactions
- Jul 25, 2023Initiate projects — komdil/itrun-erp0 reactions
- Jul 3, 2023[Question] How to do migrations — neozhu/CleanArchitectureWithBlazorServer0 reactions · 7 comments
- Jun 25, 2023Simplify Mapping — neozhu/CleanArchitectureWithBlazorServer0 reactions
- May 30, 2023Create Solution and Projects using CleanArchitecture Template — Humteria/booking-hive-backend0 reactions
- Apr 22, 2023Authentication — platformplatform/PlatformPlatform0 reactions · 1 comment
- Apr 9, 2023Updated Wallet solution to use Clean Architecture — gorogdemi/wallet0 reactions
- Jan 23, 2023Feature/initial template setup — heinonenniilo/IrcMonitor0 reactions
- Oct 23, 2022feat!: rewrite to clean architecture — rockyprabowo/hacktiv8-golang-assignment-30 reactions
- Jul 8, 2022Testing stuffs — thangchung/coffeeshop-modularsays it tested it0 reactions · 1 comment
- May 17, 2022I added colors — Grauenwolf/CleanArchitecture0 reactions
- May 14, 2022How to use Custom Response Schema while working with Clean Architecture — proudmonkey/AutoWrapper0 reactions
- Apr 11, 2022Create structure for Unit Tests — JohanSaisa/GT0 reactions · 1 comment
- Dec 3, 2021break out into Core, Application, Infrastructure, and Web — deislabs/hippo0 reactions · 2 comments
- Oct 29, 2021add authorization pipeline — nollidnosnhoj/Tuna0 reactions
- Aug 16, 2021Structuring the application — Neosoft-Private-Limited/rest-dot-net-core0 reactions
- Jun 24, 2021Error handling — thangchung/clean-architecture-dotnet0 reactions
- Jun 6, 2021Unit test and integration tests — thangchung/clean-architecture-dotnet0 reactions
- May 16, 2021Application جایگاه — ZahraBayatgh/CQRSFundamentals0 reactions · 1 comment
- Feb 25, 2021Gestion de la pagination https://github.com/jasontaylordev/CleanArchitecture/blob/main/src/Application/Common/Models/PaginatedList.cs — Firefouks/APIStarter0 reactions
- Feb 25, 2021Gérer la pagination https://github.com/jasontaylordev/CleanArchitecture/blob/main/src/Application/Common/Models/PaginatedList.cs — Firefouks/Micro-Social-Network-Backend0 reactions
- Feb 5, 2021Pour mes middlewares j'aurais pu utiliser Le Behaviour de Mediator https://github.com/jasontaylordev/CleanArchitecture/blob/main/src/Application/Common/Behaviours/PerformanceBehaviour.cs — Firefouks/APIStarter0 reactions
- Feb 3, 2021CQRS : partir de ce repository https://github.com/jasontaylordev/CleanArchitecture — Firefouks/APIStarter0 reactions
- Feb 3, 2021CQRS : partir de ce repository https://github.com/jasontaylordev/CleanArchitecture/blob/main — Firefouks/Micro-Social-Network-Backend0 reactions
- Jan 24, 2021Tests fonctionnelles > corriger les problèmes d'injections de dépendances : utiliser ActivatorUtilities.CreateInstance(serviceProvider) ou m'inspirer de https://github.com/jasontaylordev/CleanArchitecture/blob/main/tests/Application.IntegrationTests/Testing.cs — Firefouks/Micro-Social-Network-Backendsays it tested it0 reactions
- Oct 11, 2020merge work from develop — MJeorrett/StageRaceFantasyBlazor0 reactions
- Sep 7, 2020refactor(dependencies) — MarcelMichau/fake-survey-generator0 reactions · 1 comment
On YouTube · 20
- Feb 1, 2021How to structure a .NET Solution (project separation & architecture) — Nick Chapsas303k views · 345 comments
- Jun 16, 2021Clean Architecture Example & Breakdown - Do I use it? — CodeOpinion200k views · 188 comments
- Sep 26, 2020Coding the Backend Of A Web App In One Day! — Jono Williams14k views · 18 comments
- Feb 7, 2023Moving from Controllers to .NET Minimal APIs — Gui Ferreira7.1k views · 18 comments
- Nov 24, 2024How I structure every ASP.NET Core project (Clean Architecture) — Tech With Pat3.1k views · 5 comments
15 more on YouTube
- Oct 4, 2022.NET References by MISTAKE? Try this — Gui Ferreira2.2k views · 9 comments
- Jul 1, 2022LIBERTANDO A CAMADA DE PERSISTÊNCIA COM ARQUITETURA LIMPA — Road to Agility1.4k views
- Sep 28, 2023Ostra uczy - Clean Architecture Template — Ostra Piła303 views · 1 comment
- Aug 14, 2023Clean Architecture, e per una volta non è il DB a comandare — Andrea Dottor265 views
- Mar 1, 2021Clean Architecture Solution Template — Andrea Dottor225 views
- Dec 25, 2021TT-Shots : Best Clean Architecture Template For .NET Core Applications — TechieRathore147 views · 1 comment
- Apr 27, 2024Convert your Controllers to Minimal APIs with Versioning, Swashbuckle and K6 — Seth Jacobs134 views
- Oct 29, 2024.NET 8 CleanArchitecture ของ Jasontaylordev — mooh.panaht120 views
- Jan 24, 2022Clean Architecture and Subcutaneous Testing with Matthew Jeorrett [Fixed audio] — Jamie Taylorsays it tested it112 views
- Mar 12, 2023jasontaylordev/CleanArchitecture - Gource visualisation — Gourcer75 views
- Sep 4, 2025GitHub - jasontaylordev/CleanArchitecture: Clean Architecture Solution Template for ASP.NET Core — GitHub Daily Trend AI Podcast73 views
- Sep 17, 2026One Rule. Zero Excuses. Clean Architecture in Blazor — SystemSketch50 views
- Sep 13, 202313:30 - Minimal API en .net, avec Aymeric Breton — Neos-SDI France45 views
- Jan 24, 2022[ENDING ONLY] Clean Architecure with Matthew Jeorrett — Jamie Taylor18 views
- Sep 11, 2025OrderPulse — Procesamiento en segundo plano + SignalR | .NET 8 + EF Core — RodrigoDev Portfolio16 views
On Bluesky · 2
- Nov 11, 2025Clean Architecture Solution Template is now updated to .NET 10 and Aspire 13 🚀 What features or improvements would you like to see next?… — @jasontaylor.dev1 likes and repost
- Sep 4, 2025📦 jasontaylordev / CleanArchitecture ⭐ 18,797 (+37) 🗒 Bicep Clean Architecture Solution Template for ASP.NET Core — @github-trending.bsky.social1 likes and repost
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,196 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
15 rules. About 1 is common, 6 are distinctive, and 8 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 3
Use this guide when changing either this template repository or a solution generated from it.
- Very specific: line 9
If .template.config exists, you are working in the template source.
- Very specific: line 10
If .template.config does not exist, you are working in one generated solution.
- Distinctive: line 22
Keep dependencies pointing inward:
- Very specific: line 32
Before changing an architectural boundary, read the accepted records in docs/decisions.
- Very specific: line 39
Use IApplicationDbContext directly in handlers when data access is required.
- Distinctive: line 40
Put business invariants that belong to entities or value objects in Domain.
- Very specific: line 43
Use the ca-usecase item template for new commands and queries when practical.
- Very specific: line 57
Keep template condition markers balanced and in their existing comment form.
- Very specific: line 63
Follow .editorconfig. C# uses four-space indentation, file-scoped namespaces, sorted System directives, and braces.
- Very specific: line 65
Keep public names in PascalCase, interfaces prefixed with I, parameters and locals in camelCase, and private instance fields in _camelCase.
- Distinctive: line 66
Prefer the established result, exception, mapping, validation, and endpoint patterns over new framework choices.
- Common: line 67
Never commit secrets, connection credentials, generated build artifacts, or untracked machine-specific configuration.
- Distinctive: line 71
Place tests according to the behaviour being changed:
- Distinctive: line 81
Run the smallest relevant test project while iterating, then validate the solution before handing off:
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clean Architecture Agent Guide
Use this guide when changing either this template repository or a solution generated from it. Prefer existing patterns over introducing new abstractions, and keep changes focused on the requested behaviour.
Solution context
This guide is shared by the ca-sln template source and the solutions generated from it.
- If
.template.configexists, you are working in the template source. Changes can affect multiple generated variants. - If
.template.configdoes not exist, you are working in one generated solution. Follow its selected target framework, client framework and database provider, and ignore template-maintenance steps.
The template supports:
- .NET 10 or .NET 11 (
--framework net10.0|net11.0) - Angular, React, or Web API only
- SQLite, PostgreSQL, or SQL Server
In the template source, files containing directives such as #if (UseApiOnly) are not dead code. Preserve the directive comments and consider every affected template variant when editing them.
Project boundaries
Keep dependencies pointing inward:
src/Domaincontains entities, value objects, enums, exceptions, and domain events. It must not depend on Application, Infrastructure, or Web. Its intentionalMediatR.Contractsdependency is documented in ADR-003.src/Applicationcontains use cases, validation, authorization metadata, behaviours, models, and interfaces owned by the application. It depends on Domain, never on Infrastructure or Web.src/Infrastructureimplements Application interfaces and contains EF Core persistence, identity, and external-service concerns. It may depend on Application and Shared.src/Webis the HTTP/UI boundary and composition root. Keep endpoints thin: translate HTTP input/output and dispatch Application requests throughISender.src/AppHostorchestrates the application with Aspire for local development and acceptance tests.src/ServiceDefaultscontains shared observability, health-check, service-discovery, and resilience defaults.src/Sharedcontains contracts needed across orchestration boundaries. Do not move domain or application business rules here.
Before changing an architectural boundary, read the accepted records in docs/decisions. Add a new ADR from ADR-000-template.md when making a significant new architectural decision, and update docs/decisions/README.md.
Application patterns
- Organize use cases by feature, then by command or query, following
src/Application/TodoListsandsrc/Application/TodoItems. - Represent requests as MediatR records and keep their handlers in the same feature folder.
- Commands change state; queries read and project state. Keep request-specific validators next to the request.
- Use
IApplicationDbContextdirectly in handlers when data access is required. Do not add a generic repository layer merely to hide EF Core; ADR-001 explicitly accepts EF Core abstractions in Application. - Put business invariants that belong to entities or value objects in Domain. Put use-case orchestration in Application, concrete I/O in Infrastructure, and transport concerns in Web.
- Implement Application-owned interfaces in Infrastructure and register implementations in the relevant
DependencyInjection.csfile. - Derive domain events from
BaseEvent; they are directly publishable through MediatR as described in ADR-003. Use the
ca-usecaseitem template for new commands and queries when practical. Fromsrc/Application, for example:dotnet new ca-usecase --name CreateTodoList --feature-name TodoLists --usecase-type command --return-type int
Template-specific changes
This section applies only when .template.config exists.
- The root template is configured in
.template.config/template.json; the use-case item template is undertemplates/ca-use-case. - Package versions that track the target framework live in
Directory.Packages.net10.0.propsandDirectory.Packages.net11.0.props; update both when changing them. - Template source contains all supported alternatives at once. Generated solutions contain only the selected target framework, client framework and database provider.
- In this repository, Angular lives in
src/Web/ClientAppand React insrc/Web/ClientApp-React; the React directory is renamed toClientAppin generated React solutions. - Keep template condition markers balanced and in their existing comment form. When adding, removing, or renaming variant-specific files, update the include, exclude, and rename rules in
.template.config/template.json. - Edit template source, not files under a temporary generated-output directory. Generated output is disposable validation data.
- For changes to template selection or conditional files, generate and validate every affected framework/client/database combination. The full CI matrix (18 combinations) is defined in
.github/workflows/test-templates.yml.
Coding conventions
- Follow
.editorconfig. C# uses four-space indentation, file-scoped namespaces, sortedSystemdirectives, and braces. - Nullable reference types and implicit usings are enabled. All build warnings are treated as errors.
- Keep public names in PascalCase, interfaces prefixed with
I, parameters and locals in camelCase, and private instance fields in_camelCase. - Prefer the established result, exception, mapping, validation, and endpoint patterns over new framework choices.
- Never commit secrets, connection credentials, generated build artifacts, or untracked machine-specific configuration.
Tests
Place tests according to the behaviour being changed:
tests/Domain.UnitTests: pure domain behaviour and value objectstests/Application.UnitTests: isolated Application behaviour, mappings, and pipeline behaviourstests/Application.FunctionalTests: use cases that exercise persistence and the application stacktests/Infrastructure.IntegrationTests: concrete infrastructure integrationstests/Web.AcceptanceTests: end-to-end UI behaviour through Aspire and Playwright
Functional tests use Aspire with a real database rather than mocked repositories. SQLite is the default; PostgreSQL and SQL Server variants require Docker, Podman, or another compatible container runtime.
Run the smallest relevant test project while iterating, then validate the solution before handing off:
dotnet restore
dotnet build --no-restore --configuration Release
dotnet test --no-build --configuration ReleaseFor frontend changes, use the package lock and run the relevant client build:
npm ci
npm run buildFor acceptance tests, build first and install the Playwright Chromium browser using the generated playwright.ps1 script, matching .github/workflows/build.yml.
Completion checklist
- The change respects the project dependency boundaries and accepted ADRs.
- New behaviour has tests at the appropriate level.
- Template directives and all affected variants remain valid.
- Formatting, build, and relevant tests pass without introducing warnings.
- Documentation and ADRs are updated when behaviour or architecture changes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

