/feature-design¶
Workflow Diagram¶
Phase 2 of develop: Create design document via brainstorming skill in synthesis mode, review via reviewing-design-docs, handle approval gate by execution mode, and fix findings.
flowchart TD
Start([Phase 2 Start])
PrereqCheck{Prerequisites met?}
PrereqFail([STOP: Return to Phase 1.5])
EscapeCheck{Escape hatch type?}
SkipAll([Skip to Phase 3])
CreateDesign[Dispatch brainstorming subagent]
SynthMode[Synthesis mode: no questions]
SaveDesign[Save design document]
ReviewDesign[Dispatch reviewing-design-docs]
ReviewFindings[Collect findings]
ApprovalGate{Execution mode?}
AutoFix[Auto-fix all findings]
InteractiveWait[Present findings, wait]
MostlyAutoCheck{Critical blockers?}
PresentCritical[Present critical blockers]
AutoFixNonCrit[Auto-fix non-critical]
HasFindings{Findings exist?}
DispatchFix[Dispatch executing-plans fix]
FixComplete[Fix complete]
VerifyDesign{Design doc exists?}
Phase2Done([Phase 2 Complete])
Start --> PrereqCheck
PrereqCheck -->|No| PrereqFail
PrereqCheck -->|Yes| EscapeCheck
EscapeCheck -->|"Treat as ready"| SkipAll
EscapeCheck -->|"Review first"| ReviewDesign
EscapeCheck -->|None| CreateDesign
CreateDesign --> SynthMode
SynthMode --> SaveDesign
SaveDesign --> ReviewDesign
ReviewDesign --> ReviewFindings
ReviewFindings --> ApprovalGate
ApprovalGate -->|Autonomous| HasFindings
ApprovalGate -->|Interactive| InteractiveWait
ApprovalGate -->|Mostly autonomous| MostlyAutoCheck
InteractiveWait --> HasFindings
MostlyAutoCheck -->|Yes| PresentCritical
PresentCritical --> HasFindings
MostlyAutoCheck -->|No| HasFindings
HasFindings -->|Yes| DispatchFix
HasFindings -->|No| VerifyDesign
DispatchFix --> FixComplete
FixComplete --> VerifyDesign
VerifyDesign -->|No| CreateDesign
VerifyDesign -->|Yes| Phase2Done
style Start fill:#2196F3,color:#fff
style Phase2Done fill:#2196F3,color:#fff
style PrereqFail fill:#2196F3,color:#fff
style SkipAll fill:#2196F3,color:#fff
style CreateDesign fill:#4CAF50,color:#fff
style ReviewDesign fill:#4CAF50,color:#fff
style DispatchFix fill:#4CAF50,color:#fff
style PrereqCheck fill:#FF9800,color:#fff
style EscapeCheck fill:#FF9800,color:#fff
style ApprovalGate fill:#FF9800,color:#fff
style MostlyAutoCheck fill:#FF9800,color:#fff
style HasFindings fill:#FF9800,color:#fff
style VerifyDesign fill:#f44336,color:#fff
Legend¶
| Color | Meaning |
|---|---|
| Green (#4CAF50) | Skill invocation |
| Blue (#2196F3) | Command/action |
| Orange (#FF9800) | Decision point |
| Red (#f44336) | Quality gate |
Command Content¶
# /feature-design
<ROLE>
Phase 2 Orchestrator for develop. Your reputation depends on design documents that reflect complete discovery -- not assumptions -- and on subagents dispatched correctly for each step. Skipping phases or doing subagent work inline is a failure, regardless of speed.
</ROLE>
Phase 2 of the develop workflow. Run after `/feature-discover` completes.
<CRITICAL>
## Prerequisite Verification
Before ANY Phase 2 work, run this check:
```bash
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
PROJECT_ENCODED=$(echo "$PROJECT_ROOT" | sed 's|^/||' | tr '/' '-')
echo "=== Phase 2 Prerequisites ==="
# CHECK 1: Complexity tier must be STANDARD or COMPLEX
echo "Required: complexity_tier in (standard, complex)"
echo "Current tier: [SESSION_PREFERENCES.complexity_tier]"
# CHECK 2: Understanding document must exist (Phase 1.5 artifact)
echo "Required: Understanding document exists"
ls ~/.local/spellbook/docs/$PROJECT_ENCODED/understanding/ 2>/dev/null || echo "FAIL: No understanding document found"
# CHECK 3: Completeness score must be 100%
echo "Required: Phase 1.5 completeness score = 100%"
echo "Verify: SESSION_CONTEXT.design_context populated with no TBD values"
# CHECK 4: Devil's advocate was dispatched
echo "Required: Devil's advocate review completed"
```
**If ANY check fails:** STOP. Return to the appropriate phase.
**Anti-rationalization:** If you are tempted to skip this check because "the feature is well-understood" or "we can design without the full discovery," that is Pattern 6 (Phase Collapse). The understanding document IS the input to design. Without it, design is guesswork.
</CRITICAL>
## Invariant Principles
1. **Discovery precedes design** - Design only after `design_context` is fully populated; never design without research findings
2. **Synthesis mode for subagents** - Brainstorming subagent receives complete context; no interactive discovery in design phase
3. **Review is mandatory** - Every design document must pass `reviewing-design-docs` before proceeding
4. **Approval gates respect mode** - Interactive mode pauses for user; autonomous mode auto-fixes all findings
---
## Phase 2: Design
<CRITICAL>
Phase behavior depends on escape hatch:
- **No escape hatch:** Run full Phase 2
- **Design doc with "review first":** Skip 2.1, start at 2.2
- **Design doc with "treat as ready":** Skip entire Phase 2
- **Impl plan escape hatch:** Skip entire Phase 2
</CRITICAL>
### 2.1 Create Design Document
<RULE>Dispatch subagent. Do NOT do this work in main context.</RULE>
```
Task:
description: "Create design document"
prompt: |
First, invoke the brainstorming skill using the Skill tool.
Then follow its complete workflow.
IMPORTANT: SYNTHESIS MODE -- all discovery is complete.
Do NOT ask questions. Use the comprehensive context below.
## Autonomous Mode Context
**Mode:** AUTONOMOUS - Proceed without asking questions
**Protocol:** See patterns/autonomous-mode-protocol.md
**Circuit breakers:** Only pause for security-critical or contradictory requirements
## Pre-Collected Discovery Context
[Required: paste complete SESSION_CONTEXT.design_context here before dispatching]
## Task
Using the brainstorming skill in synthesis mode:
1. Skip "Understanding the idea" phase -- context is complete
2. Skip "Exploring approaches" questions -- decisions are made
3. Go directly to "Presenting the design"
4. Do NOT ask "does this look right so far" -- proceed through all sections
5. Save to: ~/.local/spellbook/docs/<project-encoded>/plans/YYYY-MM-DD-[feature-slug]-design.md
```
**Subagent failure:** If brainstorming subagent fails, HALT and report to user. Do not attempt inline design work.
### 2.2 Review Design Document
<RULE>Dispatch subagent. Do NOT do this work in main context.</RULE>
```
Task:
description: "Review design document"
prompt: |
First, invoke the reviewing-design-docs skill using the Skill tool.
Then follow its complete workflow.
## Context for the Skill
Design document location: ~/.local/spellbook/docs/<project-encoded>/plans/YYYY-MM-DD-[feature-slug]-design.md
Return the complete findings report with remediation plan.
```
**Subagent failure:** If reviewing-design-docs subagent fails, HALT and report to user. Do not attempt inline review.
### 2.3 Approval Gate
```python
def handle_review_checkpoint(findings, mode):
if mode == "autonomous":
# Never pause - proceed automatically
# CRITICAL: Always favor most complete/correct fixes
if findings:
dispatch_fix_subagent(
findings,
fix_strategy="most_complete", # Not "quickest"
treat_suggestions_as="mandatory", # Not "optional"
fix_depth="root_cause" # Not "surface_symptom"
)
return "proceed"
if mode == "interactive":
# Always pause - wait for user
if len(findings) > 0:
present_findings_summary(findings)
display("Type 'continue' when ready for me to fix these issues.")
wait_for_user_input()
dispatch_fix_subagent(findings)
else:
display("Review complete - no issues found.")
display("Ready to proceed to next phase?")
wait_for_user_acknowledgment()
return "proceed"
if mode == "mostly_autonomous":
# Only pause for critical blockers
critical_findings = [f for f in findings if f.severity == "critical"]
if critical_findings:
present_critical_blockers(critical_findings)
wait_for_user_input()
if findings:
dispatch_fix_subagent(findings)
return "proceed"
```
### 2.4 Fix Design Document
<RULE>Dispatch subagent. Do NOT do this work in main context.</RULE>
<CRITICAL>
In autonomous mode, ALWAYS favor most complete and correct solutions:
- Treat suggestions as mandatory improvements
- Fix root causes, not just symptoms
- Ensure fixes maintain consistency
</CRITICAL>
```
Task:
description: "Fix design document"
prompt: |
First, invoke the executing-plans skill using the Skill tool.
Then use its workflow to systematically fix the design document.
## Context for the Skill
Review findings to address:
[Paste complete findings report and remediation plan]
Design document location: ~/.local/spellbook/docs/<project-encoded>/plans/YYYY-MM-DD-[feature-slug]-design.md
## Fix Quality Requirements
- Address ALL items: critical, important, minor, AND suggestions
- Choose fixes that produce highest quality results
- Fix underlying issues, not just surface symptoms
```
<FORBIDDEN>
- Performing brainstorming, design review, or plan execution in main context instead of subagents
- Asking discovery questions during the brainstorming subagent (synthesis mode is mandatory)
- Skipping the Prerequisite Verification before beginning Phase 2 work
- Proceeding to Phase 3 with unchecked items in the transition gate
- Dispatching 2.4 fix subagent with fix_strategy other than "most_complete" in autonomous mode
- Treating `[Required: paste complete SESSION_CONTEXT.design_context here before dispatching]` as optional
</FORBIDDEN>
---
## ═══════════════════════════════════════════════════════════════════
## STOP AND VERIFY: Phase 2 → Phase 3 Transition
## ═══════════════════════════════════════════════════════════════════
Before proceeding to Phase 3, verify Phase 2 is complete:
```bash
ls ~/.local/spellbook/docs/<project-encoded>/plans/*-design.md
```
- [ ] Brainstorming subagent DISPATCHED in SYNTHESIS MODE (not done in main context)
- [ ] Design document created and saved
- [ ] Design review subagent (reviewing-design-docs) DISPATCHED
- [ ] Approval gate handled per autonomous_mode
- [ ] All critical/important findings fixed (if any)
If ANY unchecked: Go back to Phase 2. Do NOT proceed.
---
**Next:** Run `/feature-implement` to begin Phase 3 (Implementation Planning) and Phase 4 (Implementation).
<FINAL_EMPHASIS>
You are a Phase 2 Orchestrator. Design documents built on incomplete discovery fail in implementation. Subagent work done inline corrupts your context and breaks the workflow. Every gate exists for a reason. Hold the line.
</FINAL_EMPHASIS>