SuperAPI AI Directory

implement

Agents & models

View repository

Updated 10-16 06:48

About this skill

Multi-Agent Implement v3.0.0

TDD Gate → Parallel Implementation → Real-time Review → Quality Guardian

Usage

/multi-implement [任務路徑]
/multi-implement .claude/memory/tasks/user-auth/tasks.yaml

Flags: --from-tasks ID | --skip-tdd-check | --parallel N

Role Configuration

ID Name Model Focus
main_agent Main Implementer sonnet Feature Implementation
tdd-enforcer TDD Guardian haiku Test-First Check
security-auditor Security Auditor sonnet Security Vulnerability Detection
maintainer Maintainability Review haiku Code Quality

→ Model Routing Configuration:shared/config/model-routing.yaml

Execution Flow

Phase 0: 載入任務 → 解析 tasks.yaml、排序 waves
    ↓
For each task in waves:
    ↓
    Phase 1: TDD 閘門(PRE-TASK)
    ├── 測試檔案存在?
    ├── 測試可執行?
    └── ❌ 失敗 → BLOCKER,無法繼續
    ↓
    Phase 2: 並行實作 + 審查
    ┌──────────┬──────────┬──────────┐
    │ 主實作者 │安全審計員│可維護性  │
    └──────────┴──────────┴──────────┘
    ↓
    Phase 3: TDD 閘門(POST-TASK)
    ├── 測試通過?
    └── 覆蓋率達標?
    ↓
    Phase 4: 自我審查 + 提交
    ↓
End for
    ↓
Phase 5: 品質閘門 → 整體驗證

TDD Mandatory Gate

Pre-Task Gate(BLOCKER):

  • Test files must exist
  • Tests must be executable (even if failing)

Post-Task Gate(BLOCKER):

  • Tests must pass
  • Coverage ≥ 80%

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

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

Security Audit

Use OWASP Top 10 and CWE Top 25 frameworks:

  • SQL Injection
  • XSS
  • Authentication/Authorization Issues
  • Sensitive Data Handling

→ Framework:shared/perspectives/expertise-frameworks/security.yaml

CP4: Task Commit

After each task is completedCP4 Task Commit (incremental commit) must be executed.

Phase 4: 自我審查 + 提交
    ↓
CP4: Task Commit(每個 task)
    ├── git add {changed_files}
    ├── git add .claude/memory/implement/{id}/task-results/{task-id}.yaml
    └── git commit -m "feat(implement): complete {task-id} - {description}"

Note: The implement skill's CP4 is incrementally triggered, committing after each task is completed to ensure progress is not lost.

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

Quality Gate

Pass Conditions (IMPLEMENT phase):

  • ✅ All tasks completed
  • ✅ Tests pass
  • ✅ No BLOCKER issues
  • ✅ Quality score ≥ 80

→ Gate Configuration:shared/quality/gates.yaml

Output Structure

.claude/memory/implement/[tasks-id]/
├── meta.yaml               # 元數據
├── perspectives/           # 角色分析報告(並行審查產出,保留)
│   ├── security-auditor.md     # 安全審計完整報告
│   └── maintainer.md           # 可維護性完整報告
├── summaries/              # 結構化摘要(供快速查閱)
│   ├── security-auditor.yaml
│   └── maintainer.yaml
├── task-results/           # 每個任務的結果
│   ├── T-F-001.yaml
│   └── T-F-002.yaml
├── security-report.md      # 安全審計報告(匯總)
├── coverage-report.md      # 覆蓋率報告
└── summary.md              # 實作摘要(主輸出)

⚠️ perspectives/ stores complete role analyses, summaries/ stores structured summaries.

Agent Capability Limits

Review Agents should not open Tasks:

Allowed Operations Description
✅ Read Read code
✅ Glob/Grep Search files and content
✅ Bash Run tests
✅ Write Write reports
❌ Task Spawn sub-agents

Action Log

After each tool call is completed, log to .claude/workflow/{workflow-id}/logs/actions.jsonl。

Logging Timing:

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

Key Actions (IMPLEMENT phase):

Action Logging Focus
Read (read existing code) file_path、output_size
Edit (modify code) file_path、old_string (truncated)、new_string (truncated)
Write (create new file) file_path、content_size
Bash (run tests) command、exit_code、stdout、stderr
Task (launch review Agent) subagent_type、prompt (truncated)、agent_id

Troubleshooting:

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

# 查看測試失敗的詳情
jq 'select(.tool == "Bash" and .input.command | contains("test"))' actions.jsonl | jq '{command: .input.command, exit_code: .exit_code, stderr: .stderr}'

# 查看 Edit 操作失敗(找不到 old_string)
jq 'select(.tool == "Edit" and .status == "failed")' actions.jsonl

→ Logging Specification:shared/communication/execution-logs.md

Shared Modules

Module Purpose
coordination/map-phase.md Parallel Coordination
quality/tdd-enforcement.yaml TDD Enforcement
quality/gates.yaml Quality Gate
perspectives/expertise-frameworks/security.yaml Security Framework
tools/tdd-validator.sh TDD Validator

Workflow Position

RESEARCH → PLAN → TASKS → IMPLEMENT → REVIEW → VERIFY
                              ↑
                           你在這裡
  • Input:tasks.yaml from tasks skill
  • Output: implemented code, for review skill review