# Apply Feature Sliced Design

> Use when a medium-to-large frontend (React, Vue, Angular, Svelte) needs a formal, team-wide architecture standard — features keep importing each other, nobody a

- Skill: `jeffreytse/apply-feature-sliced-design` (Agent Skill)
- Install (CLI): `npx get-skill add jeffreytse/apply-feature-sliced-design`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jeffreytse/apply-feature-sliced-design/raw
- Safety review: pending
- Works with: any agent that reads SKILL.md (Claude Code, Claude.ai, Cursor, Codex, Windsurf, 60+ more)
- Category: Coding & Dev Tools
- Author: jeffreytse (https://skillmd.com/u/jeffreytse)
- Updated: 2026-12-03
- Page: https://skillmd.com/skills/jeffreytse/apply-feature-sliced-design

---

---
name: apply-feature-sliced-design
description: Use when a medium-to-large frontend (React, Vue, Angular, Svelte) needs a formal, team-wide architecture standard — features keep importing each other, nobody agrees where code belongs, or onboarding is slow — and simple feature folders are no longer enough.
source: 'Feature-Sliced Design, "Feature-Sliced Design Methodology" documentation, feature-sliced.design (v2); Feature-Sliced Design, Steiger linter; Martin, "Clean Architecture" (dependency rule), 2017; Parnas, "On the Criteria To Be Used in Decomposing Systems into Modules", CACM 15(12), 1972'
tags: [project-structure, feature-sliced-design, frontend, layered-architecture, team-scaling, conventions]
related: [design-frontend-project-structure, apply-module-boundary-enforcement, apply-package-by-feature, design-component]
---

# Apply Feature-Sliced Design

Organize frontend code into standardized **layers** (app, pages, widgets, features, entities, shared), split by business **slices**, with technical **segments** inside each slice. Modules may import only from layers *below* them and only through each slice's public API.

## Why This Is Best Practice

**Adopted by:**
- An open methodology with official docs and tooling (the Steiger linter, plus ESLint configs).
- Used by product teams across the Russian- and English-speaking frontend communities.
- Framework-agnostic, with official guides for React, Next.js, Vue/Nuxt, and others.

**Impact:**
- A shared vocabulary and placement rules mean "where does this go?" has one answer, which reduces review debates and speeds onboarding.
- The strict downward-only import rule rules out circular dependencies between business areas by design, and the linter can verify it automatically.

**Why best:**
- Ad-hoc feature folders work until features need to share business entities, and then they import each other freely.
- FSD separates reusable business *entities* (user, product) from user *features* (add-to-cart, login) and composite *widgets*. This gives each a home and a direction of dependency.

Sources: Feature-Sliced Design documentation (feature-sliced.design). Steiger (github.com/feature-sliced/steiger). Martin, R.C. (2017), *Clean Architecture*. Parnas (1972).

## Steps

1. **Learn the layers, from top to bottom.** Each may import only from layers below it:

   | Layer | Holds | Example |
   |-------|-------|---------|
   | `app` | Providers, router, global styles, entry | `app/providers`, `app/router` |
   | `pages` | Full pages or route screens | `pages/product-details` |
   | `widgets` | Large self-contained UI blocks composing features and entities | `widgets/header`, `widgets/product-list` |
   | `features` | User interactions that bring business value | `features/add-to-cart`, `features/auth-by-email` |
   | `entities` | Business entities and their UI/model | `entities/user`, `entities/product` |
   | `shared` | Generic, business-agnostic code | `shared/ui`, `shared/api`, `shared/lib`, `shared/config` |

   (The older `processes` layer is deprecated. Not every project needs every layer.)

2. **Split layers into slices by business domain** (all layers except `app` and `shared`): `entities/product`, `features/add-to-cart`. Slices on the same layer **must not import each other**.

3. **Split slices into segments by technical purpose:**
   ```
   features/add-to-cart/
     ui/        # AddToCartButton.tsx
     model/     # store, hooks, business logic
     api/       # requests
     lib/       # slice-local helpers
     config/
     index.ts   # public API: the only import entry for other slices
   ```
   Name segments by *purpose*, not by type (avoid `components/`, `hooks/`, `types/` as segments).

4. **Expose a public API per slice.** Other code imports `@/features/add-to-cart`, never `@/features/add-to-cart/ui/AddToCartButton`.

5. **Place code with the decision rules:**
   - Reused business object with its own data and visuals? → `entities`.
   - A user action with business value (verb)? → `features`.
   - Composes several features and entities into a block? → `widgets`.
   - No business knowledge? → `shared`.
   - Used in one place only? Keep it in that slice. Don't pre-emptively lift it.

6. **Handle cross-entity references** (an order referencing a user) by composing at a higher layer, or use the official `@x` cross-import notation for unavoidable entity-to-entity links.

7. **Enforce with tooling.** Run Steiger (the official FSD linter) or eslint-plugin-boundaries in CI to check layer direction, public-API imports, and same-layer isolation (see `apply-module-boundary-enforcement`).

8. **Adopt incrementally.** Start with `app`, `pages`, and `shared`, then extract `entities` and `features` as you touch code. Migrating everything at once isn't necessary.

## Rules

- Import only from layers below, never from the same layer's other slices or from above.
- Import other slices only through their public API (`index.ts`).
- Segments are named by purpose (`ui`, `model`, `api`, `lib`, `config`).
- `shared` contains no business logic.
- Don't create layers or slices you don't need yet.

## Common Mistakes

- **Everything becomes a feature.** Entities, pages, and widgets are dumped into `features/`. Use the decision rules.
- **Over-slicing small apps.** Six layers for ten components is overhead. Use simple feature folders (`design-frontend-project-structure`).
- **Deep imports bypassing public APIs.** These defeat the isolation guarantees.
- **Type-named segments** (`components/`, `hooks/`) inside slices. They lose the purpose-based meaning.

## Examples

**E-commerce product page:**
- `pages/product` composes `widgets/product-gallery` and `widgets/related-products`.
- `features/add-to-cart` uses `entities/product` (its model and types) and `entities/cart`.
- `shared/ui/Button` and `shared/api/client` are used everywhere.
- Steiger runs in CI.

**Next.js integration:** keep Next's `app/` (or `pages/`) router folder for routing only, re-exporting FSD `pages` layer components from `src/pages` (per the official Next.js guide).

## When NOT to Use

- **Small apps, landing pages, and prototypes**, where a flat or simple feature-folder structure is faster.
- **Teams unwilling to learn the vocabulary.** A half-adopted FSD is worse than consistent simple feature folders.

