agentleFS
jasontaylordevjasontaylordev/CleanArchitecture/AGENTS.md

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

Jan 2026: 1 mentionFeb 2026: 0 mentionsMar 2026: 1 mentionApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 1 mentionAug 2026: 4 mentionsSep 2026: 1 mentionOct 2026: 0 mentionsNov 2026: 0 mentionsDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the jasontaylordev/CleanArchitecture repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about jasontaylordev/CleanArchitecture

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

39 more on GitHub

On YouTube · 20

15 more on YouTube
  • 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
  1. Distinctive:

    Use this guide when changing either this template repository or a solution generated from it.

    line 3
  2. Very specific:

    If .template.config exists, you are working in the template source.

    line 9
  3. Very specific:

    If .template.config does not exist, you are working in one generated solution.

    line 10
  4. Distinctive:

    Keep dependencies pointing inward:

    line 22
  5. Very specific:

    Before changing an architectural boundary, read the accepted records in docs/decisions.

    line 32
  6. Very specific:

    Use IApplicationDbContext directly in handlers when data access is required.

    line 39
  7. Distinctive:

    Put business invariants that belong to entities or value objects in Domain.

    line 40
  8. Very specific:

    Use the ca-usecase item template for new commands and queries when practical.

    line 43
  9. Very specific:

    Keep template condition markers balanced and in their existing comment form.

    line 57
  10. Very specific:

    Follow .editorconfig. C# uses four-space indentation, file-scoped namespaces, sorted System directives, and braces.

    line 63
  11. Very specific:

    Keep public names in PascalCase, interfaces prefixed with I, parameters and locals in camelCase, and private instance fields in _camelCase.

    line 65
  12. Distinctive:

    Prefer the established result, exception, mapping, validation, and endpoint patterns over new framework choices.

    line 66
  13. Common:

    Never commit secrets, connection credentials, generated build artifacts, or untracked machine-specific configuration.

    line 67
  14. Distinctive:

    Place tests according to the behaviour being changed:

    line 71
  15. Distinctive:

    Run the smallest relevant test project while iterating, then validate the solution before handing off:

    line 81

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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.config exists, you are working in the template source. Changes can affect multiple generated variants.
  • If .template.config does 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/Domain contains entities, value objects, enums, exceptions, and domain events. It must not depend on Application, Infrastructure, or Web. Its intentional MediatR.Contracts dependency is documented in ADR-003.
  • src/Application contains use cases, validation, authorization metadata, behaviours, models, and interfaces owned by the application. It depends on Domain, never on Infrastructure or Web.
  • src/Infrastructure implements Application interfaces and contains EF Core persistence, identity, and external-service concerns. It may depend on Application and Shared.
  • src/Web is the HTTP/UI boundary and composition root. Keep endpoints thin: translate HTTP input/output and dispatch Application requests through ISender.
  • src/AppHost orchestrates the application with Aspire for local development and acceptance tests.
  • src/ServiceDefaults contains shared observability, health-check, service-discovery, and resilience defaults.
  • src/Shared contains 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/TodoLists and src/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 IApplicationDbContext directly 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.cs file.
  • Derive domain events from BaseEvent; they are directly publishable through MediatR as described in ADR-003.
  • Use the ca-usecase item template for new commands and queries when practical. From src/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 under templates/ca-use-case.
  • Package versions that track the target framework live in Directory.Packages.net10.0.props and Directory.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/ClientApp and React in src/Web/ClientApp-React; the React directory is renamed to ClientApp in 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, sorted System directives, 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 objects
  • tests/Application.UnitTests: isolated Application behaviour, mappings, and pipeline behaviours
  • tests/Application.FunctionalTests: use cases that exercise persistence and the application stack
  • tests/Infrastructure.IntegrationTests: concrete infrastructure integrations
  • tests/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 Release

For frontend changes, use the package lock and run the relevant client build:

npm ci
npm run build

For 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.