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

create-feature-slice

/create-feature-slice

Tworzy nowy wycinek Feature-Sliced Design we frontendzie z publicznym indeksem, segmentami ui, model i api oraz regułami importów w dół, a testy zostają zielone.

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

Brak sygnałów. Repozytorium zmienione 07.11.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

Tworzy nowy wycinek Feature-Sliced Design we frontendzie z publicznym indeksem, segmentami ui, model i api oraz regułami importów w dół, a testy zostają zielone.

Wyzwalacze z opisu

add a featurecreate an FSD sliceadd an entity/widget/pagescaffold a frontend feature

Argumenty

/create-feature-slice [<layer>/<slice-name>]  e.g. features/sign-contract or entities/bike
Oryginalny opis (EN)

Scaffold a new Feature-Sliced Design slice under frontend/src honoring the layer rules — a public index.ts, purpose-named segments (ui/model/api), downward-only imports, the generated-import restriction, and the processes ban. Use when the user asks to "add a feature", "create an FSD slice", "add an entity/widget/page", or "scaffold a frontend feature". Leaves steiger, knip, and tsc green.

Jak działa

  1. The layers (import only downward)
  2. Hard rules (steiger enforces these; do not fight them)
  3. Instructions
Sekcje z nagłówków SKILL.md, w oryginale · 78 linii, 460 słów
Podgląd SKILL.md
---
name: create-feature-slice
argument-hint: "[<layer>/<slice-name>]  e.g. features/sign-contract or entities/bike"
description: Scaffold a new Feature-Sliced Design slice under frontend/src honoring the layer rules — a public index.ts, purpose-named segments (ui/model/api), downward-only imports, the generated-import restriction, and the processes ban. Use when the user asks to "add a feature", "create an FSD slice", "add an entity/widget/page", or "scaffold a frontend feature". Leaves steiger, knip, and tsc green.
allowed-tools: Read, Write, Edit, Bash, Glob
---

# Skill: create-feature-slice

Scaffold one Feature-Sliced Design slice under `frontend/src`. FSD layering here is as load-bearing as
the backend's hexagon and is CI-enforced by **steiger `--fail-on-warnings`**
([ADR-0003](../../../docs/adr/0003-feature-sliced-design-for-the-frontend.md)).

## The layers (import only downward)

`app/` → `pages/` → `widgets/` → `features/` → `entities/` → `shared/`

- **entities/** — a read model + its query hooks for one aggregate (`bike`, `leasing-application`,
  `user-task`).
- **features/** — one user intention (`submit-leasing-request`, `sign-contract`, `withdraw-application`).
- **widgets/** — compose features/entities into a page section.
- **pages/** — a routed screen. **app/** — routing, styles, providers.

## Hard rules (steiger enforces these; do not fight them)

- **No `processes/` layer — ever.** It collides with *BPMN processes*, the core domain word. `no-processes`
  is ON. Multi-step flows live in `widgets/` or `pages/`.
- **Every slice has a public `index.ts`.** Cross-slice imports go through it; never import into another
  slice's internals (`public-api`, `no-public-api-sidestep`).
- **Segments are purpose-named:** `ui/`, `model/`, `api/` (`segments-by-purpose`, `no-segmentless-slices`).
- **Generated code is imported only through a slice's own `api` segment.** Re-export from
  `@/shared/api/generated` behind the slice's `index.ts` — see the `bike` entity:
  ```ts
  // entities/bike/api/queries.ts
  export { useListBikes } from "@/shared/api/generated/endpoints";
  // entities/bike/index.ts
  export { useListBikes } from "./api/queries";
  export type { BikeDto } from "@/shared/api/generated/model";
  ```
- Imports flow **downward only** (`forbidden-imports`): a feature may import entities/shared, never a
  widget/page.
- Three steiger rules are intentionally OFF (`insignificant-slice`, `repetitive-naming`,
  `shared-lib-grouping`) — don't try to "satisfy" them; the reasons are in `steiger.config.ts`.

## Instructions

### Step 1 — Resolve layer + name

From `$ARGUMENTS` (`<layer>/<slice-name>`, kebab-case name). If missing, ask which layer and name.
Confirm the layer is appropriate (a user intention → `features/`; a read model → `entities/`; a page
section → `widgets/`; a route → `pages/`). Reject `processes/`.

### Step 2 — Create the segments

Under `frontend/src/<layer>/<slice-name>/` create the segments the slice needs:

- `ui/` — a component (`.tsx`), for a feature/widget/page.
- `api/` — query/mutation hooks, **re-exporting** from `@/shared/api/generated/endpoints` (never a raw
  generated import elsewhere).
- `model/` — schema/types/state (a feature form reuses a generated **zod** schema as its resolver — see
  `features/submit-leasing-request/model/submit-form-schema.ts`).

### Step 3 — Write the public `index.ts`

Re-export only the slice's public surface (components, hooks, types). Nothing else may reach into the
slice.

### Step 4 — Wire it in

Consume the new slice from the layer above through its `index.ts` (e.g. a widget imports the feature).
If it needs a backend call that doesn't exist yet, run
[`sync-api-client`](../sync-api-client/SKILL.md) first so the generated hook exists.

### Step 5 — Verify green

```bash
npm --prefix frontend run lint:fsd     # steiger --fail-on-warnings
npm --prefix frontend run lint:deadcode # knip: no unreferenced slice
npm --prefix frontend run typecheck
```

Fix any steiger/knip finding before finishing (a slice referenced nowhere trips knip). Report the files
created and confirm the three checks pass.

Wersje

W bazie nie ma innych skilli o nazwie create-feature-slice.

Migawka bazy z 13.11.2026 · wersja paczki 8963644fc384 (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

  • 100feature-slicing
    Organizuje kod frontendu według Feature-Sliced Design: wdrażanie FSD, umieszczanie kodu w istniejącym projekcie, poprawa importów między slice'ami i publicznych API.
  • 100nextjs-architecture
    Strukturyzuje projekty Next.js według Feature-Sliced Design: warstwy FSD, wycinki pogrupowane domenowo i ścisła hierarchia importów, z cienkim page.tsx.
  • 100figma-pencil-fsd-tailwind4
    Konwertuje projekty Figma lub Pencil na kod frontendowy w architekturze Feature-Sliced Design i Tailwind CSS v4: tokeny, mapowanie warstw FSD i granice Server oraz Client.
  • 100add-full-slice
    Buduje funkcję od początku do końca: pionowy wycinek backendu (kontrakty, handler, walidator, endpoint) oraz podpiętą do niego stronę React, łącząc add-feature i add-react-page.
  • 100hatch3r-feature
    Prowadzi implementację funkcji od początku do końca jako pionowy wycinek: model danych, logika domenowa, API i interfejs.
  • 90build-slice
    Buduje jeden pionowy wycinek zatwierdzonej funkcji według planu kodu, najpierw testy, potem weryfikacja i aktualizacja dokumentów.

Uwagi i zgłoszenia

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