| ํญ๋ชฉ | ๋ด์ฉ |
|---|---|
| Invoke | /feature:create |
| Aliases | /feature, /feature:new |
| Category | petmedi-workflow |
| Complexity | complex |
| MCP Servers | serena, sequential, context7, magic |
/feature:create#
Context Framework Note: This behavioral instruction activates when Claude Code users type
/feature:createpatterns.
Triggers#
- When creating a new Feature from start to finish
- When implementing Serverpod backend and Flutter frontend simultaneously
- When a complete Clean Architecture workflow is needed
Context Trigger Pattern#
/feature:create {feature_name} {entity_name} [--options]
Parameters#
| Parameter | Required | Description | Example |
|---|---|---|---|
feature_name |
โ | Feature module name (snake_case) | community, chat, wallet |
entity_name |
โ | Entity name (PascalCase) | Post, Message, Transaction |
--location |
โ | Location |
application
,
common
,
console
(default:
application
)
|
--caching |
โ | Caching strategy | swr, cache-first, none (default: swr) |
--endpoint-type |
โ | Endpoint type | app, console, both (default: app) |
--fields |
โ | Field Definition | "title:String, content:String" |
--with-bdd |
โ | BDD Test Generation | true, false (default: true) |
--bdd-from |
โ | BDD Scenario source | claudedocs/{feature}/bdd/ |
Execution Flow#
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase 1: Requirements gathering (Interactive) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 1. Feature/Entity ์ด๋ฆ ํ์ธ โ
โ 2. ํ๋ ์ ์ ์์ง โ
โ 3. CRUD ๋ฉ์๋ ๋ฒ์ ํ์ธ โ
โ 4. ์บ์ฑ ์ ๋ต ์ ํ โ
โ 5. BDD ํ
์คํธ ํฌํจ ์ฌ๋ถ ํ์ธ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase 2: Backend implementation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 1: /serverpod:model โ
โ Step 2: /serverpod:endpoint โ
โ Step 3: melos run backend:pod:generate โ
โ Step 4: ๋ง์ด๊ทธ๋ ์ด์
(ํ์ ์) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase 3: Frontend implementation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 5: /feature:domain โ
โ Step 6: /feature:data โ
โ Step 7: /feature:presentation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase 4: BDD ํ
์คํธ ์์ฑ (--with-bdd true ์) โญ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 8: /bdd:generate {feature_name} โ
โ Step 9: melos run test:bdd:generate --scope={feature} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Phase 5: Integration and verification โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Step 10: DI ๋ฑ๋ก ํ์ธ โ
โ Step 11: Route ๋ฑ๋ก ํ์ธ โ
โ Step 12: melos run build โ
โ Step 13: melos run analyze โ
โ Step 14: melos run test --scope={feature} โ
โ Step 15: melos run test:bdd --scope={feature} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Phase 1: Requirements Gathering#
Interactive Mode#
## Feature Creation Requirements
### default ์ ๋ณด
- **Feature name**: {feature_name}
- **Entity name**: {entity_name}
- **Location**: application / common / console
### Entity Fields
| Field Name | Type | Required | Description |
|--------|------|------|------|
| title | String | โ
| Title |
| content | String | โ
| Content |
| category | Enum | โ
| Category |
### CRUD Methods
- [x] List query (pagination)
- [x] Single item query
- [x] Create
- [x] Update
- [x] Delete
### Caching Strategy
- [x] SWR (Stale-While-Revalidate)
- [ ] Cache-First
- [ ] None
Phase 2: Backend Implementation#
Step 1: Serverpod Model#
# Run /serverpod:model command
/serverpod:model {feature_name} {entity_name}
--fields " {fields} "
--has-crud true
Generated Files:
backend/.../model/entities/{entity_name}.spy.yamlbackend/.../model/dto/...backend/.../model/enum/...
Step 2: Serverpod Endpoint#
# Run /serverpod:endpoint command
/serverpod:endpoint {feature_name} {entity_name}
--type {endpoint_type}
Generated Files:
backend/.../endpoint/{feature_name}_endpoint.dartbackend/.../service/{feature_name}_service.dart
Step 3: Code Generation#
melos run backend:pod:generate
Step 4: Migration#
melos run backend:pod:create-migration
melos run backend:pod:run-migration
Phase 3: Frontend Implementation#
Step 5: Domain Layer#
# Run /feature:domain command
/feature:domain {feature_name} {entity_name}
--location {location}
Generated Files:
- Entity, Repository Interface, UseCase
- UseCase Test
Step 6: Data Layer#
# Run /feature:data command
/feature:data {feature_name} {entity_name}
--location {location}
--caching {caching}
Generated Files:
- Repository Implementation์ฒด, Serverpod Mixin
- Cache Strategy, Local DB (Drift)
Step 7: Presentation Layer#
# Run /feature:presentation command
/feature:presentation {feature_name} {entity_name}
--location {location}
Generated Files:
- BLoC (Event, State), BLoC Test
- Page, Widget, Widget Test
- Route, Widgetbook UseCase
Phase 4: BDD Test Generation#
--with-bdd true (default) executed:
Step 8: BDD Scenario and Step Generation#
# Run /bdd:generate command
/bdd:generate {feature_name}
--entity-name {entity_name}
--location {location}
--from-claudedocs true # claudedocs์ BDD ํ์ผ์ด ์๋ ๊ฒฝ์ฐ
Generated Files:
feature/{location}/{feature_name}/
โโโ build.yaml # BDD ๋น๋ ์ค์
โโโ test/src/bdd/
โโโ {feature}_list.feature
โโโ {feature}_detail.feature
โโโ {feature}_form.feature
โโโ step/
โ โโโ common_steps.dart # ๊ณต์ฉ ์คํ
import
โ โโโ {feature}_steps.dart # Feature ์ ์ฉ ์คํ
โโโ hooks/
โโโ hooks.dart # Setup/Teardown
Step 9: Generate BDD test code#
# Run bdd_widget_test builder
melos run test:bdd:generate --scope={feature_name}
Generation result: Auto-generated test code from .feature files
Phase 5: Integration and Verification#
Step 10: Dependency Wiring Verification#
Items to verify: No di/ folder, no getIt usage, direct BlocProvider creation
// ํ์ด์ง์์ BLoC ์ง์ ์์ฑ
BlocProvider(create: (_) => {Feature}Bloc())
Step 9: Route Registration Verification#
File to verify: app/petmedi/lib/src/route/app_router.dart
Step 10-12: Build and test#
melos run build
melos run analyze
melos run test --scope={feature_name}
TodoWrite Template#
TodoWrite([
// Backend
{"content": "Generate Serverpod model", "status": "pending", "activeForm": "Generate Serverpod model in progress"},
{"content": "Generate Serverpod endpoint", "status": "pending", "activeForm": "Generate Serverpod endpoint in progress"},
{"content": "backend:pod:generate ์คํ", "status": "pending", "activeForm": "backend:pod:generate running"},
// Frontend - Domain
{"content": "Generate Domain Entity", "status": "pending", "activeForm": "Generate Domain Entity in progress"},
{"content": "Generate Repository Interface", "status": "pending", "activeForm": "Generate Repository Interface in progress"},
{"content": "Generate UseCase", "status": "pending", "activeForm": "Generate UseCase in progress"},
{"content": "Generate UseCase tests", "status": "pending", "activeForm": "Generate UseCase tests in progress"},
// Frontend - Data
{"content": "Generate Repository implementation", "status": "pending", "activeForm": "Generate Repository implementation in progress"},
{"content": "Generate Serverpod Mixin", "status": "pending", "activeForm": "Generate Serverpod Mixin in progress"},
// Frontend - Presentation
{"content": "Generate BLoC", "status": "pending", "activeForm": "Generate BLoC in progress"},
{"content": "Generate BLoC tests", "status": "pending", "activeForm": "Generate BLoC tests in progress"},
{"content": "Generate Page/Widget", "status": "pending", "activeForm": "Generate Page/Widget in progress"},
{"content": "Generate Widget tests", "status": "pending", "activeForm": "Generate Widget tests in progress"},
{"content": "Define Routes", "status": "pending", "activeForm": "Define Routes in progress"},
{"content": "Generate Widgetbook UseCase", "status": "pending", "activeForm": "Generate Widgetbook UseCase in progress"},
// BDD ํ
์คํธ (--with-bdd true ์)
{"content": "Generate BDD .feature files", "status": "pending", "activeForm": "Generate BDD .feature files in progress"},
{"content": "Generate BDD Step definitions", "status": "pending", "activeForm": "Generate BDD Step definitions in progress"},
{"content": "Configure BDD Hooks", "status": "pending", "activeForm": "Configure BDD Hooks in progress"},
{"content": "Generate BDD test code", "status": "pending", "activeForm": "Generate BDD test code in progress"},
// Integration
{"content": "Code generation and analysis", "status": "pending", "activeForm": "Code generation and analysis in progress"},
{"content": "Run unit tests", "status": "pending", "activeForm": "Run unit tests in progress"},
{"content": "Run BDD tests", "status": "pending", "activeForm": "Run BDD tests in progress"},
])
MCP Integration#
| Phase | MCP Server | Purpose |
|---|---|---|
| Requirements analysis | Sequential | Complex analysis and planning |
| Backend | Serena, Context7 | Pattern analysis, Serverpod Document |
| Domain | Serena, Context7 | UseCase Pattern, Clean Architecture |
| Data | Serena, Context7 | Mixin Pattern, Drift Document |
| Presentation | Magic, Serena | UI generation, BLoC Pattern |
| Verification | Serena | Symbol search, reference verification |
Reference Agents#
Reference ~/.claude/commands/agents/feature-orchestrator-agent.md for detailed implementation rules
Examples#
Create Community Post Feature#
/feature:create community Post
--location application
--caching swr
--endpoint-type app
--fields " title:String, content:String, category:PostCategory, imageUrls:List < String > ? "
Create Chat Message Feature#
/feature:create chat Message
--location application
--caching cache-first
--endpoint-type app
--fields " content:String, senderId:int, chatRoomId:int, readAt:DateTime? "
Create Admin Dashboard Feature#
/feature:create dashboard Stats
--location console
--caching none
--endpoint-type console
--fields " totalUsers:int, totalPosts:int, activeUsers:int "
Success Criteria#
- โ All files generated in correct locations
- โ
melos run analyzeNo errors - โ
melos run test --scope={feature_name}Passes - โ
melos run test:bdd --scope={feature_name}Passes (--with-bdd true when) - โ DI Registration complete
- โ Route Registration complete
- โ Components verifiable from Widgetbook
- โ BDD .feature File Gherkin ๋ฌธ๋ฒ ์ค์
Core Rules Summary#
Backend#
- Korean comments on all fields
- Follow import order
- Separate business logic into Service
Domain#
- UseCase const constructor + Optional Constructor Injection
- getIt/@injectable prohibited
- All UseCase tests required
Data#
- Serverpod Mixin
as podnamespace required - SWR/Cache-First caching strategy
Presentation#
- BLoC Event: sealed class + private implementation
- UseCase Optional Constructor Injection (
Bloc(useCase: mockUseCase)Test) - Widget
super.keylast position - BLoC/Widget tests required
- Widgetbook reflection required