Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

vertical-slice-architecture

БесплатноБез исполняемых скриптовНе проверен

Scaffold and navigate a .NET Clean Architecture codebase organised as Vertical Slice Architecture (VSA) — the Hona/VerticalSliceArchitecture layout of Domain…

thangchungот thangchung★ 27 звёзд на GitHub

Об этом скилле

Vertical Slice Architecture (Clean Architecture, sliced)

This skill encodes the structure of the Hona/VerticalSliceArchitecture template so you can scaffold components correctly the first time and reason about an unfamiliar repo quickly.

The single most valuable thing here is the wiring map: in this architecture most additions touch more than one file, and the extra files are not discoverable by reading the file you edit. Skipping them produces code that compiles and fails at runtime. Read references/wiring.md before finishing any scaffolding task.

Why this layout exists

Classic Clean Architecture cuts the codebase horizontally — one project per ring, and an interface at every ring boundary (IGameRepository, IDateTimeProvider, …). The cost is that a single feature is smeared across four projects, and most of those interfaces have exactly one implementation forever.

VSA keeps Clean Architecture's dependency rule (dependencies point inward, Domain at the centre, and nothing in Domain knows about the web or the database) and deletes the project-per-ring plus interface-per-boundary ceremony. One use case is one file. Coupling is cut per feature instead of per layer.

Practical consequence: AppDbContext is injected straight into an endpoint. That is deliberate, not a mistake — do not "fix" it by introducing a repository interface unless the user asks.

Clean Architecture ring → VSA location

Clean Architecture ring Lives in May depend on
Entities / domain model Domain/ nothing (only BCL + Vogen/Guard attributes)
Use cases / application logic body of HandleAsync in the slice file Domain, Common
Interface adapters (controller, presenter, DTOs) same slice file: Configure(), Request, plus Features/{Plural}/Common/{Entity}Response.cs Domain, Common
Infrastructure / frameworks Common/EfCore/, Program.cs Domain

Because the use case and its adapter sit in the same file, a slice is read top-to-bottom: DTO, validator, route, logic. That is the property that makes this layout fast to navigate.

Dependency model

graph RL
    Host["Host — Program.cs"]
    Games["Features/Games — slice group"]
    Players["Features/Players — slice group"]
    Common["Common/ — EfCore, cross-cutting"]
    Domain["Domain/ — entities, value objects"]

    Host --> Games
    Host --> Players
    Host --> Common
    Games --> Common
    Players --> Common
    Games --> Domain
    Players --> Domain
    Common --> Domain
    Games -.->|"forbidden"| Players

    linkStyle 8 stroke:#c0392b,stroke-width:2px

Five invariants the architecture tests enforce. Treat them as hard constraints while scaffolding:

  1. Domain depends on nothing. No EF Core, no ASP.NET, no Common, no Features.
  2. Common depends only on Domain. It never reaches into Features.
  3. Slice groups never depend on each other. If Features/Games needs something from Features/Players, that something belongs in Domain or Common — move it, do not import across groups. This is the invariant most often broken by accident.
  4. Use cases are internal sealed, CQRS-named (*Command for writes, *Query for reads), and each has a sibling Request and, unless it returns Created/NoContent, a Response.
  5. Every entity's ID is a Vogen value object, never a bare Guid/int.

Directory map

src/{App}/
├── Program.cs                     host: DI, FastEndpoints, Swagger, migrations
│                                  also holds [assembly: VogenDefaults(...)]
│                                  ends with `public partial class Program;` (tests need it)
├── GlobalUsings.cs                why slice files have almost no `using` lines
├── Domain/                        dependency-free core
│   ├── {Entity}.cs                entity: private EF ctor + public ctor + behaviour methods
│   ├── {Entity}Id.cs              [ValueObject<Guid>] strong ID
│   ├── {Concept}.cs               value objects, enums
│   └── {Rule}Exception.cs         domain exceptions
├── Common/                        infrastructure + cross-cutting, one level above Domain
│   └── EfCore/
│       ├── AppDbContext.cs        DbSet per aggregate root; applies configs by assembly scan
│       ├── EfCoreConverters.cs    [EfCoreConverter<T>] per Vogen ID — easy to forget
│       ├── DependencyInjectionExtensions.cs
│       ├── Configuration/{Entity}Configuration.cs
│       └── Migrations/
└── Features/                      one folder per slice group (plural noun)
    └── {Plural}/
        ├── {Verb}{Entity}Command.cs   one write use case, whole file
        ├── {Verb}{Entity}Query.cs     one read use case, whole file
        └── Common/                    shared *within this group only*
            └── {Entity}Response.cs    response DTO + [Mapper] Mapperly class

tests/
├── {App}.Unit.Tests/Domain/         entity behaviour, no host, no DB
├──
Полный SKILL.md на GitHub

Установить vertical-slice-architecture в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/templates.mdreferences/wiring.md

FAQ

Что делает скилл vertical-slice-architecture?

Scaffold and navigate a .NET Clean Architecture codebase organised as Vertical Slice Architecture (VSA) — the Hona/VerticalSliceArchitecture layout of Domain / Common / Features slices with FastEndpoints, EF Core, Vogen strong IDs, Mapperly, FluentValidation, and Testcontainers. Use this skill whenever the user mentions vertical slice architecture, VSA, clean architecture, CQRS commands and queries, feature folders, feature slices, "add an endpoint / use case / command / query", FastEndpoints, Vogen value objects, strong-typed IDs, Mapperly mappers, architecture tests, or asks where a piece of code belongs in a layered .NET API — even if they never say "vertical slice". Also use it before adding any new entity, value object, DbContext configuration, or API operation to such a repo, because each of those has non-obvious wiring in other files that is easy to miss.

Как установить скилл vertical-slice-architecture?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл vertical-slice-architecture запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить vertical-slice-architecture с