Skip to content
Development
Command

/craft-story-implement

Implement a story through the Implement Phase. Stories must be fully designed with chunks before implementation.

From plugin
4031 skills27 agents31 commands7 hooks1 MCP
shell
$ npx -y skills add drobins25/craft --agent claude-code

Ships with craft. Installing the plugin gets this command.

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/craft-story-implement

Context preview

What this command does when you run it.

Implement a story through the Implement Phase. Stories must be fully designed with chunks before implementation.

Command definition

craft-story-implement.md
name: story-implement
description: "Implement a story through the Implement Phase. Stories must be fully designed with chunks before implementation."
argument-hint: "[story-name]"

Story Implement

⛔ **CRITICAL: YOU ARE THE ORCHESTRATOR, NOT THE IMPLEMENTER**

You must NOT write implementation code directly. For EVERY chunk, you MUST use the Task tool to invoke the implementer agent:

Task tool:
  subagent_type: "craft:implementer"
  description: "Implement chunk N of [story]"
  prompt: [chunk details, story context, TDD requirement]

If you find yourself about to write code → STOP → use Task tool instead.

---

⛔ **CRITICAL: VALIDATION CHAIN IS INLINE**

Do NOT invoke the validate-chunk skill (`craft:validate-chunk`) during the implementation loop. The validate-chunk skill exists for manual user invocation only. story-implement owns the validation chain directly:

  • Invoke chunk-validator agent via Task tool
  • Route PASSED/PARTIAL inline
  • Route FAILED via Read `${CLAUDE_PLUGIN_ROOT}/commands/references/validate-fix-loop.md`

---

⛔ **CRITICAL: ALL VALIDATION RUNS SYNCHRONOUSLY**

**NEVER** use `run_in_background: true` for test, typecheck, lint, or build commands. All validation must complete synchronously — results confirmed before marking any chunk or story done. This applies to:

  • Per-chunk validation (Step 4)
  • Quality gates (Step 5)
  • Any "verify nothing broke" test runs

Background test runs cause orphaned failure notifications that appear after stories are already marked complete. If a command is slow, wait for it.

---

Implement a story that's already been designed. This is pure Implement Phase — chunks exist, decisions are locked, just execute.

Project Root

All `.craft/` paths in this command are relative to `$CRAFT_PROJECT_ROOT` (set at session start). Use `${CRAFT_PROJECT_ROOT:-.}` as prefix when constructing paths. Pass the project root to all subagents.

Prerequisites & Status Guards

Before implementation, **validate story location and status**:

**Location check:**

  • If story is in `.craft/backlog/` → BLOCK:

Use **AskUserQuestion**:

question: "This story is in the backlog. Assign it to a cycle first?"
header: "Assign"
options:
  - label: "Assign to [active cycle] (Recommended)"
    description: "Add to current cycle and implement"
  - label: "Create new cycle for it"
    description: "Start a new cycle with this story"
  - label: "Cancel"
    description: "Go back"

If no `ACTIVE_CYCLE` exists: omit the "Assign to [active cycle]" option. Only show "Create new cycle" and "Cancel".

**If user selects "Assign to [active cycle]":** → invoke `craft:craft-cycle-assign` with the story path. After assignment completes, return to story-implement for the same story.

**If user selects "Create new cycle for it":** → invoke `craft:craft-cycle-design` with the story as context. After cycle creation completes, invoke `craft:craft-cycle-start` to activate the new cycle, then return to story-implement for the same story.

**If user selects "Cancel":** → end, do not proceed

**Cycle check:**

  • Extract the cycle name from the story path (e.g., `.craft/cycles/[cycle-name]/stories/[story].md` → `[cycle-name]`)
  • Read `ACTIVE_CYCLE` from `.global-state`
  • If story is in a cycle AND that cycle is NOT the current `ACTIVE_CYCLE`:

→ BLOCK: Do NOT proceed. Do NOT attempt to manually activate the cycle by editing state files. → Route to `craft:cycle-start` to properly activate the cycle first.

Use **AskUserQuestion**:

question: "This story is in cycle '[cycle-name]' which isn't the active cycle. Activate it first?"
header: "Cycle"
options:
  - label: "Activate [cycle-name] (Recommended)"
    description: "Use craft:cycle-start to properly activate this cycle"
  - label: "Pick a story from the active cycle"
    description: "Choose a story from [ACTIVE_CYCLE] instead"
  - label: "Cancel"
    description: "Go back"

⛔ **NEVER manually edit `.global-state` or `.state` files to activate a cycle.** Always use `craft:cycle-start` which runs the proper transition scripts (`start-cycle.sh`), updates cycle.yaml status, and handles the active cycle switch cleanly.

If user selects "Activate": invoke `craft:cycle-start` with the cycle name. After activation completes, return to story-implement for the original story.

If user selects "Pick a story from the active cycle": → invoke `craft:craft-story-implement` with no args (triggers Step 1 story picker filtered to active cycle)

If user selects "Cancel": → end, do not proceed

**Status check:**

| Status | Action | |--------|--------| | `ready` | OK: Proceed to implementation | | `active` | OK: Resume from current chunk | | `complete` | BLOCK: "Story already complete. Pick another?" |

**Also check story has:**

  • Chunks defined (from plan-chunks)
  • Acceptance criteria

**If story is missing chunks:** Use **AskUserQuestion**:

question: "This story doesn't have chunks planned. How do you want to proceed?"
header: "Plan"
options:
  - label: "Design it now (Creative Phase)"
    description: "Explore options, then plan chunks"
  - label: "Plan chunks directly (skip creative-spark)"
    description: "I know what I want, just break it down"
  - label: "Pick a different story"
    description: "Choose another story to implement"

**If user provides custom text:** Ask a clarifying AskUserQuestion to understand their preferred approach.

**If user selects "Design it now (Creative Phase)":** → invoke `craft:craft-story-new` with args "[story path] — Existing story needs creative exploration. SKIP_STEP_1: true USER_PREFERS: creative" After story-new completes (story will have chunks), return to story-implement for the same story.

**If user selects "Plan chunks directly (skip creative-spark)":** → invoke `craft:plan-chunks` with args "[story path]" After plan-chunks completes (story will have chunks, status: ready), return to story-implement for the same story.

**If user selects "Pick a different story":** → invoke

Read more
Read it on GitHub ↗

Showing the first part of this file.

Ships withcraft

Stop Vibing. Start Crafting. Claude Code plugin: guided + controlled development orchestration harness with built-in workflow + state management, for designing + building durable, production-ready software through the entire product lifecycle - new projects

Get the whole plugin, auto-invoked
Stats
40
Stars
0
Views
5
Forks
Active
Maintenance
Shell
Language
MIT
License
2d ago
Last commit
3mo ago
Created

Repo: drobins25/craft