Przejdź do treści
Biblioteka skilli
Programowanie · Planowanie

clean-architecture-dotnet

/clean-architecture-dotnet

Pomaga układać i rozbudowywać rozwiązanie .NET i ASP.NET Core: do którego projektu należy klasa, który projekt może odwoływać się do którego i jak endpoint dociera do przypadku użycia.

Repozytorium
skraft-plugin ↗
Licencja
GPL-3.0
Ostatnia zmiana repozytorium
11.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
23
Skrypty
13
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 11.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

GPL-3.0, otwarta.

Co sprawdzić przed instalacją
  • 13 skryptów w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: scripts/init-project.mjs, templates/Api/IApiMarker.cs, templates/Application/IApplicationMarker.cs, templates/Application/Shared/ICommandBus.cs, templates/Application/Shared/ICommandHandler.cs, templates/Application/Shared/IQueryBus.cs, templates/Application/Shared/IQueryHandler.cs, templates/Domain/IDomainMarker.cs

Co robi i kiedy

Pomaga układać i rozbudowywać rozwiązanie .NET i ASP.NET Core: do którego projektu należy klasa, który projekt może odwoływać się do którego i jak endpoint dociera do przypadku użycia.

Oryginalny opis (EN)

Use when laying out or extending a .NET / ASP.NET Core solution — which project a class belongs in, which project may reference which, and how an endpoint reaches a use case.

Jak działa

  1. One project per layer
  2. Use cases
  3. Domain
  4. Guard
  5. References
Sekcje z nagłówków SKILL.md, w oryginale · 47 linii, 531 słów
Podgląd SKILL.md
---
name: clean-architecture-dotnet
description: Use when laying out or extending a .NET / ASP.NET Core solution — which project a class belongs in, which project may reference which, and how an endpoint reaches a use case.
---

# Clean Architecture — .NET / ASP.NET Core

The layer rules are those of `architecture-patterns`. This skill maps them onto .NET projects.

## One project per layer

| Project | Holds | Only `<ProjectReference>` to |
|---|---|---|
| `<Context>.Domain` | aggregates, value objects, domain events | nothing |
| `<Context>.Application` | use cases and the interfaces they call | `<Context>.Domain` |
| `<Context>.Infrastructure` | implementations of those interfaces, DI registration (`AddInfrastructure()`) | `<Context>.Application` |
| `<Context>.Api` | endpoints, `Program.cs` | `<Context>.Infrastructure` |

- Inside each project, one folder per feature (`Application/Loans/BorrowBookUseCase.cs`, `Infrastructure/Loans/SqlLoanRepository.cs`), never a technical one (`Persistence`, `Repositories`, `Services`). The `DbContext` and `DependencyInjection.cs` stay at the project root. A feature uses no other feature's Application namespace; what two features use moves to a `Shared` folder.
- Use types reached transitively; never add a `<ProjectReference>` to reach them.
- EF Core, ASP.NET Core and `HttpClient` appear only in Infrastructure and Api. Domain uses nothing beyond the BCL.
- Tests live in the test projects `clean-architecture-testing` defines, never in a layer project.
- `node "<skill>/scripts/init-project.mjs" <Context>`, run from the repository root, creates this layout (`<skill>` is this skill's folder).

## Use cases

- A use case is a `sealed` class in Application named `*UseCase`, never `*Service`. The endpoint injects it directly.
- A command method returns `Task`; the caller creates the new id and passes it in. A query returns a `*ViewModel` record built in Application (never a `*Dto`, never a domain object), or comes from a read-service interface in Application that Infrastructure implements.
- Application declares an interface only where it calls out (repository, read service, gateway, `ICurrentUser`). A repository interface sits in Domain when it persists an aggregate, in Application otherwise.
- Who may *read* a resource is checked in the use case. Who may *change* it is an aggregate rule: the mutation method takes the caller's id and throws.
- A use case orchestrates. Every other `if`/`throw` that protects state belongs in a Domain method.
- No `ICommandBus` / `IQueryBus` unless all three hold: a pipeline every command or query needs (validation, logging), more than three use cases, and read and write models that differ. With a bus, endpoints go through it and never inject a handler.
- A domain event is raised by the aggregate and dispatched by the use case after the save, never from Domain or a repository.

## Domain

- An aggregate is a `sealed` class created through a static factory over a `private` constructor, and identified by a typed id record (`OrderId`), never a raw `Guid`.
- Data with no rule to protect stays a plain record: no aggregate base class, no domain events.

## Guard

The project graph and a framework-free core are enforced by NetArchTest: `templates/IntegrationTests/ArchitectureTests.cs` and `references/netarchtest-rules.md`, placed as `clean-architecture-testing` says.

## References

- `references/patterns.md`: code for a plain use case, CQRS with DDD and domain events, plus the red flags and common mistakes.
- `references/interface-placement.md`: repository, read-service, authorization and `ICurrentUser` placement, with read-policy and cancel-invariant examples.
- `references/ddd.md`: aggregates, factories, value objects, domain events.
- `references/cqrs-patterns.md` and `references/convention-based-di.md`: the bus, handlers and DI registration, once a bus is justified.
- `references/layer-responsibilities.md`, `references/architecture-layers.md`, `references/project-structure.md`: full rules per layer and the folder layout.
Pliki w paczce (23)
  • SKILL.md 4 KB
  • references/architecture-layers.md 2 KB
  • references/convention-based-di.md 10 KB
  • references/cqrs-patterns.md 3 KB
  • references/ddd.md 10 KB
  • references/interface-placement.md 9 KB
  • references/layer-responsibilities.md 14 KB
  • references/netarchtest-rules.md 10 KB
  • references/patterns.md 16 KB
  • references/project-structure.md 2 KB
  • scripts/init-project.mjs 6 KB
  • templates/Api/IApiMarker.cs 1 KB
  • templates/Application/IApplicationMarker.cs 1 KB
  • templates/Application/Shared/ICommandBus.cs 1 KB
  • templates/Application/Shared/ICommandHandler.cs 1 KB
  • templates/Application/Shared/IQueryBus.cs 1 KB
  • templates/Application/Shared/IQueryHandler.cs 1 KB
  • templates/Domain/IDomainMarker.cs 1 KB
  • templates/Infrastructure/DependencyInjection.cs 2 KB
  • templates/Infrastructure/IInfrastructureMarker.cs 1 KB
  • templates/Infrastructure/CQRS/CommandBus.cs 1 KB
  • templates/Infrastructure/CQRS/QueryBus.cs 1 KB
  • templates/IntegrationTests/ArchitectureTests.cs 4 KB

Wersje

W bazie nie ma innych skilli o nazwie clean-architecture-dotnet.

Migawka bazy z 13.11.2026 · wersja paczki 152f5f15f672 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100clean-architecture-java
    Pomaga układać i rozbudowywać usługę Java i Spring Boot z Mavenem: do którego modułu należy klasa, który moduł może zależeć od którego i jak endpoint dociera do przypadku użycia.
  • 100clean-architecture-react
    Pomaga układać i rozbudowywać front-end w React i TypeScript: do którego folderu należy ekran, komponent, hook, przypadek użycia lub wywołanie API, kto może importować od kogo i jak komponent dociera do API.
  • 90dotnet
    Pomaga w pracy z .NET: C#, MSBuild, ASP.NET Core, EF Core, MAUI, NuGet, testami i narzędziami SDK.
  • 100dotnet-core-expert
    Pomaga budować aplikacje .NET Core o architekturze cloud-native, wydajne mikroserwisy, nowoczesne wzorce C# i wdrożenia wieloplatformowe z minimal APIs i funkcjami ASP.NET Core.
  • 90dotnet-backend-patterns
    Dostarcza wzorce .NET i ASP.NET Core dla REST API, Entity Framework, wstrzykiwania zależności i middleware, przy pracy z plikami C# i projektami csproj.
  • 100csharp-dotnet-development
    Pomaga budować, przeglądać, modernizować i debugować aplikacje C# i .NET, w tym ASP.NET Core, EF Core, usługi w tle, współbieżność, .NET MAUI, testy, pakowanie i integrację AI.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.