feature-sliced-design

aiko-atami/fsd · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/aiko-atami/fsd --skill feature-sliced-design
0 commentsdiscussion
summary

An architectural methodology skill for scaffolding and organizing frontend applications using Feature-Sliced Design principles.

skill.md

Feature-Sliced Design (FSD) Skill - v2.1.0

An architectural methodology skill for scaffolding and organizing frontend applications using Feature-Sliced Design principles.

Overview

Feature-Sliced Design v2.1 is a compilation of rules and conventions for organizing frontend code to make projects more understandable, maintainable, and stable in the face of changing business requirements.

Version 2.1 introduces the "Pages First" approach - keeping more code in pages and widgets rather than prematurely extracting it to features and entities.

Core Principles

The "Pages First" Approach (FSD v2.1)

The fundamental principle of FSD v2.1: Keep code where it's used until you need to reuse it.

Instead of immediately extracting everything into entities and features, start by keeping code in pages and widgets. Only move code to lower layers when you actually need to reuse it.

What stays in Pages and Widgets:

Large UI blocks that are only used on one page ✅ Forms and their validation logic specific to a page ✅ Data fetching and state management for page-specific data ✅ Business logic that serves only this page/widget ✅ API interactions needed only here

When to extract to lower layers:

  • To Shared: When you need the same infrastructure in multiple places (modal manager, date formatter, UI components)
  • To Entities: When you have a clear business domain model that's used across multiple features
  • To Features: When you have a complete user interaction that's reused in multiple places

Why "Pages First"?

  1. Better code cohesion - related code stays together
  2. Easier to delete - unused code is right there with its usage
  3. Less abstraction overhead - no need to identify entities/features prematurely
  4. Natural decomposition - pages are intuitive to understand
  5. Faster development - no time wasted on premature optimization

1. Layered Architecture (Vertical Organization)

FSD uses 6 active standardized layers organized by responsibility and dependencies. Layers are ordered from most specific (top) to most generic (bottom):

app/           ← Application initialization, providers, global styles
pages/         ← Full page compositions with their own logic, routing
widgets/       ← Large composite UI blocks with their own logic
features/      ← Reusable user interactions and business features
entities/      ← Reusable business entities (user, product, order)
shared/        ← Reusable infrastructure code (UI kit, utils, API)

Note: Historically, FSD included processes/ as a 7th layer, but it is deprecated in v2.1. If you're using it, move the code to features/ with help from app/ if needed.

Import Rule: A module can only import from layers strictly below it.

  • features/entities/, shared/
  • pages/widgets/, features/, entities/, shared/
  • entities/features/ (upward import)
  • features/comments/features/posts/ (same-layer cross-import)

2. Slices (Horizontal Organization)

Slices group code by business domain meaning. Each slice represents a specific business concept:

features/
  ├── auth/           ← Authentication feature
  ├── comments/       ← Comments functionality
  └── post-editor/    ← Post editing feature

entities/
  ├── user/           ← User business entity
  ├── product/        ← Product business entity
  └── order/          ← Order business entity

Key Rules:

  • Slices must be independent from other slices on the same layer (zero coupling)
  • Slices should contain most code related to their primary goal (high cohesion)
  • Slice names are not standardized - they reflect your business domain

3. Segments (Technical Organization)

Segments group code within slices by technical purpose:

features/
  └── auth/
      ├── ui/         ← React components, styles, formatters
      ├── api/        ← API requests, data types, mappers
      ├── model/      ← State management, business logic, stores
      ├── lib/        ← Internal utilities for this slice
      ├── config/     ← Configuration, feature flags
      └── index.ts    ← Public API (exports only what other slices need)

Standard Segments:

  • ui - UI components, styles, date formatters
  • api - Backend interactions, request functions, data types
  • model - Data models, state stores, business logic
  • lib - Utility functions needed by this slice
  • config - Configuration files, feature flags

4. Public API

Every slice must define a public API through an index file:

// features/auth/index.ts
export { LoginForm } from './ui/LoginForm';
export { useAuth } from './model/useAuth';
export { loginUser } from './api/loginUser';
// Internal files not exported remain private to the slice

Rule: Modules outside a slice can only import from the public API, not from internal files.

Public API for Cross-Imports (@x notation)

New in v2.1: You can now create explicit connections between slices on the same layer (typically entities) using the @x notation.

This allows entities to reference each other when there's a legitimate business relationship:

// entities/user/index.ts
export { UserCard } from './ui/UserCard';
export { userModel } from './model';

// entities/user/@x/order.ts
// Cross-import API specifically for the order entity
export { UserOrderHistory } from './ui/UserOrderHistory';
export { getUserOrders } from './api/getUserOrders';

// entities/order/index.ts
import { UserOrderHistory } from '@/entities/user/@x/order';
// Now order can import from user's cross-import API

When to use cross-imports:

  • There's a clear business relationship between entities (e.g., User and Order)
  • The dependency is bidirectional or circular in the business domain
  • You want to keep the code together while acknowledging the relationship

Important: Regular cross-imports between slices (without @x) are still not allowed. Use @x notation to make cross-dependencies explicit and controlled.

Layer Definitions & Examples

App Layer

Application-wide settings, providers, routing setup.

app/
  ├── providers/      ← Redux Provider, React Query, Theme Provider
  ├── styles/         ← Global CSS, resets, theme variables
  ├── index.tsx       ← Application entry point
  └── router.tsx      ← Route configuration

Pages Layer

Route-level compositions with their own logic and data management.

pages/
  ├── home/
  │   ├── ui/
  │   │   ├── HomePage.tsx
  │   │   ├── HeroSection.tsx      ← Large UI blocks
  │   │   └── FeaturesGrid.tsx
  │   ├── model/
  │   │   └── useHomeData.ts       ← Page-specific state
  │   ├── api/
  │   │   └── fetchHomeData.ts     ← Page-specific API
  │   └── index.ts
  ├── profile/
  │   ├── ui/
  │   │   ├── ProfilePage.tsx
  │   │   ├── ProfileForm.tsx      ← Forms specific to this page
  │   │   └── ProfileStats.tsx
  │   ├── model/
  │   │   ├── profileStore.ts      ← State for profile page
  │   │   └── validation.ts        ← Form validation
  │   ├── api/
  │   │   ├── updateProfile.ts
  │   │   └── fetchProfile.ts
  │   └── index.ts
  └── settings/

v2.1 Approach: Pages can now contain:

  • ✅ Large UI blocks used only on this page
  • ✅ Forms and their validation logic
  • ✅ Data fetching and state management
  • ✅ Business logic that serves only this page
  • ✅ API interactions specific to this page

Only extract to lower layers when you need to reuse the code elsewhere.

Widgets Layer

Complex, composite UI blocks with their own logic, used across multiple pages.

widgets/
  ├── header/
  │   ├── ui/
  │   │   ├── Header.tsx
  │   │   ├── Navigation.tsx
  │   │   └── UserMenu.tsx
  │   ├── model/
  │   │   └── headerStore.ts       ← Widget state
  │   ├── api/
  │   │   └── fetchNotifications.ts ← Widget-specific API
  │   └── index.ts
  ├── sidebar/
  │   ├── ui/
  │   ├── model/
  │   │   └── sidebarState.ts
  │   └── index.ts
  └── footer/

v2.1 Approach: Widgets are no longer just compositional blocks. They can contain:

  • ✅ UI components of the widget
  • ✅ Widget-specific state management
  • ✅ Business logic that serves the widget
  • ✅ API interactions the widget needs
  • ✅ Internal utilities

Only extract code to entities/features when other widgets or pages need it.

Features Layer

Reusable user interactions and complete business features used in multiple places.

features/
  ├── auth/
  │   ├── ui/
  │   │   ├── LoginForm.tsx
  │   │   └── RegisterForm.tsx
  │   ├── model/
  │   │   └── useAuth.ts
  │   ├── api/
  │   │   ├── login.ts
  │   │   └── register.ts
  │   └── index.ts
  ├── add-to-cart/
  ├── like-post/
  └── comment-create/

v2.1 Approach: Only create a feature when:

  • ✅ The user interaction is used on multiple pages/widgets
  • ✅ It's a complete, self-contained user action
  • ✅ It has clear business value

Don't create features prematurely. If a user interaction is only used in one place, keep it in the page or widget until you actually need to reuse it.

Entities Layer

Reusable business entities - the core domain models used across the application.

entities/
  ├── user/
  │   ├── ui/
  │   │   ├── UserCard.tsx
  │   │   └── UserAvatar.tsx
  │   ├── model/
  │   │   ├── types.ts
  │   │   └── userStore.ts
  │   ├── api/
  │   │   └── userApi.ts
  │   ├── @x/
  │   │   └── order.ts             ← Cross-import API for order
  │   └── index.ts
  ├── product/
  └── order/

v2.1 Approach: Only create an entity when:

  • ✅ It represents a clear business domain concept
  • ✅ It's used in multiple features, pages, or widgets
  • ✅ It has well-defined boundaries and responsibilities

Don't prematurely extract entities. If a data structure is only used in one place, keep it there until you need to share it.

Shared Layer

Reusable infrastructure code with no business logic.

shared/
  ├── ui/             ← UI kit components
  │   ├── Button/
  │   ├── Input/
  │   └── Modal/
  ├── lib/            ← Utilities
  │   ├── formatDate/
  │   ├── debounce/
  │   └── classnames/
  ├── api/            ← API client setup, base config
  │   ├── client.ts
  │   └── apiRoutes.ts        ← Route constants (v2.1: allowed!)
  ├── config/         ← Environment variables, constants
  │   ├── env.ts
  │   └── appConfig.ts
  ├── assets/         ← Images, fonts, icons
  │   ├── logo.svg            ← Company logo (v2.1: allowed!)
  │   └── icons/
  └── types/          ← Common TypeScript types

v2.1 Update: Shared can now contain application-aware code:

  • ✅ Route constants and path builders
  • ✅ API endpoint definitions
  • ✅ Company branding assets (logos, colors)
  • ✅ Application configuration
  • ✅ Common type definitions

Still not allowed:

  • ❌ Business logic (calculations, workflows, domain rules)
  • ❌ Feature-specific code
  • ❌ Entity-specific code

No slices in Shared - organized by segments only. Segments can import from each other within Shared.

Common Patterns

1. Working with API (Pages First Approach)

Start simple - keep API logic in the page until you need to reuse it:

// pages/profile/api/fetchProfile.ts
export const fetchProfile = (id: string) => 
  apiClient.get(`/users/${id}`);

// pages/profile/model/useProfile.ts
export const useProfile = (id: string) => {
  const [user, setUser] = useState(null);
  
  useEffect(() => {
    fetchProfile(id).then(setUser);
  }, [id]);
  
  return user;
};

// pages/profile/ui/ProfilePage.tsx
import { useProfile } from '../model/useProfile';

const
how to use feature-sliced-design

How to use feature-sliced-design on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add feature-sliced-design
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/aiko-atami/fsd --skill feature-sliced-design

The skills CLI fetches feature-sliced-design from GitHub repository aiko-atami/fsd and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/feature-sliced-design

Reload or restart Cursor to activate feature-sliced-design. Access the skill through slash commands (e.g., /feature-sliced-design) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.574 reviews
  • Aditi Chen· Dec 28, 2024

    feature-sliced-design has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Carlos Shah· Dec 28, 2024

    feature-sliced-design fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Carlos Johnson· Dec 24, 2024

    Solid pick for teams standardizing on skills: feature-sliced-design is focused, and the summary matches what you get after install.

  • Ganesh Mohane· Dec 20, 2024

    feature-sliced-design fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Ama Martin· Dec 20, 2024

    Useful defaults in feature-sliced-design — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Hana Iyer· Dec 16, 2024

    feature-sliced-design is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Maya Mensah· Nov 19, 2024

    Useful defaults in feature-sliced-design — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Carlos Dixit· Nov 15, 2024

    I recommend feature-sliced-design for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Mia Thomas· Nov 11, 2024

    feature-sliced-design has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Henry Okafor· Nov 11, 2024

    feature-sliced-design fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

showing 1-10 of 74

1 / 8