From spear
Write the minimum implementation to flip the red test green, gate on Evidence, and advance state to engine-done.
How this skill is triggered — by the user, by Claude, or both
Slash command
/spear:engineThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
`spear:engine` enters from phase `prove-done` and exits to phase `engine-done`. It is the green half of the red-green-refactor cycle. The failing test fully constrains scope — this is intentionally worker-friendly (Sonnet/Haiku). Opus dispatches; the worker implements.
spear:engine enters from phase prove-done and exits to phase engine-done. It is the green half of the red-green-refactor cycle. The failing test fully constrains scope — this is intentionally worker-friendly (Sonnet/Haiku). Opus dispatches; the worker implements.
DOC and INFRA tasks skip this skill entirely — they flow spec-done → arch directly.
Shell out to ${CLAUDE_PLUGIN_ROOT}/hooks/lib/state.sh state_assert_phase prove-done. On non-zero exit, surface the printed message and stop — do NOT proceed.
engineShell out to ${CLAUDE_PLUGIN_ROOT}/hooks/lib/state.sh state_set_phase engine.
Read .claude/spear-state.json and recover the values of testFile, testName, reqId, and currentTaskId. These fields were written by spear:prove and identify exactly what must go green.
Implement only what is necessary to make the failing test pass. The following are FORBIDDEN:
The failing test is the acceptance criterion. Do not exceed it.
Execute the test identified by testFile and testName. If the test passes, proceed to Step 6.
If the test is still red:
phase=engine. Do NOT advance state..claude/spear-state.json with a failureReason field describing why the test still fails.Do NOT advance until the specific test is green.
Compute the set of new third-party and internal import paths introduced by the implementation diff relative to the project baseline.
For each new import, check whether it appears as a substring in any line of the current task's Evidence: block in docs/tasks.md. If any import is not covered, print:
Add evidence for: <import>, <import> …
Do NOT call state_record_test or state_set_phase engine-done. Per REQ-032 the gate is hard — state MUST NOT advance beyond recording the error reason. The agent must update Evidence: in docs/tasks.md and re-invoke spear:engine from Step 6.
Shell out to:
${CLAUDE_PLUGIN_ROOT}/hooks/lib/state.sh state_record_test <testFile> <testName> green
Where <testFile> and <testName> are the values recovered from state in Step 3.
engine-doneShell out to ${CLAUDE_PLUGIN_ROOT}/hooks/lib/state.sh state_set_phase engine-done.
When Opus dispatches a Sonnet or Haiku worker, the Agent prompt MUST carry:
docs/implementation.md §3.6.testFile and testName from state.docs/tasks.md.prove-done → [spear:engine] → engine-done
↓
spear:arch
DOC / INFRA tasks skip engine entirely:
spec-done → spear:arch (no prove/engine)
docs/requirements.md REQ-031, REQ-032, REQ-047docs/implementation.md §3.6 (state helpers), §4.2 (TDD cycle), §5 (briefing contract)plugins/spear/hooks/lib/state.shnpx claudepluginhub badgersmc/spear-plugin --plugin spearCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.