| name | intent-plan |
| description | Transform approved Intent into executable phased plan with strict TDD. Each step requires tests first (happy/bad/edge/security cases), then implementation. Use after /intent-review when ready to start development. |
Intent Plan
Transform an approved Intent into a structured, executable development plan with strict TDD discipline.
Output is TaskSwarm-compatible: The generated plan.md can be directly executed by /swarm run.
Core Principles
- Test First, Always: Every implementation step starts with writing tests
- Phased Execution: Break work into phases with clear deliverables (0-indexed)
- Verification Gates: Each phase ends with e2e validation
- Automation Priority: Prefer CLI/script testing over manual/browser testing
- Checkbox Tracking: All tests use
- [ ] format for progress tracking
Plan Structure
## Phase 0: [Phase Name]
โโโ ### Description
โโโ ### Tests
โ โโโ #### Happy Path
โ โ โโโ - [ ] test case 1
โ โโโ #### Bad Path (่ฏฆๅฐฝๅไธพ)
โ โ โโโ - [ ] error case 1
โ โโโ #### Edge Cases
โ โ โโโ - [ ] boundary case 1
โ โโโ #### Security
โ โ โโโ - [ ] vulnerability test 1
โ โโโ #### Data Leak
โ โ โโโ - [ ] leak prevention test 1
โ โโโ #### Data Damage
โ โโโ - [ ] integrity test 1
โโโ ### E2E Gate
โ โโโ CLI/Script ้ช่ฏๅฝไปค
โโโ ### Acceptance Criteria
โโโ - [ ] criterion 1
## Phase 1: [Phase Name]
โโโ ...
Test Categories (6 Required)
Every phase MUST include tests from ALL 6 categories:
| Category | Description | Examples |
|---|
| Happy Path | Normal expected usage | Valid inputs, correct sequences |
| Bad Path | Invalid inputs, error conditions | Wrong types, missing required fields, invalid states |
| Edge Cases | Boundary conditions | Empty inputs, max values, concurrent access |
| Security | Vulnerability prevention | Injection attacks, auth bypass, privilege escalation |
| Data Leak | Information exposure | Sensitive data in logs, error messages, API responses |
| Data Damage | Data integrity protection | Partial writes, corruption, race conditions |
Bad cases must be detailed and comprehensive. A good test suite has more failure tests than success tests.
Test Writing Discipline
- Tests First: Write ALL tests before any implementation
- Red-Green-Refactor: Run tests expecting failure, implement, verify pass
- No Skip: Every category must have at least one test case
Phase Gates: E2E Verification (Required)
Each phase MUST end with E2E verification. This is the gate that proves the phase is truly complete.
E2E Gate Requirements
- Automatable: Must be runnable via CLI/script, no manual steps
- Independent: Can run without human intervention
- Reproducible: Same inputs produce same outputs
- Fast Feedback: Fails quickly when something is wrong
Preferred: CLI/Script Testing
curl -X POST http://localhost:3000/api/resource \
-H "Content-Type: application/json" \
-d '{"field": "value"}' | jq .
psql -c "SELECT * FROM table WHERE condition"
diff expected_output.json actual_output.json
pnpm test -- --coverage
For Web Projects: Automation-Friendly Design
DO:
- Provide health check endpoints
- Return machine-parseable responses (JSON)
- Include test mode / seed data endpoints
- Design idempotent operations
DON'T:
- Require browser interaction for verification
- Depend on visual inspection
- Need manual clicking through UI
When Browser Testing is Unavoidable
If browser/headless testing is truly necessary:
- Use Playwright/Puppeteer with script automation
- Create dedicated test endpoints
- Prefer API calls over UI interaction
Pre-Plan Gates (Mandatory)
Before generating any plan, ALL gates must pass. No exceptions.
/intent-plan
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Gate 1: Interview Check โ
โ โ โ "ๅ
่ท /intent-interview" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Gate 2: Critique Check โ
โ โ โ "ๅ
่ท /intent-critique" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Gate 3: Dependency Check โ
โ โ โ "ๅ็ฝฎไปปๅกๆชๅฎๆ๏ผๆ ๆณ plan" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ All gates passed โ Generate plan.md
Gate 1: Interview Check
Verify the Intent has been properly interviewed:
| Check | How to Verify | If Failed |
|---|
| INTENT.md exists | File exists in intent directory | Run /intent-interview |
| Anchor exists | First blockquote after title starts with > | Add anchor statement |
| Within budget | wc -l INTENT.md โค 500 (warning at 300) | Run /intent-critique to reduce if > 500 |
| Structure complete | Has Responsibilities, Structure, API sections | Run /intent-interview |
| Not a stub | Content is substantial, not placeholder text | Run /intent-interview |
Output if failed:
โ Gate 1 Failed: Interview Incomplete
INTENT.md is missing or incomplete:
- [ ] Responsibilities section missing
- [ ] Structure diagram missing
Action required: Run /intent-interview first.
Gate 2: Critique Check
Verify the Intent has been critiqued for over-engineering:
| Check | How to Verify | If Failed |
|---|
| Critique done | Look for critique markers or changelog | Run /intent-critique |
| Post-modification | If INTENT.md modified after last critique | Run /intent-critique again |
| AI assessment | Ask AI if another critique round is needed | Run /intent-critique if yes |
Critique markers to look for:
<!-- critique: {date} --> comment in INTENT.md
critique.md or CRITIQUE.md in same directory
- Changelog entry mentioning critique
Post-modification detection:
- Compare INTENT.md mtime with critique marker date
- If INTENT.md is newer AND has substantial changes โ re-critique required
AI Assessment prompt:
"Based on this Intent, is there any sign of over-engineering, premature abstraction, or YAGNI violation that warrants another critique round?"
Output if failed:
โ Gate 2 Failed: Critique Required
Intent has not been critiqued, or was modified after critique:
- Last critique: 2026-01-15
- INTENT.md modified: 2026-01-20 (substantial changes detected)
Action required: Run /intent-critique to review for over-engineering.
Gate 3: Dependency Check
Verify all prerequisites are satisfied:
| Check | How to Verify | If Failed |
|---|
| Internal deps | Referenced intents have status: done in TASK.yaml | List blocking intents |
| External deps | Required packages/services exist | List missing dependencies |
| Environment | Required env vars, credentials, access | List missing setup |
How to find dependencies:
- Parse
## Prerequisites or ## Dependencies in INTENT.md
- Look for
depends_on: in TASK.yaml (if exists)
- Scan for references like
intent/other-feature/ or @package/name
Dependency states:
intent/auth/ โ TASK.yaml status: done โ OK
intent/database/ โ TASK.yaml status: review โ Blocked (not done)
intent/api/ โ No TASK.yaml ? Assume not started
@aigne/afs โ Check packages/ or deps โ/โ
Output if failed:
โ Gate 3 Failed: Dependencies Not Ready
This Intent cannot be planned because prerequisites are incomplete:
Blocking Intents:
- intent/auth-module/ โ status: in_progress (need: done)
- intent/database-setup/ โ status: ready (need: done)
Missing External Dependencies:
- @aigne/session-protocol โ not found in packages/
Action required: Complete blocking tasks first, or remove dependencies from INTENT.md if not actually needed.
Gate Pass Output
When all gates pass:
โ Gate 1: Interview complete
โ Gate 2: Critique done (2026-01-20), no re-critique needed
โ Gate 3: All 2 dependencies satisfied
Proceeding to generate plan...
Workflow
/intent-plan
โ
Gate 1: Interview Check โโโ โ โ Stop, require /intent-interview
โ โ
Gate 2: Critique Check โโโโ โ โ Stop, require /intent-critique
โ โ
Gate 3: Dependency Check โโ โ โ Stop, list blockers
โ โ
Read Intent file
โ
Analyze scope and complexity
โ
Identify logical phases (0-indexed)
โ
For each phase, define:
- Description
- Tests (6 categories)
- E2E Gate
- Acceptance Criteria
โ
Present plan for approval
โ
User confirms or adjusts
โ
Save to plan.md (same directory as INTENT.md)
โ
Create TASK.yaml (status: ready)
Output Files
1. plan.md (Required)
# Execution Plan: {task_name}
## Overview
็ฎ่ฆ่ฏดๆ่ฟไธชไปปๅก่ฆๅไปไนใ
## Prerequisites
- ๅ็ฝฎๆกไปถ
- ไพ่ต็ๅ
ถไปไปปๅก
- ้่ฆ็ๆ้ๆ่ตๆบ
## Phase 0: {Phase Name}
### Description
่ฟไธช้ถๆฎต่ฆๅฎๆไปไน๏ผไบคไปไปไนใ
### Tests
#### Happy Path
- [ ] ๆต่ฏๆญฃๅธธๆต็จ 1: {ๅ
ทไฝๆ่ฟฐ}
- [ ] ๆต่ฏๆญฃๅธธๆต็จ 2: {ๅ
ทไฝๆ่ฟฐ}
#### Bad Path
- [ ] ๆ ๆ่พๅ
ฅ: {ๅ
ทไฝๅบๆฏ}
- [ ] ็ผบๅคฑๅฟ
ๅกซๅญๆฎต: {ๅ
ทไฝๅบๆฏ}
- [ ] ้่ฏฏ็ถๆ: {ๅ
ทไฝๅบๆฏ}
- [ ] ็ฑปๅ้่ฏฏ: {ๅ
ทไฝๅบๆฏ}
#### Edge Cases
- [ ] ็ฉบ่พๅ
ฅๅค็
- [ ] ๆๅคงๅผ่พน็
- [ ] ๅนถๅ่ฎฟ้ฎ
#### Security
- [ ] ๆณจๅ
ฅๆปๅป้ฒๆค: {ๅ
ทไฝๅบๆฏ}
- [ ] ๆ้็ป่ฟ้ฒๆค: {ๅ
ทไฝๅบๆฏ}
- [ ] ่พๅ
ฅ้ช่ฏ: {ๅ
ทไฝๅบๆฏ}
#### Data Leak
- [ ] ้่ฏฏไฟกๆฏไธๆณ้ฒๆๆๆฐๆฎ
- [ ] ๆฅๅฟไธๅ
ๅซๆๆไฟกๆฏ
- [ ] API ๅๅบไธ่ฟๅบฆๆด้ฒ
#### Data Damage
- [ ] ้จๅๅๅ
ฅๆขๅค
- [ ] ็ซๆๆกไปถๅค็
- [ ] ไบๅกๅฎๆดๆง
### E2E Gate
```bash
# Phase ๅฎๆ้ช่ฏ่ๆฌ
{CLI commands to verify phase completion}
Acceptance Criteria
Phase 1: {Phase Name}
Description
ไธไธ้ถๆฎต่ฆๅฎๆไปไนใ
Tests
Happy Path
Bad Path
Edge Cases
Security
Data Leak
Data Damage
E2E Gate
Acceptance Criteria
Final E2E Verification
Risk Mitigation
| Risk | Mitigation | Contingency |
|---|
| [้ฃ้ฉ 1] | [้ข้ฒๆชๆฝ] | [ๅ็ๆถ็ๅบๅฏน] |
References
### 2. TASK.yaml (Required)
```yaml
status: ready
owner: null
assignee: null
phase: 0/{total_phases}
updated: {UTC_ISO_TIMESTAMP}
heartbeat: null
Important: {total_phases} is the number of phases in plan.md (0-indexed counting).
Integration with IDD & TaskSwarm
IDD Flow:
/intent-interview # Create Intent (Gate 1 requirement)
โ
/intent-critique # Review for over-engineering (Gate 2 requirement)
โ
/intent-review # Approve Intent (optional but recommended)
โ
/intent-plan # Gate checks โ Generate plan.md + TASK.yaml (THIS SKILL)
โ
TaskSwarm Flow:
/swarm run # Execute plan (TDD cycles)
โ
/swarm approve # Human review
โ
/intent-sync # Write back confirmed details
Gate enforcement ensures quality:
- No plan without proper interview โ avoids vague/incomplete specs
- No plan without critique โ avoids over-engineered designs
- No plan with missing deps โ avoids unexecutable plans
Tips for Good Plans
Format (TaskSwarm Compatible)
- 0-indexed phases: Phase 0, Phase 1, Phase 2...
- Checkbox format: All tests use
- [ ] for progress tracking
- E2E Gate per phase: Each phase must have runnable verification
Test Quality
- All 6 categories required: Happy/Bad/Edge/Security/Data Leak/Data Damage
- Bad Path > Happy Path: More failure tests than success tests
- Specific test cases: "Test error handling" โ โ "returns 404 when resource not found" โ
- Security by default: Include even if not explicitly requested
Phase Design
- Right-size phases: Each phase completable in 1-3 days
- Clear dependencies: Note when phases depend on previous phases
- Automatable gates: E2E Gate must be runnable via CLI, no manual steps
Example: Complete Output
For an Intent at intent/session-protocol/INTENT.md:
Creates: intent/session-protocol/plan.md
# Execution Plan: session-protocol
## Overview
ๅฎ็ฐ Session Protocol ็ Frame ็ผ่งฃ็ ๅ่ฝใ
## Prerequisites
- @aigne/afs ๅ
ๅทฒๅญๅจ
- TypeScript ็ฏๅข้
็ฝฎๅฎๆ
## Phase 0: Frame Encoding
### Description
ๅฎ็ฐ Frame ็็ผ็ ๅฝๆฐ๏ผๅฐ็ปๆๅๆฐๆฎ่ฝฌๆขไธบไบ่ฟๅถๆ ผๅผใ
### Tests
#### Happy Path
- [ ] encodes empty frame correctly
- [ ] encodes frame with JSON payload
- [ ] encodes frame with binary payload
- [ ] preserves ReqId across encode/decode
#### Bad Path
- [ ] throws on invalid frame type
- [ ] throws on payload exceeding max size
- [ ] throws on null payload when required
- [ ] throws on negative ReqId
- [ ] throws on non-integer frame type
#### Edge Cases
- [ ] handles empty string payload
- [ ] handles maximum allowed payload size (64KB)
- [ ] handles unicode in JSON payload
- [ ] handles zero-length binary payload
#### Security
- [ ] rejects frames with potential injection patterns
- [ ] validates frame type bounds (0-255)
- [ ] sanitizes string inputs before encoding
#### Data Leak
- [ ] error messages don't expose internal structure
- [ ] stack traces not included in thrown errors
#### Data Damage
- [ ] atomic write: partial encode doesn't corrupt buffer
- [ ] buffer overflow protection
### E2E Gate
```bash
# Verify encoding works end-to-end
pnpm test -- --grep "Frame Encoding"
pnpm test:e2e -- --grep "encode"
Acceptance Criteria
Phase 1: Frame Decoding
Description
ๅฎ็ฐ Frame ็่งฃ็ ๅฝๆฐ๏ผๅฐไบ่ฟๅถๆฐๆฎ่งฃๆไธบ็ปๆๅๅฏน่ฑกใ
Tests
Happy Path
Bad Path
Edge Cases
Security
Data Leak
Data Damage
E2E Gate
pnpm test -- --grep "Frame"
echo '{"test":1}' | node scripts/encode-decode-test.js
Acceptance Criteria
Final E2E Verification
pnpm test
pnpm test:e2e
References
**Creates**: `intent/session-protocol/TASK.yaml`
```yaml
status: ready
owner: null
assignee: null
phase: 0/2
updated: 2026-01-27T10:00:00Z
heartbeat: null