# Plan

> Task decomposition and dependency planning. Reads spec and outputs ordered implementation tasks.

- Skill: `arbazkhan971/plan` (Agent Skill)
- Install (CLI): `npx skillmds@latest add arbazkhan971/plan`
- Raw SKILL.md: https://api.skillmd.com/api/skills/arbazkhan971/plan/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: arbazkhan971 (https://skillmd.com/u/arbazkhan971)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/arbazkhan971/plan

---


## Activate When
- `/godmode:plan`, "break down", "plan this"
- "create tasks", "what are the steps"
- `.godmode/spec.md` exists but no `.godmode/plan.yaml`

## Workflow

### 1. Read Context
```bash
cat .godmode/spec.md
git ls-files | head -200
find . -maxdepth 3 -type f \
  \( -name "*.ts" -o -name "*.py" -o -name "*.go" \) \
  | head -80
```
IF no spec: ask user or run `/godmode:think` first.

### 2. Identify Boundaries
- Data layer (models, schemas, migrations)
- API/service layer (routes, controllers, services)
- UI layer (components, pages, styles)
- Configuration (env, configs, infrastructure)
- Tests (unit, integration, e2e)

Priority: data -> API/service -> UI -> config -> tests.
NEVER mix layers in a single task unless < 10 lines.

### 3. Decompose into Tasks
```yaml
- id: "task-01"
  title: "Add user preferences schema"
  skill: "build"
  files:
    - src/models/preferences.ts
    - src/migrations/003_add_preferences.sql
  depends_on: []
  agent: true
  test: "npx vitest run src/models/..."
  done_when: "npx vitest run ... | grep 'passed'"
```
Rules:
- One responsibility per task
- `files[]` max 5 (more = split into subtasks)
- `done_when` = shell command exiting 0 (never prose)
- Max 2 tasks per file across entire plan

### 4. Build Dependency Graph
```
Round 1 (parallel): task-01, task-02 (no deps)
Round 2 (parallel): task-03, task-04 (depend on R1)
Round 3 (sequential): task-05 (depends on 03+04)
```
Topological sort. Max 5 tasks per round. Enforce:
- Data before API before UI
- Schema/type before implementation
- No circular dependencies
- Same-file tasks in different rounds

### 5. Validate Plan
```bash
python3 -c "import yaml; yaml.safe_load(
  open('.godmode/plan.yaml'))"
```
Checks: files exist or parent dir exists,
depends_on IDs valid (no cycles), no file overlap
within same round, max 2 tasks per file.

IF >20 tasks: split into phases.

### 6. Write Plan
```bash
git add .godmode/plan.yaml
git commit -m "plan: decompose {feature} into {N} tasks"
```

## Hard Rules
0. **Inherits Default Activations per `SKILL.md §14`.** Principles prelude, pre-commit audit, terse/stdio/tokens, DispatchContext validation, Progressive Disclosure routing, discard cost hierarchy all fire by default on every `/godmode:plan` invocation.
1. **Declare a coordination pattern on the first line of every plan.** Pick one of the 6 from `docs/coordination-patterns.md`: Pipeline, Fan-out/Fan-in, Expert Pool, Producer-Reviewer, Supervisor, Hierarchical Delegation. Plans without a declared pattern are invalid — the executor returns `BLOCKED: invalid_plan`. Example first line: `Pattern: Producer-Reviewer`.
2. EVERY task: `done_when` is shell command exiting 0.
3. Max 5 files per task.
4. No circular dependencies.
5. Same-round tasks: zero file overlap.
6. Commit plan to git, validate YAML before proceeding.

## TSV Logging
Append `.godmode/plan-log.tsv`:
```
timestamp	feature	total_tasks	total_rounds	total_files	max_parallelism
```

## Keep/Discard
```
KEEP if: YAML parses AND no circular deps
  AND no file overlaps AND all paths valid.
DISCARD if: validation fails on any check.
```

## Stop Conditions
```
STOP when FIRST of:
  - plan.yaml written, validated, committed
  - >20 tasks (split into phases)
  - Decomposition produces no new independent tasks
```

## Autonomous Operation
On failure: git reset --hard HEAD~1. Never pause.

<!-- tier-3 -->

## Error Recovery
| Failure | Action |
|--|--|
| No spec exists | Run /godmode:think first |
| YAML validation fails | Fix syntax, max 3 attempts |
| Circular dependency | Merge tasks or remove edge |
| File overlap in round | Move task to next round |
| >20 tasks | Split into phase-1 and phase-2 |

