Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

vertical-slice-architecture

/vertical-slice-architecture

Wymusza architekturę Vertical Slice w aplikacjach: kod organizowany według funkcji, a nie według warstw technicznych.

Repozytorium
skills ↗
Licencja
MIT
Ostatnia zmiana repozytorium
16.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
4
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

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

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wymusza architekturę Vertical Slice w aplikacjach: kod organizowany według funkcji, a nie według warstw technicznych.

Wyzwalacze z opisu

vertical slice architectureVSAorganize by featurefeature-based architectureslice architecture
Oryginalny opis (EN)

Enforce Vertical Slice Architecture (VSA) when building applications in any language (Go, .NET/C#, Java, Kotlin, TypeScript, Python, etc.) and any type (web API, mobile backend, CLI, event-driven). Organize code by feature/use-case instead of technical layers. Each feature is a self-contained vertical slice with a single entry point that receives the router/framework handle and its dependencies. Use when the user says "vertical slice architecture", "VSA", "organize by feature", "feature-based architecture", "slice architecture", or when building a new app or feature and the project already fol

Jak działa

  1. Quick Reference: The 5 Rules
  2. Project Structure
  3. Workflow: Adding a New Feature
  4. Workflow: Adding Cross-Cutting Concerns
  5. Workflow: Extracting Shared Logic
  6. Key Decisions by Language
  7. Single Entry Point Contract
  8. Testing
Sekcje z nagłówków SKILL.md, w oryginale · 78 linii, 562 słów
Podgląd SKILL.md
---
name: vertical-slice-architecture
version: 1.0.3
description: Enforce Vertical Slice Architecture (VSA) when building applications in any language (Go, .NET/C#, Java, Kotlin, TypeScript, Python, etc.) and any type (web API, mobile backend, CLI, event-driven). Organize code by feature/use-case instead of technical layers. Each feature is a self-contained vertical slice with a single entry point that receives the router/framework handle and its dependencies. Use when the user says "vertical slice architecture", "VSA", "organize by feature", "feature-based architecture", "slice architecture", or when building a new app or feature and the project already follows VSA conventions. Also use when reviewing or refactoring code to align with VSA principles.
---

# Vertical Slice Architecture

## Quick Reference: The 5 Rules

1. **One feature = one directory** containing handler, request/response types, validation, and tests
2. **One entry point per feature** — a setup/registration function that receives the router and dependencies. Name varies by convention (`Setup`, `RegisterRoute`, `Map`); the role is the invariant, not the name.
3. **Minimize coupling between slices, maximize coupling within a slice**
4. **No premature abstractions** — no shared repository/service layers until genuine duplication emerges across multiple slices
5. **Test each feature primarily through its entry point**, verifying outcomes (DB state, API calls, response). Platform/adapter tests are also encouraged.

## Project Structure

```
{project}/
  features/              # or internal/features/ (Go), Features/ (.NET)
    {domain}/            # orders/, users/, kvs/
      {operation}/       # create/, list/, delete/
        handler          # Single entry point + orchestration
        request/response # DTOs
        validator        # Input validation (optional)
        test             # Co-located integration test
        internal/        # Feature-private helpers (optional)
  platform/              # or Infrastructure/ — shared cross-cutting concerns
    middleware/           # Auth, error handling, idempotency
    database/            # Connection pooling, circuit breakers
    observability/       # Metrics, tracing, structured logging
    opqueue/             # Operation queues, outbox patterns (if needed)
  main                   # Composition root wires features + infrastructure
```

## Workflow: Adding a New Feature

1. Create directory: `features/{domain}/{operation}/`
2. Define the handler with a single exported setup function
3. Define request/response types (inline for simple cases)
4. Add validation logic
5. Register in the composition root (`main`)
6. Write integration test that calls the setup function, sends request, verifies outcomes

## Workflow: Adding Cross-Cutting Concerns

Place in `platform/` (not inside a feature). Examples:
- Auth middleware, error handling, request logging
- Database connection pooling, circuit breakers
- Idempotency middleware, operation queues, event notifications
- Observability (metrics, tracing, structured logging)

## Workflow: Extracting Shared Logic

Only extract when genuine duplication emerges across multiple slices (use judgment — the "3+ slices" heuristic is guidance, not a hard rule):
- Duplicate business rule: extract to a domain entity/value object
- Duplicate data access pattern: extract to a shared repository (only for that specific pattern)
- Duplicate HTTP helper: extract to `platform/httpx/`

## Key Decisions by Language

Detect the project's language/framework and consult the appropriate reference:
- **Patterns per language**: See [references/patterns-by-language.md](references/patterns-by-language.md) for Go, .NET, Java, TypeScript, Python
- **Testing per language**: See [references/testing.md](references/testing.md) for testcontainers, mock verification, integration test patterns
- **Core principles**: See [references/principles.md](references/principles.md) for detailed rules, anti-patterns, and shared domain model guidance

## Single Entry Point Contract

Every feature exposes one primary setup/registration function. Internal types stay private. The entry point name is conventional — the invariant is: **one public function per feature that wires the slice to the framework**.

- **Go** — convention `Setup` or `RegisterRoute`; signature `func Setup(r gin.IRoutes, repo Repository)`; DI via explicit params.
- **.NET** — convention `Map` (static); signature `static void Map(IEndpointRouteBuilder app)`; DI container resolves deps in handler.
- **Java/Kotlin** — `@RestController` class discovered by component scan; Spring DI (constructor injection).
- **TypeScript** — convention `setup`; signature `function setup(router: Router, db: Database): void`; DI via explicit params.
- **Python** — convention `setup`; signature `def setup(router: APIRouter, db: Database) -> None`; DI via explicit params or `Depends()`.

**Exceptions**: Versioned APIs may have `SetupV1`/`SetupV2` wrappers sharing internal handler wiring. Frameworks with auto-discovery (Spring, NestJS) use the controller/module class itself as the entry point.

## Testing

See [references/testing.md](references/testing.md) for full testing strategy per language, including feature integration tests, platform/adapter tests, mock verification patterns, and test naming conventions.
Pliki w paczce (4)
  • SKILL.md 5 KB
  • references/patterns-by-language.md 11 KB
  • references/principles.md 6 KB
  • references/testing.md 12 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · mryll/skills100MIT
thangchung/agent-engineering-experiment100MIT

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

Pobrania w ostatnich 30 dniach: 1 · ranking

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

Podobne skille

  • 100clean-architecture-scaffolder
    Tworzy szkielet rozwiązania .NET w Clean Architecture lub Vertical Slice: warstwy Domain, Application, Infrastructure i API, CQRS z MediatR oraz dodawanie nowych funkcji, przypadków użycia i wycinków.
  • 90build-slice
    Buduje jeden pionowy wycinek zatwierdzonej funkcji według planu kodu, najpierw testy, potem weryfikacja i aktualizacja dokumentów.
  • 100architecture-advisor
    Doradza w wyborze architektury aplikacji .NET: pyta o złożoność domeny, wielkość zespołu, czas życia i integracje, po czym poleca Vertical Slice, Clean Architecture, DDD lub modularny monolit.
  • 95vertical-slices
    Organizuje kod według funkcji i pakietów w monorepo, wskazując, gdzie ma trafić nowy plik.
  • 90vertical-slice
    Dzieli dużą funkcję na cienkie, samodzielnie wdrażalne plasterki od końca do końca, za flagą, zamiast budować warstwami.
  • 100authoring-vertical-slice
    Prowadzi przez wdrożenie jednej funkcji od końca do końca w monorepo Next 16, Expo 57 i Supabase: migracja, RLS, odczyt z ./client, procedura tRPC, ekran web i mobile oraz test.

Uwagi i zgłoszenia

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