Generate FSD-compliant slice or segment boilerplate
/plugin marketplace add jhlee0409/claude-plugins/plugin install fsdarch@jhlee0409-plugins새 슬라이스 또는 세그먼트 보일러플레이트를 생성합니다. 프로젝트 패턴을 학습하여 일관된 스타일로 코드를 생성합니다.
/fsdarch:scaffold <layer> <slice-name> [segment]
.fsd-architect.json 설정 파일 존재| Argument | Description | Example |
|---|---|---|
layer | FSD 레이어 (entities, features, widgets, pages) | features |
slice-name | 슬라이스 이름 | auth |
segment | (선택) 특정 세그먼트만 생성 | ui, model, api |
--segments 플래그의 각 세그먼트에 대해 slice-generator의 validateSegmentName() 호출.., /, \ 금지.으로 시작 금지^[a-zA-Z][a-zA-Z0-9-_]*$ 준수 필수Use skill: layer-detector
설정 파일에서 패턴 로드:
동일 레이어의 기존 슬라이스 분석:
Use skill: slice-generator
Naming Convention 적용
Import Style 적용
Code Style 적용
═══════════════════════════════════════════════════════════════
SLICE CREATED: auth
═══════════════════════════════════════════════════════════════
📁 Created structure:
src/features/auth/
├── index.ts # Public API
├── ui/
│ ├── index.ts
│ ├── LoginForm.tsx
│ └── LoginForm.module.css
├── model/
│ ├── index.ts
│ ├── types.ts
│ └── useAuth.ts
├── api/
│ ├── index.ts
│ └── authApi.ts
└── lib/
└── index.ts
📝 Files created: 10
🎨 Pattern applied: kebab-case, barrel exports
💡 Next steps:
1. Implement your business logic in model/
2. Create UI components in ui/
3. Define API calls in api/
4. Export public interface through index.ts
═══════════════════════════════════════════════════════════════
| Flag | Description | Example |
|---|---|---|
--segments <list> | 생성할 세그먼트 지정 | --segments ui,model,api |
--minimal | 최소 구조만 생성 (index.ts만) | --minimal |
--no-ui | UI 세그먼트 제외 | --no-ui |
--force | 기존 파일 덮어쓰기 | --force |
--dry-run | 실제 생성 없이 미리보기 | --dry-run |
src/entities/<name>/
├── index.ts # Public API
├── model/
│ ├── index.ts
│ ├── types.ts # Entity types/interfaces
│ └── store.ts # State management (if detected)
├── api/
│ ├── index.ts
│ └── <name>Api.ts # API functions
├── ui/
│ ├── index.ts
│ └── <Name>Card.tsx # Common UI component
└── lib/
└── index.ts
src/features/<name>/
├── index.ts # Public API
├── model/
│ ├── index.ts
│ ├── types.ts
│ └── use<Name>.ts # Feature hook
├── api/
│ ├── index.ts
│ └── <name>Api.ts
├── ui/
│ ├── index.ts
│ └── <Name>Button.tsx
└── lib/
└── index.ts
src/widgets/<name>/
├── index.ts # Public API
├── ui/
│ ├── index.ts
│ └── <Name>Widget.tsx
└── model/
├── index.ts
└── use<Name>Widget.ts
src/pages/<name>/
├── index.ts # Public API
└── ui/
├── index.ts
└── <Name>Page.tsx
생성 시 다음 변수가 자동 치환됩니다:
| Variable | Example Input | kebab-case | PascalCase | camelCase |
|---|---|---|---|---|
<name> | user-profile | user-profile | UserProfile | userProfile |
<Name> | user-profile | - | UserProfile | - |
[E301] Slice already exists
'auth' already exists in features layer.
Use --force to overwrite (WARNING: destructive)
Or choose a different name.
[E302] Invalid layer for scaffolding
'app' layer is not sliced. Cannot create slices in app layer.
Available sliced layers: pages, widgets, features, entities
[E303] Invalid slice name
Slice name 'my slice' contains invalid characters.
Use kebab-case, camelCase, or PascalCase without spaces.
[E305] Segment Path Traversal Attempt Blocked
Segment name '../../etc' contains forbidden characters.
Security Policy:
- '..' sequences are blocked (directory traversal)
- '/' and '\' are blocked (path separators)
- Names starting with '.' are blocked (hidden files)
Valid segment names: ui, model, api, lib, config
Invalid segment names: ../malicious, ui/nested, .hidden
/fsdarch:scaffold features auth
> Analyzing existing feature patterns...
> Detected: kebab-case, TypeScript, React Query
> Creating slice: src/features/auth/
> Created 10 files
/fsdarch:scaffold entities user --segments model,api
> Creating minimal entity slice...
> Created: src/entities/user/
> - index.ts
> - model/index.ts, types.ts
> - api/index.ts, userApi.ts
/fsdarch:scaffold widgets header --dry-run
> DRY RUN - No files will be created
Would create:
src/widgets/header/
├── index.ts
├── ui/
│ ├── index.ts
│ └── HeaderWidget.tsx
└── model/
├── index.ts
└── useHeaderWidget.ts
/fsdarch:scaffold features auth api
> Adding segment to existing slice...
> Created: src/features/auth/api/
> - index.ts
> - authApi.ts
> Updated: src/features/auth/index.ts (added export)