From beat
Implements code from gherkin feature files or proposal artifacts using TDD with git worktree isolation. Part of the Beat workflow for spec-driven development.
How this skill is triggered — by the user, by Claude, or both
Slash command
/beat:applyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Implement code based on the change artifacts. Supports two modes:
Implement code based on the change artifacts. Supports two modes:
<decision_boundary>
Use for:
NOT for:
/beat:design)/beat:plan)/beat:verify)/beat:explore)Trigger examples:
</decision_boundary>
Before any code changes: you MUST invoke superpowers:using-git-worktrees to verify isolation (should already exist from design/plan; creates one if not). In TDD mode: you MUST invoke superpowers:test-driven-development. Invoke in order: worktrees first (verify), then TDD (discipline). If a prerequisite skill is unavailable (not installed), continue without it — but NEVER skip because you judged it unnecessary.Prerequisites (invoke before proceeding)
| Superpower | When | Priority |
|---|---|---|
| using-git-worktrees | Verify isolation (should exist from design/plan; creates if not) | MUST |
| test-driven-development | At start, in TDD mode | MUST |
| systematic-debugging | When stuck (3 failed attempts) | SHOULD |
| subagent-driven-development | When tasks.md has multiple independent tasks | SHOULD |
Invoke in order: worktrees first (verify isolation), then TDD (discipline). Debugging and subagent are conditional — only invoke when triggered. If a superpower is unavailable (skill not installed), skip and continue.
| Thought | Reality |
|---|---|
| "The change is small, I don't need a worktree" | Worktrees protect against contamination. The worktree should already exist from design/plan — verify, don't skip. |
| "I'll write the test after the implementation, same result" | TDD is about design feedback, not just test coverage. Writing tests after loses the design signal. |
| "This is a refactor, TDD doesn't apply" | Refactors need tests most — they prove behavior is preserved. If testing.required is false, TDD is already skipped. |
| "I'll add @covered-by annotations at the end for all scenarios" | Annotations must be added per-scenario immediately after writing the test. Batching them leads to forgetting. |
| "The e2e test setup is too complex, I'll write a unit test instead" | The scenario is tagged @e2e for a reason. If e2e setup is genuinely blocked, announce the blocker and ask — don't silently downgrade. |
| "This @behavior test is obvious, a skeleton is enough" | Every test must be executable. A skeleton that doesn't run is not a test. |
| "These tasks are small, I'll combine them for efficiency" | Each task is bounded for a reason. Merging recreates the oversized-output problem that decomposition solved. One task = one subagent dispatch. |
| "The existing test is roughly correct, no need to update it" | If scenario steps changed, the test must reflect those changes. An old test passing does not mean the new behavior is correct. |
| "I'll create a new test file, it's faster" | If @covered-by already points to an existing test, creating a new file breaks traceability. Update the existing test. |
@covered-by to the .feature file@covered-by pointing to an existing testdesign.md → write ADR (references/adr-format.md)references/architecture-format.md)references/architecture-format.md)Run inline as conditions arise. Don't batch.
digraph apply {
"Select change, read artifacts" [shape=box];
"Invoke using-git-worktrees" [shape=box, style=bold];
"testing.required false?" [shape=diamond];
"No-test mode" [shape=box];
"Invoke test-driven-development" [shape=box, style=bold];
"Gherkin done?" [shape=diamond];
"Gherkin-driven" [shape=box];
"Proposal-driven" [shape=box];
"tasks.md exists?" [shape=diamond];
"Has Task N headings?" [shape=diamond];
"Executor mode\nfollow tasks exactly" [shape=box];
"Planner mode\nextract scenarios/criteria" [shape=box];
"Implementation loop" [shape=box];
"All tasks complete" [shape=doublecircle];
"Select change, read artifacts" -> "Invoke using-git-worktrees";
"Invoke using-git-worktrees" -> "testing.required false?";
"testing.required false?" -> "No-test mode" [label="yes"];
"testing.required false?" -> "Invoke test-driven-development" [label="no"];
"No-test mode" -> "Gherkin done?";
"Invoke test-driven-development" -> "Gherkin done?";
"Gherkin done?" -> "Gherkin-driven" [label="yes"];
"Gherkin done?" -> "Proposal-driven" [label="gherkin skipped"];
"Gherkin-driven" -> "tasks.md exists?";
"Proposal-driven" -> "tasks.md exists?";
"tasks.md exists?" -> "Has Task N headings?" [label="yes"];
"tasks.md exists?" -> "Planner mode\nextract scenarios/criteria" [label="no"];
"Has Task N headings?" -> "Executor mode\nfollow tasks exactly" [label="yes"];
"Has Task N headings?" -> "Planner mode\nextract scenarios/criteria" [label="no"];
"Executor mode\nfollow tasks exactly" -> "Implementation loop";
"Planner mode\nextract scenarios/criteria" -> "Implementation loop";
"Implementation loop" -> "All tasks complete";
}
Input: Optionally specify a change name. If omitted, infer from context or prompt.
Steps
Select the change
If no name provided:
beat/changes/ directories (excluding archive/)Read status.yaml and verify readiness (schema: references/status-schema.md)
Check that either:
gherkin has status: done → Gherkin-driven modegherkin has status: skipped AND proposal has status: done → Proposal-driven modeIf neither condition is met: "Features or proposal are required before implementation. Run /beat:design first." STOP.
If status.yaml has source: distill: warn — "This is a distill change; its features describe behavior the code already has, so there is nothing to implement. The intended flow is /beat:verify → /beat:archive." Use AskUserQuestion tool to confirm before proceeding.
Read all artifacts and determine testing mode
Read in order:
proposal.md (if exists) -- business context and risk pointsfeatures/*.feature (all files, if gherkin is done) -- implementation targetsdesign.md (if exists) -- technical decisionstasks.md (if exists) -- implementation checklistRead beat/config.yaml (if exists, schema: references/config-schema.md).
Determine testing mode:
testing.required: false → no-test mode: skip TDD cycles for all scenarios, write implementation onlytesting.behavior is set → use that framework for @behavior scenarios (skip auto-detection)testing.e2e is set → use that framework for @e2e scenarios (skip auto-detection)testing.framework is set (legacy) → treat as testing.behaviortesting is absent or testing.required: true → TDD mode (default): require tests for all scenariosDetermine BDD feature paths (for running e2e tests):
beat/features/ (unchanged features; .feature.orig files are invisible to BDD runners)beat/changes/<name>/features/ contains feature files: add it (new + modified features)npx cucumber-js beat/features beat/changes/<name>/features)Determine implementation strategy
If tasks.md exists: Use it as the implementation checklist.
### Task N: headings with Steps): Enter executor mode — follow each step exactly as written, don't re-plan.- [ ] checkboxes): Enter planner mode — plan each task's implementation yourself (existing behavior).If no tasks.md and Gherkin-driven: Extract each Scenario from feature files as a unit of work (planner mode).
If no tasks.md and Proposal-driven: Extract success criteria and risk points from proposal.md as units of work (planner mode).
Show implementation overview
## Implementing: <change-name>
### Drive mode: gherkin-driven / proposal-driven
### Execution mode: executor / planner
### Tasks/Scenarios to implement:
1. [source] <name>
2. [source] <name>
...
Implement (loop)
For each task (from tasks.md) or scenario (from features) or risk point (from proposal):
a. Announce: "Working on: "
b. Write automated test first (TDD mode only):
testing.behavior or testing.e2e from config (depending on scenario tag), or detect from codebaseGenerate vs Update (see references/testing-conventions.md for details):
@covered-by present + test file exists → Update: modify the existing test to reflect new scenario steps@covered-by present + test file missing → Generate + WARNING (stale annotation)@covered-by absent → Generate: create new test (existing flow)For @e2e scenarios (Gherkin-driven):
testing.e2e framework from config, or auto-detect from codebase@feature/@scenario annotations (same as @behavior)For @behavior scenarios (Gherkin-driven):
testing.behavior from config, or auto-detect) with annotation comments:
@feature: <feature-filename>.feature
@scenario: <exact scenario name>
(Use the project language's comment syntax: // for JS/TS/Java/C#, # for Python/Ruby, etc.)@covered-by annotation (placed between the tag and the scenario line):
@behavior @happy-path
# @covered-by: <relative path to test file>
Scenario: <name>
For proposal-driven units:
@scenario decorator serves as the annotation — no separate # @feature / # @scenario comments needed (see references/testing-conventions.md).Follow the conventions in references/testing-conventions.md for annotation format, e2e test style, and Generate vs Update path.
c. Write implementation code:
d. If using tasks.md: Mark task complete - [ ] -> - [x]
e. Continue to next
f. Scenario completion checklist (verify before moving to next scenario):
For @e2e scenarios (TDD mode):
@feature/@scenario annotations or BDD binding)# @covered-by: <path> annotation added to .feature file (between tag and Scenario line)For @behavior scenarios (TDD mode):
@feature and @scenario comments# @covered-by: <path> annotation added to .feature file (between tag and Scenario line)For all scenarios:
Do NOT move to the next scenario until all applicable items are checked.
Pause if:
E2E regression check (after all scenarios implemented)
If @e2e scenarios exist and testing.e2e is configured (or auto-detected):
Skip if no @e2e scenarios or no-test mode.
On completion or pause, show status
If all done: update status.yaml phase to verify
## Implementation Complete
**Change:** <name>
**Scenarios:** N/N implemented with tests
Suggested next steps:
- `/beat:verify` -- validate implementation against artifacts
- `/beat:archive` -- sync features and archive the change
Testing Rule: Conditional TDD
In TDD mode (default when testing.required is true or unset):
@e2e scenarios → e2e test or step definitions (using project's e2e framework)@behavior scenarios → test with @feature/@scenario annotations + @covered-by comment in .featuretesting.behavior (for @behavior) or testing.e2e (for @e2e) from config, or auto-detect from codebaseIn proposal-driven mode (gherkin skipped):
In no-test mode (testing.required: false):
testing.behavior/testing.e2e if specified.Guardrails
@behavior scenarios: always add @covered-by annotation to .feature after writing the test@behavior scenarios: always add @feature/@scenario annotations in the test filenpx claudepluginhub kirkchen/beat --plugin beatGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.