
feature-sliced-design
Feature-Sliced Design (FSD、フロントエンドアーキテクチャ手法) リファレンスとルール。 別名 fsd / feature-sliced。layers (app / pages / widgets / features / entities / shared)、 依存方向、Public API、@x 記法 (cross-import)、slice groups (スライスグループ)、 segments (ui / model / api / lib / config)、steiger、Next.js、TanStack Query 連携。 コードレビュー・リファクタリング時に自動参照。
- Installs
- 135
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/fandhe-ai/agent-reference-skills --skill feature-sliced-design- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads feature-sliced-design automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Feature-Sliced Design ガイドライン
ディレクトリ構成
skills/feature-sliced-design/
SKILL.md
references/
README.md
import-rules.md
layers.md
public-api.md
slice-groups.md
slices-segments.md
samples/
README.md
project-structure.md
slice-public-api.md
layer-imports.md
cross-entity-import.md
slice-groups.md
composition-in-pages.md
nextjs-app-router.md
react-query-integration.md
scripts/
README.md
install.md
generate.md
lint.md
rules/
README.md
layer-dependency.md
public-api-enforcement.md
slice-isolation.md
segment-naming.md
探索手順
タスクからカテゴリを引き、カテゴリの README.md で目的のページを特定する:
- 下記マッピング表でタスクに対応するカテゴリを探す
- そのカテゴリの
README.mdを参照して目的のページを特定する - 該当ページの
.mdを Read して詳細を確認する
タスク → カテゴリ マッピング
| タスク | カテゴリ | 参照 README |
|---|---|---|
| レイヤー構成・責務を知りたい | references | references/README.md |
| インポートルール・依存方向を確認したい | references | references/README.md |
| Public API パターンを理解したい | references | references/README.md |
| スライス・セグメントの定義を知りたい | references | references/README.md |
| スライスグループ(関連スライスのまとめ方)を知りたい | references | references/README.md |
| 典型的な FSD プロジェクト構成の例を見たい | samples | samples/README.md |
| Next.js / React Query との組み合わせ例を見たい | samples | samples/README.md |
| @x 記法・クロスエンティティ依存の実例を見たい | samples | samples/README.md |
| pages での合成パターン(同一レイヤー間依存の回避)を知りたい | samples | samples/README.md |
| ツールチェーンのインストール・CLI コマンドを知りたい | scripts | scripts/README.md |
| steiger でアーキテクチャ準拠チェックを実行したい | scripts | scripts/README.md |
| @feature-sliced/cli でコード生成したい | scripts | scripts/README.md |
| レイヤー依存方向のルールを自動適用したい | rules | rules/README.md |
| Public API 経由のみ許可するルールを確認したい | rules | rules/README.md |
| スライス分離・セグメント命名規約を確認したい | rules | rules/README.md |
コア概念の詳細は references/<topic>.md、チェックルールは rules/<rule>.md を参照。
必須ルール
- コードは標準レイヤーに分割する:
app,pages,widgets,features,entities,shared(processesは deprecated)。全レイヤーは必須ではなく、最低限shared/pages/app。widgetsは公式が非推奨 - インポートは下位レイヤーへの一方向のみ許可。同一レイヤー内のスライス間インポートは禁止
- 各スライスは
index.tsで Public API を定義する。外部からは Public API 経由でのみインポートする export *は使用しない。公開するものを明示的に列挙する- セグメント名は「目的」で命名する(
ui,model,api)。「本質」で命名しない(components,hooks,types) appとsharedにスライスは持たない。セグメントのみで構成する
レイヤー構成(上位 → 下位)
app — ルーティング、プロバイダー、グローバル設定(スライスなし)
pages — 画面単位のスライス
widgets — 複数ページで再利用される大規模 UI ブロック(公式は非推奨)
features — ビジネス価値をもたらすユーザーインタラクション
entities — ビジネスエンティティ(User, Product 等)
shared — 汎用的な再利用可能コード(スライスなし)
標準セグメント
| セグメント | 内容 |
|---|---|
ui | UI コンポーネント、フォーマッタ、スタイル |
api | バックエンド連携、リクエスト関数、レスポンス型 |
model | データスキーマ、ストア、ビジネスロジック |
lib | スライスローカルのユーティリティ |
config | 設定定数、フィーチャーフラグ |
ディレクトリ構造例
src/
├── app/
│ ├── routes/
│ ├── store/
│ └── styles/
├── pages/
│ └── feed/
│ ├── ui/
│ ├── api/
│ └── index.ts
├── widgets/
│ └── header/
│ ├── ui/
│ └── index.ts
├── features/
│ └── search-articles/
│ ├── ui/
│ ├── model/
│ └── index.ts
├── entities/
│ └── user/
│ ├── ui/
│ ├── model/
│ ├── api/
│ └── index.ts
└── shared/
├── ui/
├── api/
├── lib/
└── config/
よくある間違い
- セグメント名に
components/,hooks/,types/を使う →ui/,model/,lib/を使用する export *でまとめてエクスポートする → 明示的にexport { Name } fromで列挙する- 同一レイヤーのスライスを直接インポートする → 上位レイヤーで合成するか、
@x記法を使用する(@xはentitiesレイヤー限定) - 再利用されないコードを
featuresやwidgetsに早期移動する → まずpagesに置き、複数ページで再利用されるアクションになったらfeaturesへ昇格する sharedにビジネスロジックを置く → ビジネスロジックはentities以上に配置する- 独自レイヤーを追加する → 標準レイヤーのみ使用する
- Public API なしでスライスを作成する → 必ず
index.tsを先に定義する - 型定義を
types/フォルダにまとめる → ドメインごとにmodel/セグメント内に配置する
FAQ
What does the feature-sliced-design skill do?
Feature-Sliced Design (FSD、フロントエンドアーキテクチャ手法) リファレンスとルール。 別名 fsd / feature-sliced。layers (app / pages / widgets / features / entities / shared)、 依存方向、Public API、@x 記法 (cross-import)、slice groups (スライスグループ)、 segments (ui / model / api / lib / config)、steiger、Next.js、TanStack Query 連携。 コードレビュー・リファクタリング時に自動参照。
How do I install feature-sliced-design?
Run npx skills add https://github.com/fandhe-ai/agent-reference-skills --skill feature-sliced-design in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/feature-sliced-design/ (personal) or .claude/skills/feature-sliced-design/ (project).
Which AI agents can use feature-sliced-design?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is feature-sliced-design safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains feature-sliced-design?
It is published by fandhe-ai in fandhe-ai/agent-reference-skills. It has 135 recorded installs.
More from fandhe-ai/agent-reference-skills
github-docs
fandhe-ai/agent-reference-skills
GitHub 公式ドキュメント (docs.github.com)。REST API, GraphQL, Webhooks, GitHub Apps, OAuth Apps, gh CLI, PAT / GITHUBTOKEN, Actions (jobs, steps, expressions, workflow commands, concurrency, OIDC, artifact attestations, lockfile), pull requests, issues, Projects v2, immutable releases, Codespaces, Packages, Copilot API / cloud agent, code scanning, secret scanning, Dependabot, Dependency graph / SBOM, Teams, Billing, activity (events / notifications)。
commitlint
fandhe-ai/agent-reference-skills
commitlint (Conventional Commits メッセージ検証ツール) リファレンス。 rules 設定、plugins、shareable-config、@commitlint/config-conventional、 Husky / lefthook / simple-git-hooks 連携、CI 統合、custom rules。
lefthook
fandhe-ai/agent-reference-skills
Lefthook (高速並列 Git hooks マネージャー) リファレンス。 lefthook.yml 設定、pre-commit / pre-push / commit-msg 等のフック、 parallel / piped 実行、glob / run / tags フィルタ、stagedfiles、 lefthook の ai 設定 (beta)、JSON schema、Composer / npm / pip 等インストール、 保護ブランチ、CI スキップ、Husky からの移行。
editorconfig
fandhe-ai/agent-reference-skills
EditorConfig (エディタ設定統一フォーマット) リファレンス。 .editorconfig ファイル、glob パターン、root、 indentstyle / indentsize / tabwidth、endofline, charset、 trimtrailingwhitespace, insertfinalnewline, maxlinelength, spellinglanguage。
rust
fandhe-ai/agent-reference-skills
Rust 言語リファレンス。 別名: rustlang, rs (拡張子)、Rust-lang。 TRPL (The Rust Programming Language)、Rust by Example、Reference、 Cargo Book、rustc Book、rustdoc Book、Rustonomicon (Unsafe Rust)、 Edition Guide、Standard Library、Error Index。 所有権、ライフタイム、トレイト、async / await、エラーハンドリング、マクロ。
anthropic-claude-code
fandhe-ai/agent-reference-skills
Claude Code (code.claude.com) の CLI 本体リファレンス。 CLAUDE.md memory, settings.json (All settings, settings precedence, managed-settings.json), env-vars, model config, keybindings, statusline, terminal config, cli-reference (-p / --continue / --resume), sessions, checkpointing, worktrees, remote control, channels, deep links, troubleshooting。
Popular frontend & design skills
setup-matt-pocock-skills
mattpocock/skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
frontend-design
anthropics/skills
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
hyperframes-animation
heygen-com/hyperframes
All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.
prototype
mattpocock/skills
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
hyperframes-core
heygen-com/hyperframes
The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.
vercel-react-best-practices
vercel-labs/agent-skills
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.