feature
Execute feature development workflow from specification through production deployment with automated quality gates
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/marcusgoll/Spec-Flow/HEAD/.claude/commands/core/feature.md -o ~/.claude/commands/feature.mdfeature.md
<objective>
Orchestrate complete feature delivery through **isolated phase agents spawned via Task()** with strict state tracking and true autopilot execution.
**Command**: `/feature [feature description | slug | continue | next | epic:<name> | epic:<name>:sprint:<num> | sprint:<num>]`
**CRITICAL ARCHITECTURE** (v5.0 - Domain Memory v2):
This orchestrator is **ultra-lightweight**. You MUST:
1. Read state from disk (state.yaml, interaction-state.yaml, domain-memory.yaml)
2. Spawn isolated phase agents via **Task tool** - NEVER execute phases inline
3. Handle user Q&A when agents return questions
4. Update state.yaml after each phase
5. NEVER carry implementation details in your context
**Benefits**: Unlimited feature complexity, observable progress, resumable at any point, each phase gets fresh context.
</objective>
<context>
**Current repository state**:
Git status:
!`git status --short`
Current branch:
!`git branch --show-current`
Recent features:
!`ls -t specs/ 2>/dev/null | head -5`
Active workflow state (if any):
!`find specs -name "state.yaml" -exec grep -l "status: in_progress\|status: failed" {} \; 2>/dev/null | head -3`
Deployment model detection:
!`git branch -r | grep -q "staging" && echo "staging-prod" || (git remote -v | grep -q "origin" && echo "direct-prod" || echo "local-only")`
Worktree context:
!`bash .spec-flow/scripts/bash/worktree-context.sh info 2>/dev/null || echo '{"is_worktree": false}'`
Studio context (multi-agent isolation):
!`bash .spec-flow/scripts/bash/worktree-context.sh studio-detect 2>/dev/null || echo ""`
Worktree preference:
!`bash .spec-flow/scripts/utils/load-preferences.sh --key "worktrees.auto_create" --default "true" 2>/dev/null || echo "true"`
Planning depth preference:
!`bash .spec-flow/scripts/utils/load-preferences.sh --key "planning.auto_deep_mode" --default "false" 2>/dev/null || echo "false"`
Auto-ship preference:
!`bash .spec-flow/scripts/utils/load-preferences.sh --key "deployment.auto_ship" --default "false" 2>/dev/null || echo "false"`
Auto-merge preference:
!`bash .spec-flow/scripts/utils/load-preferences.sh --key "deployment.auto_merge" --default "false" 2>/dev/null || echo "false"`
Auto-finalize preference:
!`bash .spec-flow/scripts/utils/load-preferences.sh --key "deployment.auto_finalize" --default "true" 2>/dev/null || echo "true"`
</context>
<planning_depth>
## Planning Depth Mode (--deep / --auto)
**Flags in $ARGUMENTS**:
- `--deep` → Force ultrathink/craftsman planning for this feature
- `--auto` → Use preferences to determine depth (respects `auto_deep_mode`), AND continue through ship→finalize without stopping
- Neither → Interactive mode, respects preference triggers
**Pass flag to /plan phase**:
When spawning the plan-phase-agent, include the planning mode:
- If `--deep` in arguments: Pass `--deep` to /plan
- If `--auto` in arguments: Determine from preferences and pass appropriate flag
- Store planning_mode in state.yaml for reference
**State tracking**:
```yaml
# In state.yaml
planning:
mode: deep # or standard
ultrathink_enabled: true
craftsman_decision_generated: true
```
</planning_depth>
<auto_mode>
## Auto Mode (--auto flag)
When `--auto` flag is present, the workflow runs end-to-end without stopping:
**Full auto-mode behavior** (when `--auto` flag is set):
1. **Planning**: Skip spec/plan review prompts (use preferences for depth)
2. **Implementation**: Continue through all phases automatically
3. **Ship**: Check CI, auto-merge when passing (if `deployment.auto_merge: true`)
4. **Finalize**: Run /finalize automatically (if `deployment.auto_finalize: true`)
**Preference-controlled auto-ship** (v11.7):
- `deployment.auto_ship: true` → Continue from optimize → ship → finalize without stopping
- `deployment.auto_merge: true` → Auto-merge PR when CI passes (no production approval prompt)
- `deployment.auto_finalize: true` → Run /finalize automatically after successful deployment
**State tracking**:
```yaml
# In state.yaml
auto_mode:
enabled: true
auto_ship: true # Continue optimize → ship → finalize
auto_merge: true # Auto-merge when CI passes
auto_finalize: true
```
</auto_mode>
<studio_mode>
## Studio Mode (Multi-Agent Isolation) (v11.8)
When running in a studio worktree (`worktrees/studio/agent-N/`), the workflow automatically:
1. **Detects studio context** - Auto-detected from working directory
2. **Namespaces branches** - `studio/agent-N/feature/XXX-slug` instead of `feature/XXX-slug`
3. **Creates PRs for merging** - Studio agents always create PRs (like a real dev team)
4. **Prevents git conflicts** - Each agent has isolated branches
**Detection (automatic, no user action needed):**
```bash
STUDIO_AGENT=$(bash .spec-flow/scripts/bash/worktree-context.sh studio-detect 2>/dev/null || echo "")
IS_STUDIO_MODE=$([[ -n "$STUDIO_AGENT" ]] && echo "true" || echo "false")
```
**Branch naming in studio mode:**
```bash
# Get namespaced branch (handles studio detection automatically)
BRANCH=$(bash .spec-flow/scripts/bash/worktree-context.sh studio-branch "feature" "$SLUG" 2>/dev/null)
# Returns: "studio/agent-1/feature/001-auth" in studio mode
# Returns: "feature/001-auth" in normal mode
```
**State tracking (in state.yaml):**
```yaml
studio:
enabled: true
agent_id: agent-1
branch_namespace: studio/agent-1
merge_strategy: pr # Always PR in studio mode
```
**Ship behavior in studio mode:**
- Always creates PR instead of direct merge
- PR targets `main` branch from `studio/agent-N/feature/XXX-slug`
- Auto-merge enabled via GitHub branch protection (no manual review needed)
- CI gates validate the change before merge
</studio_mode>
<dry_run_mode>
## Dry-Run Mode (--dry-run)
**When `--dry-run` is in $ARGUMENTS:**
Preview all operations without executing them. See `.claude/skills/dry-run/SKILL.md` for full specification.
**Detection:**
```bash
DRY_RUN="false"
if [[ "$ARGUMENTS" == *"--dry-run"* ]]; then
DRY_RUN="true"
ARGUMENTS=$(echo "$ARGUMENTS" | sed 's/--dry-run/Execute multiple sprints in parallel based on dependency graph from sprint-plan.md
Build and validate locally for projects without remote deployment (prototypes, experiments, local-only dev)
Execute multi-sprint epic workflow from interactive scoping through deployment with parallel sprint execution and self-improvement
Analyze workflow state and provide context-aware guidance with visual progress indicators and recommended next steps
Initialize project documentation, preferences, or design tokens
Implement small bug fixes and features (<100 LOC) without full workflow. Use for single-file changes, bug fixes, refactors, and minor enhancements that can be completed in under 30 minutes.
Enter deep craftsman mode - question everything, plan like Da Vinci, craft insanely great solutions, then materialize to roadmap
Display Vercel and Railway deployment quota usage with 24h rolling window analysis, quota reset predictions, and deployment strategy recommendations