agentleFS
BhavinMBhavinM/my-claude-setup/.claude/skills/implement/SKILL.md

implement

Skill0 starsChanged 10 months agoMITView on GitHub

Implement phases from a plan. Acts as thin dispatcher: spawns builder agents per phase, validators to verify, handles PASS/FAIL routing. Builders are ephemeral — each phase gets a fresh builder with clean context. Use when ready to implement ('implement the next phase', 'start building', 'run the implementation'). Do NOT use for creating plans (use /create-plan) or reviewing plans (use /review-plan).

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use setup-ts-deep-modules, ask-matt and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • loulanyueSkill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 17 projects that use this

  • AWSSkill

    ask-matt

    Ask which skill or flow fits your situation. A router over the skills in this repo.

    Also in 36 projects that use this

  • AWSSkill

    to-spec

    Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.

    Also in 75 projects that use this

  • ArvorCoSkill

    specify

    Create feature specification from natural language description. Use when starting a new feature or creating a spec. Triggers on: create spec, specify feature, new feature spec.

    Also in 12 projects that use this

  • qwlabsSkill

    claude-handoff

    Hand the current conversation off to a fresh background agent that picks up the work immediately.

    Also in 18 projects that use this

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 22 projects that use this

  • +5 more from aws

The file

Show its rules and text

We split this skill into the rules it gives an agent

38 rules. 0 are common, 20 are distinctive, and 18 are very specific to this project.

  • 0

    Common

    Most of the 175 edited versions we read keep these.

  • 20

    Distinctive

    This author's own choices. Worth a look.

  • 18

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the plan file at $ARGUMENTS/plan.md

    line 32
  2. Very specific:

    Check if $ARGUMENTS/reviews/planning/plan.md exists

    line 33
  3. Very specific:

    If no review exists, run /review-plan $ARGUMENTS first

    line 34
  4. Very specific:

    If Yes → proceed to Step 2

    line 37
  5. Very specific:

    If No → STOP and report the Critical Issues to the user

    line 38
  6. Distinctive:

    2. Skip for small plans: If 1-2 phases, skip to Step 3.

    line 46
  7. Very specific:

    3. Check if audit exists: Look for $ARGUMENTS/reviews/planning/flow-audit.md.

    line 48
  8. Very specific:

    4. If missing: STOP and tell the user to run /audit-plan $ARGUMENTS first.

    line 50
  9. Very specific:

    Run TaskList first. If tasks already exist from a previous session or before a context compact:

    line 64
  10. Very specific:

    Read existing tasks with TaskGet for each task ID

    line 65
  11. Very specific:

    If any task is in_progress — that's where you were interrupted.

    line 66
  12. Distinctive:

    Do NOT recreate the task list — resume with existing tasks

    line 67
  13. Distinctive:

    Read the Phase Table in plan.md.

    line 71
  14. Distinctive:

    If all phases are done:

    line 73
  15. Very specific:

    Remove the plan's sidecar: rm -f ~/.cache/claude-statusline/plans/PLAN_NAME.json

    line 74
  16. Distinctive:

    If no tasks exist yet, create one task per pending phase:

    line 80
  17. Distinctive:

    All dependencies have status "Done" → unblocked

    line 103
  18. Distinctive:

    After identifying unblocked phases, write a per-plan sidecar file using the lowest-numbered unblocked phase so the statusline displays …

    line 110
  19. Very specific:

    Before spawning builders, gate-check each unblocked phase from Step 3.

    line 129
  20. Very specific:

    If non-zero exit, the phase contains [To be detailed] or TBD.

    line 144
  21. Very specific:

    If no review exists, run /review-plan $ARGUMENTS phase {NN}

    line 149
  22. Distinctive:

    If only one phase is unblocked, spawn a single builder — this is the common case for phases with sequential dependencies.

    line 205
  23. Distinctive:

    Wait for builder completion messages (automatic delivery — do NOT poll).

    line 209
  24. Distinctive:

    When a builder reports done:

    line 211
  25. Very specific:

    Update phase YAML frontmatter: status: done

    line 240
  26. Distinctive:

    Update Phase Table in plan.md: status → "Done"

    line 241
  27. Distinctive:

    If other builders/validators are still active, continue waiting for their completions (Step 7)

    line 246
  28. Distinctive:

    When all active builders are done, loop back to Step 3 — newly completed phases may unblock additional pending phases

    line 247
  29. Distinctive:

    Wait for fix builder → spawn fresh validator → re-validate → repeat until PASS

    line 274
  30. Distinctive:

    When all phases are done OR an error breakout condition is met:

    line 278
  31. Distinctive:

    Do not proceed to the next phase when blocked.

    line 303
  32. Distinctive:

    If you notice context was compacted or you're unsure of current progress:

    line 309
  33. Very specific:

    Run TaskList to see all tasks and their status

    line 311
  34. Very specific:

    Run TaskGet {id} on that task to read full details

    line 313
  35. Distinctive:

    Read plan.md to get the Phase Table for broader context

    line 314
  36. Very specific:

    Check if team exists: read ~/.claude/teams/{plan-name}-impl/config.json

    line 315
  37. Distinctive:

    If team exists, teammates are still active — coordinate via messages

    line 316
  38. Distinctive:

    If no team, re-create it (Step 5) — validators are spawned on-demand in Step 7

    line 317

“Common” is measured: kept by at least 6 in 10 of the 175 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Implement Plan

Implement phases from: $ARGUMENTS/plan.md

Architecture

This skill is a thin dispatcher. It does NOT read references, extract patterns, or implement code. Builders handle all implementation work via the preloaded builder-workflow skill.

RoleResponsibility
Orchestrator (you)Find phases, gate checks, spawn/shutdown teammates, route PASS/FAIL
BuilderPhase implementation: read phase, find references, invoke skills, code, test, typecheck. Does NOT review its own code.
ValidatorIndependent review: runs /code-review (reference-grounded, with auto-fix), then typecheck + tests. Reports PASS/FAIL.

Builders and validators are ephemeral. Each phase gets a fresh builder with a clean 200K context. When a builder completes, a fresh validator is spawned for that phase's review. After the review cycle completes (PASS or FAIL resolution), both are shut down. This prevents context contamination between phases, ensures skill instructions are never compacted away, and eliminates the single-validator bottleneck when multiple builders run in parallel.


Step 1: Read and Review the Plan

  1. Read the plan file at $ARGUMENTS/plan.md
  2. Check if $ARGUMENTS/reviews/planning/plan.md exists
  3. If no review exists, run /review-plan $ARGUMENTS first
  4. Read the review file at $ARGUMENTS/reviews/planning/plan.md
  5. Check the Verdict section:
    • If Yes → proceed to Step 2
    • If No → STOP and report the Critical Issues to the user

Proceeding with implementation when the plan review verdict is "No" means building on a plan with structural gaps — the user will discover these during implementation when they're more costly to fix.

Step 2: Check Flow Audit

1. Count phases in the Phase Table.

2. Skip for small plans: If 1-2 phases, skip to Step 3.

3. Check if audit exists: Look for $ARGUMENTS/reviews/planning/flow-audit.md. This should already exist from /create-plan (Step 10).

4. If missing: STOP and tell the user to run /audit-plan $ARGUMENTS first. The orchestrator should not run the audit itself — it consumes too much context for a thin dispatcher.

5. Gate logic:

Overall AssessmentBehavior
"Major Restructuring Needed"HARD BLOCK: STOP. Report issues to user.
"Significant Issues"SOFT BLOCK: WARN user. Ask whether to proceed or fix.
"Minor Issues" or "Coherent"PROCEED.

Step 3: Find Unblocked Phases

3a: Check for existing tasks (compact recovery):

Run TaskList first. If tasks already exist from a previous session or before a context compact:

  1. Read existing tasks with TaskGet for each task ID
  2. If any task is in_progress — that's where you were interrupted. Resume from that phase's current state (check if a builder/validator is active)
  3. Do NOT recreate the task list — resume with existing tasks

3b: Read the Phase Table:

Read the Phase Table in plan.md. Collect all phases with status "Pending".

If all phases are done:

  1. Remove the plan's sidecar: rm -f ~/.cache/claude-statusline/plans/PLAN_NAME.json
  2. Report completion to the user
  3. Skip to Step 9 (cleanup)

3c: Create orchestrator tasks (first run only):

If no tasks exist yet, create one task per pending phase:

TaskCreate({
  subject: "Phase {NN} — {phase title}",
  description: "Gate check → build → validate → mark done\nPhase: $ARGUMENTS/phase-{NN}-{slug}.md",
  activeForm: "Implementing Phase {NN}"
})

Then set up dependencies with TaskUpdate using addBlockedBy to mirror each phase's dependencies frontmatter. For example, if Phase 03 depends on Phase 01:

TaskUpdate({ taskId: "3", addBlockedBy: ["1"] })

Tasks survive context compacts and give the user progress visibility. Without them, the orchestrator loses track of which phases are in flight after a compact.

3d: Determine which pending phases are unblocked:

For each pending phase, read its frontmatter dependencies field:

  • dependencies: [] (empty) → unblocked — no prerequisites
  • dependencies: [Phase 01, Phase 03] → check the Phase Table for each listed dependency
    • All dependencies have status "Done" → unblocked
    • Any dependency is not "Done" → blocked — skip for now

Collect all unblocked phases. These are the candidates for gate-checking (Step 4) and builder spawning (Step 6).

Update the statusline sidecar:

After identifying unblocked phases, write a per-plan sidecar file using the lowest-numbered unblocked phase so the statusline displays current progress. Each plan gets its own file — multiple agents on different plans won't overwrite each other:

mkdir -p ~/.cache/claude-statusline/plans && echo '{"plan":"PLAN_NAME","phase":PHASE_NUM,"updated":'$(date +%s)'}' > ~/.cache/claude-statusline/plans/PLAN_NAME.json

Where:

  • PLAN_NAME = the plan folder name (from $ARGUMENTS, e.g., notes from plans/notes)
  • PHASE_NUM = the current phase number (from the phase's frontmatter number field or phase filename)

Example: If implementing phase 3 of the "notes" plan, run:

mkdir -p ~/.cache/claude-statusline/plans && echo '{"plan":"notes","phase":3,"updated":'$(date +%s)'}' > ~/.cache/claude-statusline/plans/notes.json

This makes the statusline display: notes - Phase 3

Step 4: Gate Check Phases

Before spawning builders, gate-check each unblocked phase from Step 3. Mark each phase task as in_progress before gate-checking:

TaskUpdate({ taskId: "{phase-task-id}", status: "in_progress" })

Apply 4a and 4b to each phase individually.

4a: Check for skeleton/placeholder content:

echo '{"cwd":"."}' | uv run $CLAUDE_PROJECT_DIR/.claude/hooks/validators/validate_no_placeholders.py \
  --directory $ARGUMENTS --extension .md

If non-zero exit, the phase contains [To be detailed] or TBD. STOP — do not spawn a builder for a skeleton phase.

4b: Verify the phase review:

  1. Check if $ARGUMENTS/reviews/planning/phase-{NN}.md exists
  2. If no review exists, run /review-plan $ARGUMENTS phase {NN}
  3. Read the review Verdict:
    • Ready: Yes → proceed to Step 5
    • Ready: No or Critical/High issues → FIX the phase first, re-run review, then proceed

Step 5: Create Team (First Phase Only)

On the first phase, create the team. Reuse it across phases.

TeamCreate({
  team_name: "{plan-name}-impl",
  description: "Implementation team for {plan title}"
})

Validators are spawned on-demand per phase (see Step 7). Unlike the builder (spawned here in Step 6), validators are created when a builder reports completion. This eliminates the single-validator bottleneck — when multiple builders finish in parallel, each gets its own validator reviewing concurrently.

Step 6: Spawn Builders

Spawn a fresh builder for each unblocked phase that passed gate-checking. Use parallel Task calls to launch multiple builders concurrently — max 2-3 at a time to avoid context pressure from simultaneous completion messages.

// Spawn builders for ALL unblocked phases in parallel:
Task({
  description: "Implement phase {NN}",
  subagent_type: "builder",
  model: "opus",
  team_name: "{plan-name}-impl",
  name: "builder-1",
  mode: "bypassPermissions",
  prompt: `Implement the phase at: $ARGUMENTS/phase-{NN}-{slug}.md
Plan folder: $ARGUMENTS

Follow your preloaded builder-workflow skill. It teaches you how to:
1. Read the phase and extract requirements
2. Find reference files and invoke domain skills
3. Create internal tasks (TaskCreate) for each step — prefix with [Step]. This is REQUIRED for context compact recovery
4. Implement with TDD (Step 0 first), marking tasks in_progress/completed as you go
5. Run tests and typecheck
6. Report completion to team-lead (do NOT run /code-review — the validator handles that independently)

IMPORTANT: Before using the Write tool on any existing file, you MUST Read it first or the write will silently fail.`
})

Task({
  description: "Implement phase {MM}",
  subagent_type: "builder",
  ...same structure...,
  name: "builder-2",
  prompt: `Implement the phase at: $ARGUMENTS/phase-{MM}-{slug}.md ...`
})

Each builder gets a fresh context, a unique name (builder-1, builder-2, etc.), and works independently. The builder-workflow skill is preloaded via the builder agent's skills: field.

If only one phase is unblocked, spawn a single builder — this is the common case for phases with sequential dependencies.

Step 7: Wait and Route

Wait for builder completion messages (automatic delivery — do NOT poll). When multiple builders are active, process each completion as it arrives.

When a builder reports done:

  1. Spawn a fresh validator for this phase:
Task({
  description: "Validate phase {NN}",
  subagent_type: "validator",
  team_name: "{plan-name}-impl",
  name: "validator-{N}",
  mode: "bypassPermissions",
  prompt: `Validate phase {NN} on the {plan-name}-impl team. Follow the workflow defined in your agent instructions.

Phase file: $ARGUMENTS/phase-{NN}-{slug}.md
Plan folder: $ARGUMENTS

Run /code-review against the phase file, then verify with typecheck + tests. Report PASS/FAIL to team-lead via SendMessage.`
})

Each validator gets a unique name matching its builder (validator-1 for builder-1, validator-2 for builder-2, etc.). Multiple validators can run concurrently — do NOT wait for one validator to finish before spawning another.

  1. Continue processing other builder completions as they arrive. If another builder completes while a validator is already running, spawn another validator immediately.
  2. Wait for validator verdicts. Each validator runs comprehensive code review (reference-grounded, with auto-fix) and verification independently. This is the independent review — the builder never reviewed its own code.

Step 8: Handle Verdict

PASS:

  1. Update phase YAML frontmatter: status: done
  2. Update Phase Table in plan.md: status → "Done"
  3. Mark the phase task as completed: TaskUpdate({ taskId: "{phase-task-id}", status: "completed" })
  4. Shutdown the builder and validator for this phase:
    • SendMessage({ type: "shutdown_request", recipient: "builder-N" })
    • SendMessage({ type: "shutdown_request", recipient: "validator-N" })
  5. If other builders/validators are still active, continue waiting for their completions (Step 7)
  6. When all active builders are done, loop back to Step 3 — newly completed phases may unblock additional pending phases

FAIL:

  1. Shutdown the current builder AND validator (both contexts may be stale):
    • SendMessage({ type: "shutdown_request", recipient: "builder-N" })
    • SendMessage({ type: "shutdown_request", recipient: "validator-N" })
  2. Spawn a fresh builder with the validator's fix instructions:
Task({
  description: "Fix phase {NN} issues",
  subagent_type: "builder",
  model: "opus",
  team_name: "{plan-name}-impl",
  name: "builder-1",
  mode: "bypassPermissions",
  prompt: `Fix the issues found by the validator in phase $ARGUMENTS/phase-{NN}-{slug}.md:

[paste validator's FAIL details here]

After fixing:
1. Run pnpm test — all must pass
2. Run pnpm run typecheck — no errors
3. Report completion to team-lead`
})
  1. Wait for fix builder → spawn fresh validator → re-validate → repeat until PASS

Step 9: Cleanup

When all phases are done OR an error breakout condition is met:

  1. Shutdown all active teammates (builders and validators still running):
// For each active builder-N and validator-N:
SendMessage({ type: "shutdown_request", recipient: "builder-1" })
SendMessage({ type: "shutdown_request", recipient: "validator-1" })
// ... repeat for all active agents
  1. Delete team: TeamDelete()
  2. Remove this plan's statusline sidecar:
rm -f ~/.cache/claude-statusline/plans/PLAN_NAME.json

Error breakout conditions — STOP and shut down if:

  • Validator FAIL repeats 3+ times on the same phase
  • Tests can't be fixed (cascading failures)
  • Phase has Critical blocking issues from plan review
  • User intervention is clearly needed

Do not proceed to the next phase when blocked. Shut down and let the user decide.


Resuming After Context Compact

If you notice context was compacted or you're unsure of current progress:

  1. Run TaskList to see all tasks and their status
  2. Find the in_progress task — that's the phase you were working on
  3. Run TaskGet {id} on that task to read full details
  4. Read plan.md to get the Phase Table for broader context
  5. Check if team exists: read ~/.claude/teams/{plan-name}-impl/config.json
    • If team exists, teammates are still active — coordinate via messages
    • If no team, re-create it (Step 5) — validators are spawned on-demand in Step 7
  6. Continue from the in_progress phase — don't restart from Step 1

Pattern for every work cycle:

TaskList → find in_progress or first pending → TaskGet → continue work → TaskUpdate (completed) → next task

Tasks are the orchestrator's source of truth for progress — not memory, not plan.md alone.


Reference Material

For anti-pattern prevention, context compact recovery, and troubleshooting, see references/team-operations.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.