Claude-Code-Workflow team-lifecycle-v4
Full lifecycle team skill with clean architecture. SKILL.md is a universal router — all roles read it. Beat model is coordinator-only. Structure is roles/ + specs/ + templates/. Triggers on "team lifecycle v4".
git clone https://github.com/catlog22/Claude-Code-Workflow
T=$(mktemp -d) && git clone --depth=1 https://github.com/catlog22/Claude-Code-Workflow "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.codex/skills/team-lifecycle-v4" ~/.claude/skills/catlog22-claude-code-workflow-team-lifecycle-v4-d0f3db && rm -rf "$T"
.codex/skills/team-lifecycle-v4/SKILL.mdTeam Lifecycle v4
Orchestrate multi-agent software development: specification -> planning -> implementation -> testing -> review.
Architecture
Skill(skill="team-lifecycle-v4", args="task description") | SKILL.md (this file) = Router | +--------------+--------------+ | | no --role flag --role <name> | | Coordinator Worker roles/coordinator/role.md roles/<name>/role.md | +-- analyze -> dispatch -> spawn -> wait -> collect | +--------+---+--------+ v v v spawn_agent ... spawn_agent (team_worker) (team_supervisor) per-task resident agent lifecycle followup_task-driven | | +-- wait_agent --------+ | collect results
Role Registry
| Role | Path | Prefix | Inner Loop |
|---|---|---|---|
| coordinator | roles/coordinator/role.md | -- | -- |
| analyst | roles/analyst/role.md | RESEARCH-* | false |
| writer | roles/writer/role.md | DRAFT-* | true |
| planner | roles/planner/role.md | PLAN-* | true |
| executor | roles/executor/role.md | IMPL-* | true |
| tester | roles/tester/role.md | TEST-* | false |
| reviewer | roles/reviewer/role.md | REVIEW-, QUALITY-, IMPROVE-* | false |
| supervisor | roles/supervisor/role.md | CHECKPOINT-* | false |
Role Router
Parse
$ARGUMENTS:
- Has
-> Read--role <name>
, execute Phase 2-4roles/<name>/role.md - No
->--role
, execute entry routerroles/coordinator/role.md
Delegation Lock
Coordinator is a PURE ORCHESTRATOR. It coordinates, it does NOT do.
Before calling ANY tool, apply this check:
| Tool Call | Verdict | Reason |
|---|---|---|
, , , , | ALLOWED | Orchestration |
| ALLOWED | Agent health check |
| ALLOWED | User interaction |
| ALLOWED | Message bus |
on files | ALLOWED | Session state |
on , , , | ALLOWED | Loading own instructions |
on project source code | BLOCKED | Delegate to worker |
on any file outside | BLOCKED | Delegate to worker |
| BLOCKED | Only workers call CLI |
running build/test/lint commands | BLOCKED | Delegate to worker |
If a tool call is BLOCKED: STOP. Create a task, spawn a worker.
No exceptions for "simple" tasks. Even a single-file read-and-report MUST go through spawn_agent.
Shared Constants
- Session prefix:
TLV4 - Session path:
.workflow/.team/TLV4-<date>-<slug>/ - State file:
<session>/tasks.json - Discovery files:
<session>/discoveries/{task_id}.json - CLI tools:
(read-only),ccw cli --mode analysis
(modifications)ccw cli --mode write
Worker Spawn Template
Coordinator spawns workers using this template:
spawn_agent({ agent_type: "team_worker", task_name: "<task-id>", fork_turns: "none", message: `## Role Assignment role: <role> role_spec: <skill_root>/roles/<role>/role.md session: <session-folder> session_id: <session-id> requirement: <task-description> inner_loop: <true|false> Read role_spec file (<skill_root>/roles/<role>/role.md) to load Phase 2-4 domain instructions. Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report). ## Task Context task_id: <task-id> title: <task-title> description: <task-description> pipeline_phase: <pipeline-phase> ## Upstream Context <prev_context>` })
Supervisor Spawn Template
Supervisor is a resident agent (independent from team_worker). Spawned once during session init, woken via followup_task for each CHECKPOINT task.
Spawn (Phase 2 -- once per session)
supervisorId = spawn_agent({ agent_type: "team_supervisor", task_name: "supervisor", fork_turns: "none", message: `## Role Assignment role: supervisor role_spec: <skill_root>/roles/supervisor/role.md session: <session-folder> session_id: <session-id> requirement: <task-description> Read role_spec file (<skill_root>/roles/supervisor/role.md) to load checkpoint definitions. Init: load baseline context, report ready, go idle. Wake cycle: orchestrator sends checkpoint requests via followup_task.` })
Wake (per CHECKPOINT task)
followup_task({ target: "supervisor", message: `## Checkpoint Request task_id: <CHECKPOINT-NNN> scope: [<upstream-task-ids>] pipeline_progress: <done>/<total> tasks completed` }) wait_agent({ timeout_ms: 1800000 }) // 30 min — apply timeout cascade if timed_out
Shutdown (pipeline complete)
close_agent({ target: "supervisor" })
Model Selection Guide
| Role | model | reasoning_effort | Rationale |
|---|---|---|---|
| Analyst (RESEARCH-*) | (default) | medium | Read-heavy exploration, less reasoning needed |
| Writer (DRAFT-*) | (default) | high | Spec writing requires precision and completeness |
| Planner (PLAN-*) | (default) | high | Architecture decisions need full reasoning |
| Executor (IMPL-*) | (default) | high | Code generation needs precision |
| Tester (TEST-*) | (default) | high | Test generation requires deep code understanding |
| Reviewer (REVIEW-, QUALITY-, IMPROVE-*) | (default) | high | Deep analysis for quality assessment |
| Supervisor (CHECKPOINT-*) | (default) | medium | Gate checking, report aggregation |
Override model/reasoning_effort in spawn_agent when cost optimization is needed:
spawn_agent({ agent_type: "team_worker", task_name: "<task-id>", fork_turns: "none", model: "<model-override>", reasoning_effort: "<effort-level>", message: "..." })
Wave Execution Engine
For each wave in the pipeline:
- Load state -- Read
, filter tasks for current wave<session>/tasks.json - Skip failed deps -- Mark tasks whose dependencies failed/skipped as
skipped - Build upstream context -- For each task, gather findings from
tasks via tasks.json andcontext_fromdiscoveries/{id}.json - Separate task types -- Split into regular tasks and CHECKPOINT tasks
- Spawn regular tasks -- For each regular task, call
, collect agent IDsspawn_agent({ agent_type: "team_worker", message: "..." }) - Wait --
— apply timeout cascade if timed_outwait_agent({ timeout_ms: 1800000 }) - Collect results -- Read
for each agent, update tasks.json status/findings/error, thendiscoveries/{task_id}.json
each workerclose_agent({ target }) - Execute checkpoints -- For each CHECKPOINT task,
to supervisor,followup_task
, read checkpoint report fromwait_agent
, parse verdictartifacts/ - Handle block -- If verdict is
, prompt user viablock
with options: Override / Revise upstream / Abortrequest_user_input - Persist -- Write updated state to
<session>/tasks.json
User Commands
| Command | Action |
|---|---|
/ | View execution status graph |
/ | Advance to next step |
| Revise specific task |
| Inject feedback for revision |
| Re-run quality check |
| Auto-improve weakest dimension |
v4 Agent Coordination
Message Semantics
| Intent | API | Example |
|---|---|---|
| Queue supplementary info (don't interrupt) | | Send planning results to running implementers |
| Wake resident supervisor for checkpoint | | Trigger CHECKPOINT-* evaluation on supervisor |
| Supervisor reports back to coordinator | | Supervisor sends checkpoint verdict as supplementary info |
| Check running agents | | Verify agent + supervisor health during resume |
CRITICAL: The supervisor is a resident agent woken via
followup_task, NOT send_message. Regular workers complete and are closed; the supervisor persists across checkpoints. See "Supervisor Spawn Template" above.
Agent Health Check
Use
list_agents({}) in handleResume and handleComplete:
// Reconcile session state with actual running agents const running = list_agents({}) // Compare with tasks.json active_agents // Reset orphaned tasks (in_progress but agent gone) to pending // ALSO check supervisor: if supervisor missing but CHECKPOINT tasks pending -> respawn
Named Agent Targeting
Workers are spawned with
task_name: "<task-id>" enabling direct addressing:
-- queue planning context to running implementersend_message({ target: "IMPL-001", message: "..." })
-- wake supervisor for checkpointfollowup_task({ target: "supervisor", message: "..." })
-- cleanup regular worker by nameclose_agent({ target: "IMPL-001" })
-- shutdown supervisor at pipeline endclose_agent({ target: "supervisor" })
Completion Action
When pipeline completes, coordinator presents:
functions.request_user_input({ questions: [{ question: "Pipeline complete. What would you like to do?", header: "Completion", multiSelect: false, options: [ { label: "Archive & Clean (Recommended)", description: "Archive session, clean up resources" }, { label: "Keep Active", description: "Keep session for follow-up work" }, { label: "Export Results", description: "Export deliverables to target directory" } ] }] })
Specs Reference
- specs/pipelines.md -- Pipeline definitions and task registry
- specs/quality-gates.md -- Quality gate criteria and scoring
- specs/knowledge-transfer.md -- Artifact and state transfer protocols
Session Directory
.workflow/.team/TLV4-<date>-<slug>/ ├── tasks.json # Task state (JSON) ├── discoveries/ # Per-task findings ({task_id}.json) ├── spec/ # Spec phase outputs ├── plan/ # Implementation plan ├── artifacts/ # All deliverables ├── wisdom/ # Cross-task knowledge ├── explorations/ # Shared explore cache └── discussions/ # Discuss round records
Error Handling
| Scenario | Resolution |
|---|---|
| Unknown command | Error with available command list |
| Role not found | Error with role registry |
| CLI tool fails | Worker fallback to direct implementation |
| Supervisor crash | Respawn with , auto-rebuilds from existing reports |
| Supervisor not ready for CHECKPOINT | Spawn/respawn supervisor, wait for ready, then wake |
| Completion action fails | Default to Keep Active |
| Worker timeout | Mark task as failed, continue wave |
| Discovery file missing | Mark task as failed with "No discovery file produced" |