SuperAPI AI Directory

tasks

Agents & models

View repository

Updated 10-16 01:16

About this skill

Multi-Agent Tasks v3.2.0

Plan decomposition → DAG validation → TDD mapping → Executable task list

Claude Code Tasks Integration

v3.2.0 supports the native Tasks API, enabling cross-session task collaboration

This Skill can use the Claude Code native Tasks system:

# 建立任務(自動生成 taskId)
TaskCreate({ subject: "實作登入功能", description: "..." })

# 設定依賴關係
TaskUpdate({ taskId: "2", addBlockedBy: ["1"] })
Cross-session sharing

export CLAUDE_CODE_TASK_LIST_ID=my-workflow


| API | 用途 |
|-----|------|
| `TaskCreate` | 建立任務 |
| `TaskUpdate` | 更新狀態、設定依賴(addBlockedBy) |
| `TaskList` | 列出所有任務 |
| `TaskGet` | 取得任務詳情 |

**優勢**:
- 跨 session 持久化
- 多 Agent 協作同一任務清單
- 自動依賴解除(完成時自動 unblock 下游任務)

## 使用方式

```bash
/multi-tasks [計劃路徑]
/multi-tasks .claude/memory/plans/user-auth/implementation-plan.md

Flags: --from-plan ID | --validate-only | --no-tdd-check

Default 4 perspectives

ID Name Model Focus
dependency-analyst Dependency Analyst sonnet Task dependencies, execution order
task-decomposer Task Decomposer haiku Granularity splitting, parallelism identification
test-planner Test Planner haiku TDD mapping, test strategy
risk-preventor Risk Preventer haiku Risk tasks, preventive measures

→ Model routing configuration:shared/config/model-routing.yaml

Execution Flow

Phase 0: 載入計劃 → 解析 implementation-plan.md
    ↓
Phase 1: MAP(並行分解)
    ┌──────────┬──────────┬──────────┬──────────┐
    │依賴分析師│任務分解師│測試規劃師│風險預防師│
    └──────────┴──────────┴──────────┴──────────┘

    ⚠️ **並行執行關鍵**:
       在單一訊息中發送 4 個 Task 工具呼叫:
       - Task({description: "依賴分析", ...})
       - Task({description: "任務分解", ...})
       - Task({description: "測試規劃", ...})
       - Task({description: "風險預防", ...})
       這樣才能真正並行執行!
    ↓
Phase 2: REDUCE(合併 + 排序)
    ↓
Phase 3: TDD 驗證 → 確保每個 T-F-* 有對應 TEST-*
    ↓
Phase 4: DAG 驗證 → 無循環、無孤立任務
    ↓
Phase 5: 依賴偵測 → 隱含依賴分析
    ↓
Phase 6: 品質閘門 → 輸出 tasks.yaml

TDD Enforcement

Prerequisites (BLOCKER):

  • All T-F-* tasks must have corresponding TEST-* tasks
  • TEST-* tasks must block the corresponding T-F-* tasks

Validation script:shared/tools/tdd-validator.sh

→ Configuration:shared/quality/tdd-enforcement.yaml

Dependency Detection

Four-layer dependency analysis:

  1. L1_explicit: Explicitly declared dependencies
  2. L2_file_overlap: Tasks that modify the same files
  3. L3_semantic: Semantic data flow dependencies
  4. L4_environment: Runtime environment dependencies

Validation script:shared/tools/dag-validator.py

→ Configuration:shared/tasks/dependency-detection.yaml

CP4: Task Commit

After the quality gate passes,CP4 Task Commit must be executed。

Phase 6: 品質閘門 → 輸出 tasks.yaml
    ↓
CP4: Task Commit
    ├── git add .claude/memory/tasks/{plan-id}/
    └── git commit -m "feat(tasks): decompose {plan} into executable tasks"

→ Protocol:shared/git/commit-protocol.md

Quality Gate

Pass conditions (TASKS phase):

  • ✅ DAG validation passed (no cycles)
  • ✅ TDD mapping complete
  • ✅ All tasks have estimates
  • ✅ Quality score ≥ 80

→ Gate configuration:shared/quality/gates.yaml

Output Structure

.claude/memory/tasks/[plan-id]/
├── meta.yaml               # 元數據
├── perspectives/           # 完整視角分析(MAP 產出,保留)
│   ├── dependency-analyst.md
│   ├── task-decomposer.md
│   ├── test-planner.md
│   └── risk-preventor.md
├── summaries/              # 結構化摘要(REDUCE 產出,供快速查閱)
│   ├── dependency-analyst.yaml
│   ├── task-decomposer.yaml
│   ├── test-planner.yaml
│   └── risk-preventor.yaml
└── tasks.yaml              # 任務清單(主輸出)

⚠️ perspectives/ stores the complete analysis, summaries/ stores structured summaries, and tasks.yaml is the final executable task list.

Agent Capability Restrictions

Perspective Agents should not open Tasks:

Allowed Operations Description
✅ Read Read files
✅ Glob/Grep Search files and content
✅ Explore agent Lightweight exploration
✅ Bash Execute commands
✅ Write Write reports
❌ Task Spawn sub-agents

tasks.yaml format

version: "1.0"
plan_ref: "plans/user-auth"
waves:
  - id: wave-1
    tasks:
      - id: TEST-001
        type: test
        description: "登入功能測試"
        estimate: 15
      - id: T-F-001
        type: feature
        description: "實作登入功能"
        depends_on: [TEST-001]
        estimate: 30
        files: [src/auth/login.ts]

Action Log

After each tool call completes, record to .claude/workflow/{workflow-id}/logs/actions.jsonl。

Recording Timing:

  • Success: record tool、input、output_preview、duration_ms、status: success
  • Failure: record tool、input、error、stderr(if any),status: failed

Key Actions (TASKS phase):

Action Recording Focus
Read (read plan) file_path、output_size
Task (launch Agent) subagent_type、prompt (truncated)、agent_id
Bash (execute DAG validation) command、exit_code、stderr
Write (write tasks.yaml) file_path、content_size

Troubleshooting:

# 查看 TASKS 階段所有失敗行動
jq 'select(.stage == "TASKS" and .status == "failed")' actions.jsonl

# 查看 DAG 驗證失敗的詳情
jq 'select(.tool == "Bash" and .status == "failed")' actions.jsonl | jq '{command: .input.command, error: .error, stderr: .stderr}'

→ Log specification:shared/communication/execution-logs.md

Shared Modules

Module Purpose
coordination/map-phase.md Parallel coordination
coordination/reduce-phase.md Aggregation and integration, large file processing
quality/tdd-enforcement.yaml TDD enforcement
tasks/dependency-detection.yaml Dependency detection
quality/gates.yaml Quality Gate
tools/dag-validator.py DAG Validator

Workflow Location

RESEARCH → PLAN → TASKS → IMPLEMENT → REVIEW → VERIFY
                    ↑
                 你在這裡
  • Input:implementation-plan.md from plan skill
  • Output:tasks.yaml for implement skill use