Skip to content
cccskills
FreePublished on GitHub

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 連携。

コードレビュー・リファクタリング時に自動参照。

The English summary is being prepared. Showing the original description.

See how to install

Files included (25)

  • SKILL.md7.0 KB
  • references/import-rules.md3.4 KB
  • references/layers.md4.9 KB
  • references/public-api.md3.2 KB
  • references/README.md898 B
  • references/slice-groups.md2.8 KB
  • references/slices-segments.md3.6 KB
  • rules/layer-dependency.md2.3 KB
  • rules/public-api-enforcement.md3.2 KB
  • rules/README.md613 B
  • rules/segment-naming.md2.0 KB
  • rules/slice-isolation.md1.7 KB
  • samples/composition-in-pages.md2.7 KB
  • samples/cross-entity-import.md1.6 KB
  • samples/layer-imports.md1.9 KB
  • samples/nextjs-app-router.md4.3 KB
  • samples/project-structure.md2.5 KB
  • samples/react-query-integration.md3.4 KB
  • samples/README.md1.7 KB
  • samples/slice-groups.md2.3 KB
  • samples/slice-public-api.md1.4 KB
  • scripts/generate.md1.7 KB
  • scripts/install.md769 B
  • scripts/lint.md4.1 KB
  • scripts/README.md529 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

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 で目的のページを特定する:

  1. 下記マッピング表でタスクに対応するカテゴリを探す
  2. そのカテゴリの README.md を参照して目的のページを特定する
  3. 該当ページの .md を Read して詳細を確認する

タスク → カテゴリ マッピング

タスクカテゴリ参照 README
レイヤー構成・責務を知りたいreferencesreferences/README.md
インポートルール・依存方向を確認したいreferencesreferences/README.md
Public API パターンを理解したいreferencesreferences/README.md
スライス・セグメントの定義を知りたいreferencesreferences/README.md
スライスグループ(関連スライスのまとめ方)を知りたいreferencesreferences/README.md
典型的な FSD プロジェクト構成の例を見たいsamplessamples/README.md
Next.js / React Query との組み合わせ例を見たいsamplessamples/README.md
@x 記法・クロスエンティティ依存の実例を見たいsamplessamples/README.md
pages での合成パターン(同一レイヤー間依存の回避)を知りたいsamplessamples/README.md
ツールチェーンのインストール・CLI コマンドを知りたいscriptsscripts/README.md
steiger でアーキテクチャ準拠チェックを実行したいscriptsscripts/README.md
@feature-sliced/cli でコード生成したいscriptsscripts/README.md
レイヤー依存方向のルールを自動適用したいrulesrules/README.md
Public API 経由のみ許可するルールを確認したいrulesrules/README.md
スライス分離・セグメント命名規約を確認したいrulesrules/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     — 汎用的な再利用可能コード(スライスなし)

標準セグメント

セグメント内容
uiUI コンポーネント、フォーマッタ、スタイル
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/

よくある間違い

  1. セグメント名に components/, hooks/, types/ を使う → ui/, model/, lib/ を使用する
  2. export * でまとめてエクスポートする → 明示的に export { Name } from で列挙する
  3. 同一レイヤーのスライスを直接インポートする → 上位レイヤーで合成するか、@x 記法を使用する(@x は entities レイヤー限定)
  4. 再利用されないコードを features や widgets に早期移動する → まず pages に置き、複数ページで再利用されるアクションになったら features へ昇格する
  5. shared にビジネスロジックを置く → ビジネスロジックは entities 以上に配置する
  6. 独自レイヤーを追加する → 標準レイヤーのみ使用する
  7. Public API なしでスライスを作成する → 必ず index.ts を先に定義する
  8. 型定義を types/ フォルダにまとめる → ドメインごとに model/ セグメント内に配置する

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

AMD ROCm / HIP GPU コンピューティングリファレンス。 hipMalloc, hipLaunchKernelGGL, HIP Graph, hipGreenCtx, HIPRTC, hipify, rocBLAS, MIOpen, RCCL, hipThreads, libhipcxx, rocprofv3, amd-smi, rocminfo, TheRock / Core SDK 10, CDNA1-4 / RDNA1-4, MI300 / MI350 / MI350P, gfx942, Matrix Core, wave32/64。

The English summary is being prepared. Showing the original description.

Fandhe-AI/agent-reference-skills4Updated Oct 20, 2026

Android アプリ開発 (Kotlin) の推奨アーキテクチャリファレンス。 Jetpack, androidx, UI layer, Domain layer, Data layer, state holder, UDF, SSOT, オフラインファースト, モジュール化, ViewModel, viewModelScope, SavedStateHandle, Lifecycle, repeatOnLifecycle, collectAsStateWithLifecycle, LiveData, Hilt による DI, Paging 3 によるページング処理。

The English summary is being prepared. Showing the original description.

Fandhe-AI/agent-reference-skills4Updated Oct 20, 2026

Android アプリ開発 (Kotlin) のバックグラウンド・非同期処理リファレンス。 Jetpack androidx WorkManager: Worker, CoroutineWorker, WorkRequest, Constraints, WorkInfo, WorkContinuation, expedited work, テスト。 Service: フォアグラウンドサービス, バウンドサービス, AIDL, Messenger。 AlarmManager, PendingIntent, BroadcastReceiver, JobScheduler, Doze。 Kotlin コルーチン, Flow, StateFlow, SharedFlow, Channel。

The English summary is being prepared. Showing the original description.

Fandhe-AI/agent-reference-skills4Updated Oct 20, 2026

Android アプリ開発 (Kotlin) の Gradle ビルドシステムリファレンス。 Android Gradle Plugin (AGP), Kotlin DSL (build.gradle.kts), version catalog, KSP, R8/ProGuard, App Bundle, baseline profile。

The English summary is being prepared. Showing the original description.

Fandhe-AI/agent-reference-skills4Updated Oct 20, 2026

Android Jetpack Compose (Kotlin) の androidx Material3 コンポーネントリファレンス。 Button, IconButton, FloatingActionButton, Checkbox, Switch, Slider, TextField, SearchBar, DropdownMenu, Chip, DatePicker, TimePicker, Card, Scaffold, Dialog, BottomSheet, TopAppBar, NavigationBar, NavigationRail, Tab, Snackbar, ProgressIndicator, Badge, Icon, MaterialTheme, ColorScheme, Typography, Shapes。

The English summary is being prepared. Showing the original description.

Fandhe-AI/agent-reference-skills4Updated Oct 20, 2026

Android Jetpack Compose (Kotlin) のアニメーション・描画リファレンス。 androidx.compose.animation / graphics API。 AnimatedVisibility, AnimatedContent, animate*AsState, Animatable, AnimationSpec, Canvas, DrawScope, Brush, Path, Color, Image。

The English summary is being prepared. Showing the original description.

Fandhe-AI/agent-reference-skills4Updated Oct 20, 2026

See all skills by Fandhe-AI

Report a problem with this skill