TDD-first feature development. Crystallise API as demo use-case test, drive implementation to pass it, close quality gaps with review, docs, quality stack.
NOT for:
- bug fixes (use
/develop:fix) .claude/config changes (use/foundry:manage(requires foundry plugin))- non-Python projects (JS/TS/Go/Rust) — toolchain assumes pytest; use language-native toolchain instead
- mixed refactor+feature tasks — run /develop:refactor first, then /develop:feature
Agent Resolution
_PATHS=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/develop}/bin/dev_shared_resolve.py" --foundry 2>/dev/null) # timeout: 5000
_DEV_SHARED=$(echo "$_PATHS" | head -1)
_FOUNDRY_SHARED=$(echo "$_PATHS" | tail -1)
Read $_DEV_SHARED/agent-resolution.md. Contains: foundry check + fallback table. If foundry not installed: use table to substitute each foundry:X with general-purpose. Agents this skill uses: foundry:sw-engineer, foundry:qa-specialist, foundry:doc-scribe, foundry:linting-expert, foundry:challenger.
Read $_DEV_SHARED/task-hygiene.md.
Project Detection
Read $_DEV_SHARED/runner-detection.md — sets $TEST_CMD (full suite) and $PYTEST_CMD (pytest flags). Run at skill start.
Language preflight gate: after runner-detection.md, check project type:
# Abort early on non-Python repos — toolchain assumes pytest # timeout: 5000
if [ ! -f "pyproject.toml" ] && [ ! -f "setup.py" ] && [ ! -f "setup.cfg" ]; then
NON_PY=$(ls package.json Cargo.toml go.mod 2>/dev/null | head -1)
fi
If NON_PY is non-empty: invoke AskUserQuestion — "Non-Python project detected ($NON_PY present, no pyproject.toml/setup.py). This toolchain assumes pytest. How to proceed?" · (a) Abort — use language-native toolchain · (b) Continue — I know what I'm doing (project has Python). On Abort: stop.
Optional --plan <path>: if $ARGUMENTS contains --plan <path> (at any position), read plan file first. Extract Affected files, Risks, Suggested approach — use to populate Step 1 analysis instead of cold codebase exploration. Skip agent feasibility re-check (already done in /develop:plan). Store plan path as PLAN_FILE.
Read $_DEV_SHARED/preflight-helpers.md — execute --plan path extraction; sets $PLAN_FILE.
Checkpoint init: run DEV_DIR=$(python "${CLAUDE_PLUGIN_ROOT:-plugins/develop}/bin/dev_run_dir.py" 2>/dev/null) # timeout: 5000 to create .developments/<TS>/ and capture path. Write checkpoint.md inside $DEV_DIR. After each major step (1, 2, 3, 4, 5), append step: N — completed to $DEV_DIR/checkpoint.md. On skill start, check for existing .developments/*/checkpoint.md — if found, offer to resume from last completed step.
Flag parsing
Parse flags into actual shell variables (not prose) so downstream blocks see correct values. Persist to temp files for cross-block access (bash state lost between Bash() calls):
# timeout: 5000
CHALLENGE_ENABLED=true
CODEMAP_ENABLED=auto
SEMBLE_ENABLED=false
TEAM_MODE=false
ACCEPT_NO_PLAN=false
[[ " $ARGUMENTS " == *" --no-challenge "* ]] && CHALLENGE_ENABLED=false
[[ " $ARGUMENTS " == *" --no-codemap "* ]] && CODEMAP_ENABLED=off
[[ " $ARGUMENTS " == *" --codemap "* ]] && CODEMAP_ENABLED=strict
[[ " $ARGUMENTS " == *" --semble "* ]] && SEMBLE_ENABLED=true
[[ " $ARGUMENTS " == *" --team "* ]] && TEAM_MODE=true
[[ " $ARGUMENTS " == *" --accept-no-plan "* ]] && ACCEPT_NO_PLAN=true
echo "$CHALLENGE_ENABLED" > ${TMPDIR:-/tmp}/dev-challenge-enabled
echo "$CODEMAP_ENABLED" > ${TMPDIR:-/tmp}/dev-codemap-enabled
echo "$SEMBLE_ENABLED" > ${TMPDIR:-/tmp}/dev-semble-enabled
echo "$TEAM_MODE" > ${TMPDIR:-/tmp}/dev-team-mode
echo "$ACCEPT_NO_PLAN" > ${TMPDIR:-/tmp}/dev-accept-no-plan
Downstream blocks read back, e.g. TEAM_MODE=$(cat ${TMPDIR:-/tmp}/dev-team-mode 2>/dev/null || echo false).
# Parse --issue flag for issue-linked feature scaffolding # timeout: 6000
ISSUE_REF=$(echo "$ARGUMENTS" | grep -oP '(?<=--issue )[^ ]+' || echo "")
echo "$ISSUE_REF" > ${TMPDIR:-/tmp}/dev-issue-ref
if [ -n "$ISSUE_REF" ]; then
gh issue view "$ISSUE_REF" 2>/dev/null || echo "⚠ Could not fetch issue $ISSUE_REF — proceeding without issue context"
fi
If ISSUE_REF non-empty and issue fetch succeeded: include issue title, body, and labels in Step 1 scope analysis as pre-populated requirements context.
Unsupported flag check — after all supported flags extracted, scan $ARGUMENTS for remaining --<token> tokens. If found: print ! Unknown flag(s): \--<token>`. Supported: `--plan`, `--team`, `--no-challenge`, `--no-codemap`, `--codemap`, `--semble`, `--accept-no-plan`, `--issue`.then invokeAskUserQuestion` — (a) Abort (stop, re-invoke with correct flags) · (b) Continue ignoring (skip unknown flags, proceed). On Abort: stop.
Codemap auto-detection — run after flag parsing:
CODEMAP_ENABLED=$("${CLAUDE_PLUGIN_ROOT:-plugins/develop}/bin/codemap-resolve" "$CODEMAP_ENABLED") || exit 1
Semble preflight — if SEMBLE_ENABLED=true:
Read $_DEV_SHARED/preflight-helpers.md — execute semble preflight if flag set.
Team Mode Branch
Run immediately after flag parsing when TEAM_MODE=true. Runs Step 1 inline (teammates need scope context), then spawns parallel teammates for Steps 2-4. Exit after synthesis.
When TEAM_MODE=true:
Guard: [ -f "${HOME}/.claude/TEAM_PROTOCOL.md" ] || echo "TEAM_PROTOCOL_ABSENT" — if output contains TEAM_PROTOCOL_ABSENT: invoke AskUserQuestion — question: "foundry plugin not installed (TEAM_PROTOCOL.md absent) — cannot run team mode. Continue solo instead?" · (a) Continue solo — fall back to Steps 1–5 solo workflow · (b) Abort — stop and run /foundry:setup first. On (b): stop. On (a): set TEAM_MODE=false and continue.
Run Step 1 scope analysis inline (same analysis as solo Step 1) — teammates need orientation context. After Step 1 completes, broadcast to teammates: {feature: <desc>, scope: <modules>, API: <proposed signature>}.
Read $_DEV_SHARED/preflight-helpers.md §Team Spawn Template to get spawn prompt template. Replace [ROLE_PHRASE] with feature description, [FILE_SLUG] with feature.
Compute run directory:
# timeout: 5000
mapfile -t _run < <(python "${CLAUDE_PLUGIN_ROOT:-plugins/develop}/bin/setup_worktree.py")
TS="${_run[0]}"
TEAM_DIR="${_run[1]}"
echo "$TS" > ${TMPDIR:-/tmp}/dev-feature-team-ts
IMPORTANT: in spawn prompts below, replace $TS and $TEAM_DIR with the actual computed values from the bash block above — literal resolved strings, not shell variable references.
# Resolve variables to literals for spawn prompt embedding (matches fix/refactor pattern) # timeout: 5000
_SPAWN_TS="$TS"
_SPAWN_TEAM_DIR="$TEAM_DIR"
Use $_SPAWN_TS (or the literal resolved value) inside spawn prompt strings, not bare $TS.
Spawn 3 teammates in parallel using Agent() tool:
Teammate 1 — foundry:sw-engineer (model=opus): implements the feature (Steps 2-3: demo test, TDD loop). Prompt: "You are a foundry:sw-engineer teammate implementing: [feature description]. Read ${HOME}/.claude/TEAM_PROTOCOL.md — use AgentSpeak v2 for inter-agent messages. Your task: implement the feature (Steps 2-3: demo test, TDD loop). Scope constraint: only edit files in src/, the target module directory, and non-test Python files. Do NOT edit files under tests/. Compact Instructions: preserve file paths, test results, API signatures. Discard verbose tool output. Task tracking: do NOT call TaskCreate or TaskUpdate — the lead owns all task state. Signal your completion in your final delta message: 'Status: complete | blocked — <reason>'. Write your full analysis to .temp/develop/$TS/feature-sw-engineer-$TS.md using the Write tool. R