Context
- Main repo root: !
sh -c 'COMMON=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null) && dirname "$COMMON" || echo "NOT_IN_GIT_REPO"'
- PLAN files: !
sh -c 'COMMON=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null); if [ -z "$COMMON" ]; then echo "NOT_IN_GIT_REPO"; exit 0; fi; PROJECT_ROOT=$(dirname "$COMMON"); cd "$PROJECT_ROOT" && for f in PLAN__*.md; do [ -f "$f" ] && echo "$f" && found=1; done; if [ -z "$found" ]; then [ -f PLAN.md ] && echo "LEGACY_PLAN" || echo "NO_PLAN_FILES"; fi' 2>/dev/null | sed 's/PLAN__//;s/\.md$//' | paste -sd ',' -
- Worktree/CWD: !
pwd
- Last commit: !
git log -1 --format="%h %ai %s" 2>/dev/null || echo "NO_COMMITS"
Create or Update Development Documentation
Automatically creates task-specific PLAN files (PLAN__<TASK>.md) or updates existing ones by analyzing session activity to track implementation progress.
Task-Specific PLAN Files
Purpose: Single source of truth for plans and progress across sessions. A new agent must be able to resume work using ONLY the PLAN file -- no prior session context, no codebase re-exploration for decisions already made.
Naming Convention:
- Format:
PLAN__<TASK>.md (always PLAN__ with two underscores)
- Task identifier: 1-2 words, uppercase letters only, single underscores between words
- Valid: ✓
AUTH_FLOW, ✓ API_MIGRATION, ✓ SLACK_FORMATTING
- Invalid: ✗
auth_flow (lowercase), ✗ AUTH__FLOW (double underscore)
CRITICAL: File Location
ALWAYS write PLAN files to the MAIN git repository root, NEVER to a worktree root or ~/.claude/plans/
- Target path:
{main_repo_root}/PLAN__<TASK>.md
{main_repo_root} is the "Main repo root" value from the Context section above
- When working inside a git worktree,
{main_repo_root} differs from "Worktree/CWD" — always use {main_repo_root}
- Claude Code's
~/.claude/plans/ is separate and unrelated
- The
/dev-docs command manages repository-local documentation
Phase 1: Determine Mode
Use pre-executed context:
Check "PLAN files":
NO_PLAN_FILES → Create mode: Extract plan from ExitPlanMode
LEGACY_PLAN → Legacy migration: Rename PLAN.md to PLAN__.md
- Single task → Update mode: Work with that file
- Multiple tasks → Disambiguate: Determine which task or create new
Phase 2: Extract Plan & Evidence
For Create Mode
⚠️ ANTI-RECENCY BIAS: Recent work dominates attention. The FIRST ExitPlanMode has the complete vision. Document ALL work (completed, current, AND future).
Extract plans:
- Find ALL ExitPlanMode calls in session
- Extract each in chronological order
- CRITICAL: Read FIRST call for complete vision
- PRESERVE original structure - match original organization
- Synthesize complete plan ensuring ALL items captured
- Generate task name from main theme
Search for implementation evidence:
- Review activity after last ExitPlanMode
- Find: Write/Edit/Bash/TodoWrite calls, completion phrases
- Map tasks to evidence via file paths and keywords
Assign statuses:
- Strong evidence → [DONE]
- Medium evidence → [IN PROGRESS]
- Weak/no evidence → [TODO]
For Update Mode
- Read
PLAN__<TASK>.md, parse task hierarchy with statuses
- Search recent activity for implementation evidence
- Match tasks to evidence, assign status updates
- Check for plan evolution: ExitPlanMode newer than PLAN file
Phase 3: Write or Update File
See references/templates.md for PLAN.md structure.
Create Mode
Generate PLAN__.md with:
- Overview: 1-2 paragraph summary including architectural approach and key design decisions (with reasoning)
- Scope: Features, components, files with role descriptions (what each file does in context of this plan)
- Purpose: Problem, value, requirements, and relevant constraints or limitations discovered
- Implementation Details: Hierarchical tasks with [STATUS], each containing enough detail for a new agent to implement without re-exploring the codebase (include HOW, not just WHAT)
Write to {main_repo_root}/PLAN__<TASK>.md and validate:
- Compare structure to FIRST ExitPlanMode
- Count items: original N items should match generated
- Future work documented as [TODO], not omitted
- Task name format valid
Update Mode
Update PLAN__<TASK>.md:
- Use Edit tool for each status change
- Match exact old_string with indentation
- Preserve hierarchy and formatting
Handle plan evolution if detected:
- Add new areas to existing structure
- Mark deprecated as
[CANCELLED - plan changed]
- Update Scope/Purpose if changed
Cold-Start Resumption Requirement
Every PLAN file must be self-contained enough for a new agent to resume work without prior session context. When writing or updating, verify:
- Architectural context: Key design decisions and WHY they were made (not just what was chosen, but what was rejected and why)
- Task detail: Each [TODO] task describes HOW to implement, not just WHAT to implement -- include approach, relevant patterns, and target file paths
- Dependencies: Tasks that must be completed in order are explicitly noted (e.g., "depends on Phase 1 completing" or "must run after database migration")
- Gotchas: Any pitfalls, constraints, or non-obvious behaviors discovered during implementation are captured in the Gotchas section with enough detail to avoid re-discovery
- File roles: The Scope section explains what each file does in the context of this plan, not just that it was modified
Status Transitions & Evidence Strength
Evidence Strength:
- Strong: Multiple indicators → [DONE]
- Medium: Single indicator → [IN PROGRESS]
- Weak/None → [TODO]
Valid Status Labels:
- [TODO] → Not started
- [IN PROGRESS] → Started not finished
- [DONE] → Completed
- [BLOCKED] → Cannot proceed (include reason)
- [CANCELLED - plan changed] → No longer relevant
Critical Requirements
All Modes:
- Analyze session activity for evidence
- Match ALL tasks to evidence, assign statuses intelligently
- Include evidence-free tasks as [TODO] - never skip planned work
- Use 3-space indentation, preserve hierarchy
- Verify PLAN file passes cold-start test: could a new agent resume work using only this file?
Create Mode:
- PREVENT RECENCY BIAS: Prioritize FIRST ExitPlanMode
- PRESERVE STRUCTURE: Match original organization exactly
- Document entire plan regardless of progress
- Generate valid task name, create in main repo root (NEVER in worktree root or ~/.claude/plans/)
Update Mode:
- Use Edit tool with exact matching
- Handle evolution: add new, mark deprecated as cancelled
See references/templates.md for detailed PLAN.md structure and examples.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: dev-docs-23description: Creates or updates PLAN.md based on session - auto-detects create vs update mode4---56## Context78- Main repo root: !`sh -c 'COMMON=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null) && dirname "$COMMON" || echo "NOT_IN_GIT_REPO"'`9- PLAN files: !`sh -c 'COMMON=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null); if [ -z "$COMMON" ]; then echo "NOT_IN_GIT_REPO"; exit 0; fi; PROJECT_ROOT=$(dirname "$COMMON"); cd "$PROJECT_ROOT" && for f in PLAN__*.md; do [ -f "$f" ] && echo "$f" && found=1; done; if [ -z "$found" ]; then [ -f PLAN.md ] && echo "LEGACY_PLAN" || echo "NO_PLAN_FILES"; fi' 2>/dev/null | sed 's/PLAN__//;s/\.md$//' | paste -sd ',' -`10- Worktree/CWD: !`pwd`11- Last commit: !`git log -1 --format="%h %ai %s" 2>/dev/null || echo "NO_COMMITS"`1213# Create or Update Development Documentation1415Automatically creates task-specific PLAN files (`PLAN__<TASK>.md`) or updates existing ones by analyzing session activity to track implementation progress.1617## Task-Specific PLAN Files1819**Purpose:** Single source of truth for plans and progress across sessions. A new agent must be able to resume work using ONLY the PLAN file -- no prior session context, no codebase re-exploration for decisions already made.2021**Naming Convention:**22- Format: `PLAN__<TASK>.md` (always `PLAN__` with two underscores)23- Task identifier: 1-2 words, uppercase letters only, single underscores between words24- Valid: ✓ `AUTH_FLOW`, ✓ `API_MIGRATION`, ✓ `SLACK_FORMATTING`25- Invalid: ✗ `auth_flow` (lowercase), ✗ `AUTH__FLOW` (double underscore)2627## CRITICAL: File Location2829**ALWAYS write PLAN files to the MAIN git repository root, NEVER to a worktree root or ~/.claude/plans/**3031- Target path: `{main_repo_root}/PLAN__<TASK>.md`32- `{main_repo_root}` is the "Main repo root" value from the Context section above33- When working inside a git worktree, `{main_repo_root}` differs from "Worktree/CWD" — always use `{main_repo_root}`34- Claude Code's `~/.claude/plans/` is separate and unrelated35- The `/dev-docs` command manages repository-local documentation3637## Phase 1: Determine Mode3839Use pre-executed context:4041**Check "PLAN files":**42- `NO_PLAN_FILES` → **Create mode**: Extract plan from ExitPlanMode43- `LEGACY_PLAN` → **Legacy migration**: Rename PLAN.md to PLAN__<TASK>.md44- Single task → **Update mode**: Work with that file45- Multiple tasks → **Disambiguate**: Determine which task or create new4647## Phase 2: Extract Plan & Evidence4849### For Create Mode5051⚠️ **ANTI-RECENCY BIAS**: Recent work dominates attention. The FIRST ExitPlanMode has the complete vision. Document ALL work (completed, current, AND future).5253**Extract plans:**541. Find ALL ExitPlanMode calls in session552. Extract each in chronological order563. **CRITICAL**: Read FIRST call for complete vision574. **PRESERVE original structure** - match original organization585. Synthesize complete plan ensuring ALL items captured596. Generate task name from main theme6061**Search for implementation evidence:**621. Review activity after last ExitPlanMode632. Find: Write/Edit/Bash/TodoWrite calls, completion phrases643. Map tasks to evidence via file paths and keywords6566**Assign statuses:**67- Strong evidence → [DONE]68- Medium evidence → [IN PROGRESS]69- Weak/no evidence → [TODO]7071### For Update Mode72731. Read `PLAN__<TASK>.md`, parse task hierarchy with statuses742. Search recent activity for implementation evidence753. Match tasks to evidence, assign status updates764. Check for plan evolution: ExitPlanMode newer than PLAN file7778## Phase 3: Write or Update File7980See `references/templates.md` for PLAN.md structure.8182### Create Mode8384Generate PLAN__<TASK>.md with:85- Overview: 1-2 paragraph summary including architectural approach and key design decisions (with reasoning)86- Scope: Features, components, files with role descriptions (what each file does in context of this plan)87- Purpose: Problem, value, requirements, and relevant constraints or limitations discovered88- Implementation Details: Hierarchical tasks with [STATUS], each containing enough detail for a new agent to implement without re-exploring the codebase (include HOW, not just WHAT)8990Write to `{main_repo_root}/PLAN__<TASK>.md` and **validate**:91- Compare structure to FIRST ExitPlanMode92- Count items: original N items should match generated93- Future work documented as [TODO], not omitted94- Task name format valid9596### Update Mode9798Update `PLAN__<TASK>.md`:99- Use Edit tool for each status change100- Match exact old_string with indentation101- Preserve hierarchy and formatting102103Handle plan evolution if detected:104- Add new areas to existing structure105- Mark deprecated as `[CANCELLED - plan changed]`106- Update Scope/Purpose if changed107108## Cold-Start Resumption Requirement109110Every PLAN file must be self-contained enough for a new agent to resume work without prior session context. When writing or updating, verify:111112- **Architectural context**: Key design decisions and WHY they were made (not just what was chosen, but what was rejected and why)113- **Task detail**: Each [TODO] task describes HOW to implement, not just WHAT to implement -- include approach, relevant patterns, and target file paths114- **Dependencies**: Tasks that must be completed in order are explicitly noted (e.g., "depends on Phase 1 completing" or "must run after database migration")115- **Gotchas**: Any pitfalls, constraints, or non-obvious behaviors discovered during implementation are captured in the Gotchas section with enough detail to avoid re-discovery116- **File roles**: The Scope section explains what each file does in the context of this plan, not just that it was modified117118## Status Transitions & Evidence Strength119120**Evidence Strength:**121- Strong: Multiple indicators → [DONE]122- Medium: Single indicator → [IN PROGRESS]123- Weak/None → [TODO]124125**Valid Status Labels:**126- [TODO] → Not started127- [IN PROGRESS] → Started not finished128- [DONE] → Completed129- [BLOCKED] → Cannot proceed (include reason)130- [CANCELLED - plan changed] → No longer relevant131132## Critical Requirements133134**All Modes:**135- Analyze session activity for evidence136- Match ALL tasks to evidence, assign statuses intelligently137- Include evidence-free tasks as [TODO] - never skip planned work138- Use 3-space indentation, preserve hierarchy139- Verify PLAN file passes cold-start test: could a new agent resume work using only this file?140141**Create Mode:**142- **PREVENT RECENCY BIAS**: Prioritize FIRST ExitPlanMode143- **PRESERVE STRUCTURE**: Match original organization exactly144- Document entire plan regardless of progress145- Generate valid task name, create in main repo root (NEVER in worktree root or ~/.claude/plans/)146147**Update Mode:**148- Use Edit tool with exact matching149- Handle evolution: add new, mark deprecated as cancelled150151See `references/templates.md` for detailed PLAN.md structure and examples.152153---154> Converted and distributed by [TomeVault](https://tomevault.io/claim/wpfleger96) — claim your Tome and manage your conversions.155<!-- tomevault:4.0:skill_md:2026-04-13 -->