Imported from maksutovic/joycraft (
.claude/skills/joycraft-implement-feature/SKILL.md). Install upstream withnpx skills add maksutovic/joycraft --skill joycraft-implement-feature. Copyright stays with the author.
At skill entry, run node docs/.joycraft/check.mjs check --json --session <session-id> once, reusing JOYCRAFT_SESSION_ID if supplied or one ID chosen for this conversation. If the checker is missing or fails, continue the requested skill quietly without retrying setup. Offer updates only for display: true; current, postponed, off, and unknown stay quiet. If automaticUpdate is present, finish this skill, then run its exact command once from the project root: the candidate must verify every safety gate before applying. Other updates require approval. After an offer or automatic attempt, record it with node docs/.joycraft/check.mjs acknowledge <available-version> --session <session-id>. Apply updates only at this workflow boundary; after success, reinvoke the skill or restart the session to load changed instructions.
Implement Feature (Whole-Queue Driver)
One invocation runs a feature's whole spec queue: /joycraft-implement-feature docs/features/<slug>/. You implement specs in this conversation by default — sequential specs run inline, one at a time. Subagents exist for exactly two cases: a wave the plan marks parallel-safe (concurrent agents are the mechanism for parallelism), and a spec whose execution mode is isolated (a fresh context is the mode's entire meaning; the subagent boundary provides it in-session, the equivalent of Pi's process-per-spec loop). Everything else stays in the main conversation. This is ordinary interactive use of your harness — one human invocation, no headless loop, no ToS/cost caveat.
Step 1: Load the Queue
-
Resolve the specs directory: if the given path contains a
specs/subdirectory, use it; otherwise use the path itself. Look for.joycraft-spec-queue.jsonthere. -
No queue → stop:
No spec queue found in [path]. Run
/joycraft-decomposefirst — it writes the queue, the specs, and the wave plan. -
Read the sibling
README.md(the wave plan written by/joycraft-decompose) — it tells you the intended order and which waves, if any, are marked parallel-safe. -
Check the invoking prompt for an
Execution:line./joycraft-decomposewrites one into its handoff briefing when the project's Execution Profile (thejoycraft:execution-profileregion of CLAUDE.md) enables swarms for implement — e.g.Execution: swarm implement — claude subagents opus-5 at effort medium.- Line present → every subagent you spawn in Step 2 uses the stated model and effort as its spawn params. Those params are the one enforceable hook; pass the names through verbatim, exactly as written. A line naming a harness other than the one you're running is not yours — ignore it.
- No line (profile absent, swarms off, or the human stripped it) → inherit the session's model and effort, as this skill has always done. Spawn nothing extra and say nothing about it.
- The pasted prompt is the authority at execution time: a hand-edited
Execution:line overrides whatever the profile says.
-
Report the plan before starting: feature slug, M specs, current statuses, the order you'll run them in.
-
If no
todospecs remain, skip to Step 4 and say why (everything is alreadyin-review/done).
Step 2: The Loop — Inline by Default, Subagents Only Where They Earn It
Repeat until no todo specs remain:
-
Find the next ready spec(s): the first
todowhosedepends_onare allin-review/done. Use.pi/scripts/joycraft/joycraft-next-spec <specs-dir>if installed, else read the queue JSON directly. -
None ready but
todospecs remain → fail-fast (Step 3): report which specs are blocked and on what. Never run a spec whose dependencies are unmet. -
Choose the execution path for what's ready:
- Parallel-safe wave with ≥2 ready specs (the README marks the wave parallel-safe — disjoint Affected Files): spawn the wave's specs as concurrent subagents, one per spec, each with the subagent prompt below. Announce it in one line first (
Wave N is parallel-safe — running its K specs as concurrent subagents). Never parallelize an unmarked wave — concurrent edits to shared files produce exactly the conflicts the wave plan exists to prevent. - Spec with execution mode
isolated: run that one spec in a single fresh-context subagent (fresh context is the mode's meaning) using the subagent prompt below. - Everything else — the default: implement the spec inline, in this conversation. Read
.claude/skills/joycraft-implement/SKILL.mdand follow it end to end — strict TDD (write the Test Plan's tests first, confirm they fail, implement until green), every Acceptance Criterion met — but skip that skill's "continue the queue" step: this loop owns the queue. Then the per-spec wrap-up from.claude/skills/joycraft-spec-done/SKILL.md: bump toin-reviewin BOTH.joycraft-spec-queue.jsonand the spec'sstatus:frontmatter, 2-line discovery stub ONLY if something contradicted the spec, commitspec: <spec-name>. No push, no PR, no session-end mid-queue.
Do not route sequential specs through subagents — inline execution keeps the work visible in the conversation and spends no orchestration overhead where there is nothing to orchestrate.
- Parallel-safe wave with ≥2 ready specs (the README marks the wave parallel-safe — disjoint Affected Files): spawn the wave's specs as concurrent subagents, one per spec, each with the subagent prompt below. Announce it in one line first (
-
Subagent spawn params: every subagent below runs at the model and effort from Step 1's
Execution:line, or inherits the session's when there was no line. -
Subagent prompt (parallel waves and
isolatedspecs only; fill in concrete paths — the subagent starts with zero context):Implement exactly one atomic spec:
<spec-path>.- Read
.claude/skills/joycraft-implement/SKILL.mdand follow it for this spec — strict TDD (write the Test Plan's tests first, confirm they fail, implement until green), every Acceptance Criterion met. IMPORTANT: skip that skill's "continue the queue" step — you own exactly this one spec. - Then perform the per-spec wrap-up defined in
.claude/skills/joycraft-spec-done/SKILL.md: bump the spec toin-reviewin BOTH.joycraft-spec-queue.jsonand the spec file'sstatus:frontmatter; write a 2-line discovery stub atdocs/discoveries/ONLY if something contradicted the spec; commit asspec: <spec-name>. Do NOT push, do NOT open a PR, do NOT run session-end, do NOT touch other specs. - Reply with: tests written and passing (counts), each Acceptance Criterion's status, the commit hash, and the discovery stub path if any. If you could not get tests green, say so explicitly and DO NOT bump the status or commit a broken state.
- Read
-
Verify, don't trust — after every spec, inline or subagent: confirm in the queue JSON that the spec is
in-reviewand ingit logthat thespec: <name>commit exists. For a parallel wave, verify every spec in the wave before starting anything new. Anything missing, or a failure reported → fail-fast (Step 3).
Step 3: Fail-Fast
When a spec fails (tests not green, wrap-up missing, a subagent reports failure, or all remaining specs are blocked):
- Stop the loop. Start no further specs. In a parallel wave, let already-running subagents finish and verify them, but launch nothing new.
- Report: which spec failed and why, what reached
in-review, what remainstodo. Leave the queue exactly as it is — never mark anything to cover a failure. - Suggest the recovery path: investigate in a fresh conversation with
/joycraft-implement <failed-spec>, then re-run/joycraft-implement-featureto finish the remainder.
Step 4: Finish — Session-End Once
When no todo specs remain, run the once-per-feature finisher yourself, in this conversation: invoke /joycraft-session-end (or read and follow .claude/skills/joycraft-session-end/SKILL.md). It owns the gates the loop deliberately skipped: full validation (must pass before anything graduates in-review → done), discovery consolidation, and push/PR per the project's CLAUDE.md git autonomy rules.
Final Report
Write this report to the style contract in docs/templates/reference/output-style.md.
Feature run: <slug>
- Specs completed: N of M (now in-review/done) · failures: [none | <spec> — <reason>]
- Session-end: [ran — see its report | skipped: <reason>]
- Discoveries: [n stubs consolidated | none]