AgentSkillsCN

decompose-plan

当开始执行计划时,可灵活运用此方法——将实施计划细分为 H2(任务)粒度的 Claude Code Task 工具任务,为每个计划任务创建单独的任务,并附上引用管理指令,使计划始终作为真实可靠的来源。

SKILL.md
--- frontmatter
name: decompose-plan
description: Use when starting plan execution to decompose implementation plans into Claude Code Task tool tasks at H2 (Task) granularity - creates one task per plan task with citation-manager directives, keeping plan as source of truth

Decompose Plan into Tasks

Overview

Parse implementation plan and create one Task tool task per H2 Task header. Tasks reference plan via citation-manager, keeping plan authoritative.

Core principle: Plan is source of truth. Tasks are pointers, not copies.

Announce at start: "I'm using the decompose-plan skill to create tasks from this plan."

When to Use

  • Before executing any implementation plan
  • When /executing-plans or similar workflow starts
  • When plan has ## Task N structure with ### Step sub-headers

The Process

Step 1: Parse Plan Structure

Use citation-manager to extract H2 headers (Tasks):

bash
citation-manager extract header "{plan_path}" "Task 1"

Each ## Task N becomes one Claude Code Task.

Step 2: Create One Task Per H2

For EACH ## Task N header, create a Task tool task:

typescript
TaskCreate({
  subject: "Task {N}: {task_title}",
  description: `Fetch task details:\n\`citation-manager extract header "${plan_path}" "Task {N} - {task_title}"\`\n\nPlan: ${plan_path}`,
  activeForm: "{task_title}"
})

Step 3: Set Dependencies

  • Task N+1 blocked by Task N (linear chain)
  • If plan specifies non-linear dependencies, follow plan

Task Description Template

markdown
Fetch task details:
`citation-manager extract header "{plan_path}" "Task N - {task_title}"`

Plan: {plan_path}

Why citation directive: Plan may be updated. Task fetches current content at execution time.

Granularity Rules

LevelWhat to CreateExample
## Task NONE TaskUnit of work with steps inside
### Step NPart of parent TaskExecuted within Task, not split
#### Sub-stepPart of parent StepDon't split further

Common Rationalizations (STOP These)

ExcuseReality
"I'll split into steps"Steps execute within their Task. One Task per H2.
"I'll copy content inline"Copies go stale. Citation directive fetches current content.
"Citation adds overhead"One command. Guarantees current content. Worth it.
"I need fewer tasks"One per H2 is the right granularity. Don't merge Tasks.

Red Flags - You're About to Violate

  • Creating 22 tasks for a plan with 6 Tasks (too granular)
  • Merging multiple ## Task into one task (too coarse)
  • Copying task content into descriptions
  • Ignoring dependency chain

Example Output

For a plan with 6 Tasks:

text
Task #1: Task 1: Create shared library lib/status-helpers.sh
Task #2: Task 2: Refactor task-status-sync.sh to use library  (blockedBy: #1)
Task #3: Task 3: Refactor stop-sync.sh to use library         (blockedBy: #2)
Task #4: Task 4: Enhance plan-path-sync.sh for multi-plan     (blockedBy: #3)
Task #5: Task 5: Create /set-plan slash command                (blockedBy: #4)
Task #6: Task 6: Verification                                 (blockedBy: #5)

Verification

After decomposition, verify:

bash
# Count tasks created
ls ~/.claude/tasks/{session_id}/*.json | wc -l
# Should match number of H2 Task headers in plan

Quick Reference

InputOutput
Plan with 6 ## Task6 tasks
Each task descriptionCitation directive to plan
DependenciesTask-to-task chain