Use when ready to implement a feature — 7-phase implementation flow with mode detection, execution, code simplification, self-check, adversarial review, and finding resolution
Implementation flow that handles both spec-driven (Mode A) and direct instruction (Mode B) development. Uses a controller pattern where the main agent orchestrates fresh subagents for each task — implementing, simplifying, and reviewing per-task rather than at the end.
Style: Be direct and efficient — skip unnecessary ceremony, execute decisively, implement exactly what's specified without gold-plating.
Each phase exists for a specific reason:
The main agent is the controller. It:
Trust rule: Never trust subagent completion claims. Always run tests independently after each subagent returns.
If {ticket_id} is set and beads is active, the ticket is the primary data source. When the ticket contains a ready-for-dev spec (from quick-spec), all spec content is loaded from ticket fields — no local files needed.
{ticket_id} is set (non-empty). If not, set {beads_active} to false.which bd. If not found, warn user ("beads not installed, proceeding without ticket tracking"), set {beads_active} to false.bd commands, verify you are within the project directory containing .beads/. If session context provides a beads project root, cd to it.bd show {ticket_id} --json. If the ticket doesn't exist, warn and set {beads_active} to false.metadata JSON for read-merge-write operations.When {beads_active}, check ticket metadata:
metadata.spec_status == "ready-for-dev" → load spec from ticket fields: design (overview), notes (technical context), acceptance_criteria (ACs), sub-tickets (implementation tasks via bd list --parent {ticket_id} --json). Auto-select Mode A.metadata.meld_phase == "spec" and spec_status != "ready-for-dev" → warn user that spec is incomplete, suggest running /quick-spec {ticket_id} first.Every metadata update follows read-merge-write:
bd show {ticket_id} --json → extract .metadatabd update {ticket_id} --metadata '{...}'Sync at each phase boundary:
meld_stepbd comment summarizing the phase outcomeAt skill start, create these tasks via TaskCreate. Mark in_progress when starting, completed when done.
| # | subject | blockedBy | |---|---------|-----------| | 1 | Setup and detect mode | — | | 2 | Gather context and confirm plan | 1 | | 3 | Execute per-task loop | 1 or 2 | | 4 | Final verification | 3 | | 5 | Completion and retrospective | 4 |
Mode note: Task 3 depends on task 1 in Mode A (skip context gathering) or task 2 in Mode B. If Mode A, mark task 2 completed immediately.
git rev-parse HEAD
Store as baseline_commit. If not in a git repo, set to "NO_GIT".
Read project-context.md if it exists. Note project conventions, patterns, constraints.
Mode A — Tech Spec (structured):
{beads_active} and ticket has metadata.spec_status == "ready-for-dev"design (overview), notes (technical context), acceptance_criteria (ACs). List sub-tickets as implementation tasks: bd list --parent {ticket_id} --json.status: 'ready-for-dev', extract tasks and acceptance criteria.Mode B — Direct Instructions (ad-hoc):
REQUIRED SUB-SKILL: Use meld:meld-complexity-assessment to evaluate complexity and route appropriately.
If user chooses to escalate:
meld:meld-quick-spec, then return with tech specIf user chooses [E] Execute directly → Continue to Phase 2.
If {beads_active}: Auto-create a worktree via meld:meld-worktrees. Branch name: feature/{ticket_id} (or feature/{ticket_id}-{spec_slug} if metadata has spec_slug). Re-capture baseline_commit from the worktree HEAD.
If not beads-active: Offer worktree creation as an option. If accepted, follow meld:meld-worktrees with kebab-case branch naming. Re-capture baseline_commit from worktree HEAD.
If worktree is declined or not applicable, note it and continue.
If {beads_active}:
bd update {ticket_id} --status in_progress{"meld_phase": "dev", "meld_step": "mode-detect", "baseline_commit": "{baseline_commit}", "execution_mode": "{mode_a_or_mode_b}"}bd comment {ticket_id} "MELD quick-dev Phase 1 complete — {Mode A/B} execution, baseline {baseline_commit}"Mode A skips this phase entirely — the tech spec IS the context.
Show files, patterns, plan, and acceptance criteria. Ask: "Ready to execute? Adjust anything?"
Wait for user confirmation before proceeding. This is the one human gate before continuous execution — it's the last chance to correct course cheaply.
If {beads_active}:
bd update {ticket_id} --notes "**Implementation Plan:**\n\n{task_list}\n\n**Files to modify:** {files_list}\n\n**Dependencies:** {dependencies}"bd update {ticket_id} --acceptance-criteria "{inferred_acceptance_criteria}"{"meld_step": "context-gather"}bd comment {ticket_id} "MELD quick-dev Phase 2 complete — {task_count} tasks planned, {file_count} files identified"The controller orchestrates a subagent-driven loop for each task. The controller never writes implementation code directly.
This phase follows test-driven development. The implementer subagent receives meld:meld-tdd methodology via the implementer prompt — the core rule is no production code without a failing test first.
Exception: If the project has no test framework or the task is configuration-only, note the exception in the implementer prompt context.
For each task in the plan/spec, execute steps 1-6 sequentially:
git rev-parse HEAD
Store as task_baseline. This anchors the diff for this specific task.
If {beads_active} and tasks are sub-tickets: bd update {sub_id} --status in_progress
Gather task context for the implementer:
Read implementer-prompt.md from this skill directory. Construct the subagent prompt:
Agent tool call:
prompt: "<contents of implementer-prompt.md>
## Task Description
{task_description}
## Acceptance Criteria
{acceptance_criteria}
## Files in Scope
{files_in_scope}
## Project Patterns
{project_patterns}"
subagent_type: "general-purpose"
description: "TDD implement task N"
The subagent does RED/GREEN/REFACTOR internally and reports results.
After subagent returns:
If subagent asks questions: Answer them from your controller context, then re-dispatch with the answers included.
Skip if the task diff is fewer than 20 lines (git diff --stat {task_baseline} — check total insertions + deletions).
Read meld:meld-code-simplifier (the SKILL.md content serves as the subagent prompt). Dispatch:
Agent tool call:
prompt: "<contents of meld-code-simplifier/SKILL.md>
## Baseline
{task_baseline}
## Files Changed
{list of files from task diff}"
subagent_type: "code-simplifier"
description: "Simplify task N code"
After subagent returns:
git checkout {task_baseline} -- {affected_files}), note "Simplifier changes reverted — broke tests", continue to Step 4.Read spec-reviewer-prompt.md from this skill directory. Dispatch:
Agent tool call:
prompt: "<contents of spec-reviewer-prompt.md>
## Task Description
{task_description}
## Acceptance Criteria
{acceptance_criteria}
## Implementer Report
{implementer_report_from_step_2}"
subagent_type: "general-purpose"
description: "Spec review task N"
The spec reviewer reads actual code files and verifies compliance.
After subagent returns:
Skip if the task diff is fewer than 10 lines.
Capture the task diff:
git diff {task_baseline}
Include new files.
Read adversarial-reviewer-prompt.md from this skill directory. Dispatch with information asymmetry preserved — the reviewer sees ONLY the diff:
Agent tool call:
prompt: "<contents of adversarial-reviewer-prompt.md>
<diff>
{task_diff}
</diff>"
subagent_type: "general-purpose"
description: "Code review task N"
After subagent returns:
Process findings using the framework from meld:meld-adversarial-review:
{beads_active} and tasks are sub-tickets: bd close {sub_id}When the task list contains 2+ truly independent tasks (different files, no shared state), the controller MAY dispatch multiple implementer subagents in parallel via meld:meld-parallel-agents. Each parallel task still goes through the full Step 1-6 loop — parallelism only applies to Step 2 (IMPLEMENT). Steps 3-6 run sequentially per task after parallel implementation completes.
ONLY halt for:
When halted, follow meld:meld-debugging before attempting more fixes. Do NOT guess.
Do NOT halt for minor warnings, optional improvements, or deprecation notices.
If {beads_active} (after ALL tasks complete, not per-task):
{"meld_step": "execute"}bd comment {ticket_id} "MELD quick-dev Phase 3 complete — {completed_count}/{total_count} tasks implemented, {total_findings} review findings ({fixed_count} auto-fixed)"After all tasks complete, run a lightweight aggregate check. Individual tasks passed their own reviews, so this is about integration consistency.
REQUIRED: Invoke meld:meld-verification gate function using baseline_commit (from Phase 1, not per-task baselines). Run the full test suite, linter, and build fresh. Read complete output.
Verify:
If any check fails: attempt to fix, re-run verification. If not fixable after one attempt, document and flag for user.
If {beads_active}:
{"meld_step": "verify"}bd comment {ticket_id} "MELD quick-dev Phase 4 complete — verification gate passed, all tests green"Present the full implementation summary:
Tasks:
Findings (aggregate):
| Severity | Total | Real | Fixed | Logged | |----------|-------|------|-------|--------| | Critical | N | N | N | N | | High | N | N | N | N | | Medium | N | N | N | N | | Low | N | N | N | N |
Tests: X new, Y total passing Files: N modified, M created
If in a worktree, present completion options via meld:meld-worktrees:
Wait for user decision.
Skip if diff is trivial (<20 lines, <3 files) AND no review findings were generated. Note: "Retrospective skipped — trivial change."
Otherwise, REQUIRED SUB-SKILL: Use meld:meld-retrospective.
Pass: baseline_commit, findings list (aggregate from all tasks), execution mode, spec tasks (Mode A), executed tasks, feature slug/ticket ID.
If {beads_active}:
{"meld_phase": "done", "meld_step": "complete", "finding_count": {total}, "findings_fixed": {fixed_count}, "findings_logged": {logged_count}, "spec_status": "completed"}bd comment {ticket_id} "MELD quick-dev Phase 5 complete — {finding_count} total findings ({fixed_count} fixed, {logged_count} logged). All tests passing."bd close {ticket_id} --reason 'Implementation complete — {summary}')"Suggest: commit, run additional tests, or start a new workflow.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer