/super-gsd:sg-tdd [phase] - optional. Defaults to STATE.md current phasefrom super-gsd
Use this when execute is complete and TDD verification is required — invokes superpowers:test-driven-development and appends a tdd stage row to HANDOFF.md.
Ships in super-gsd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
<execution_context> This command is self-contained — no external workflow files imported. Reads .planning/config.json, .planning/STATE.md, .planning/ROADMAP.md, .planning/HANDOFF.md. </execution_context>
1. **Check tdd_mode flag (D-02, per D-03).** Read tdd_mode from config.json. macOS compatible — no jq or python3: ```bash TDD_MODE=$(node -e "try{const c=require('./.planning/config.json');console.log(c.super_gsd&&c.super_gsd.tdd_mode?'true':'false')}catch(e){console.log('false')}" 2>/dev/null || echo "false") if [ "$TDD_MODE" != "true" ]; then echo "tdd_mode is not enabled. To activate: set super_gsd.tdd_mode: true in .planning/config.json. Recommended: re-run sg-execute first." fi ``` Continue regardless — tdd_mode=false does not block execution (per D-02).Resolve phase. If $ARGUMENTS is non-empty, set PHASE_NUM=$ARGUMENTS. Otherwise read .planning/STATE.md and extract the Phase: value from the YAML frontmatter.
if [ -n "$ARGUMENTS" ]; then
PHASE_NUM="$ARGUMENTS"
else
Read .planning/STATE.md, then extract the Phase: value from the YAML frontmatter. Set PHASE_NUM to the extracted value.
fi
if [ -z "$PHASE_NUM" ]; then
echo "Could not resolve current phase. Pass phase number explicitly: /super-gsd:sg-tdd <phase>"
exit 1
fi
Locate phase directory.
PHASE_PAD=$(printf "%02d" "$PHASE_NUM" 2>/dev/null || echo "$PHASE_NUM")
PHASE_DIR=$(ls -d .planning/phases/${PHASE_PAD}-* 2>/dev/null | head -1)
if [ -z "$PHASE_DIR" ]; then
PHASE_DIR=$(ls -d .planning/phases/${PHASE_NUM}-* 2>/dev/null | head -1)
fi
if [ -z "$PHASE_DIR" ]; then
echo "No phase directory matches '${PHASE_NUM}' under .planning/phases/. Run /super-gsd:sg-plan first."
exit 1
fi
Read phase metadata.
Read .planning/ROADMAP.md and extract PHASE_NAME, GOAL, and SC_TEXT from the ### Phase PHASE_NUM: section.
Read .planning/ROADMAP.md, then:
- Find the ### Phase <PHASE_NUM>: section header (try both unpadded and zero-padded two-digit PHASE_PAD forms); extract PHASE_NAME (text after "Phase N: " on that line).
- Extract the **Goal**: line value immediately following the header. Set GOAL.
- Extract numbered items under **Success Criteria** until the next ** section. Set SC_TEXT.
If no matching header is found, print: "No '### Phase <PHASE_NUM>:' header found in .planning/ROADMAP.md. Aborting." and exit.
Initialize HANDOFF.md if missing.
HANDOFF_FILE=".planning/HANDOFF.md"
if [ ! -f "$HANDOFF_FILE" ] || ! grep -q "Timestamp.*Phase.*From.*To.*Plan Hash" "$HANDOFF_FILE" 2>/dev/null; then
mkdir -p "$(dirname "$HANDOFF_FILE")"
printf '| Timestamp | Phase | From | To | Plan Hash | User |\n| --- | --- | --- | --- | --- | --- |\n' > "$HANDOFF_FILE"
fi
Append tdd row to HANDOFF.md (before Skill() call). Read the To value from the last row of HANDOFF.md (the previous stage's destination becomes this row's From) to avoid hardcoding "execute" (prevents corrupt From=tdd on retry).
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
PHASE_SLUG=$(basename "$PHASE_DIR")
GIT_USER=$(git config user.name 2>/dev/null || echo "-")
[ -z "$GIT_USER" ] && GIT_USER="-"
LAST_ROW=$(grep -E '^\| [0-9]{4}-' .planning/HANDOFF.md 2>/dev/null | tail -1)
if [ -n "$LAST_ROW" ]; then
FROM_STAGE=$(echo "$LAST_ROW" | awk -F'|' '{gsub(/ /,"",$5); print $5}')
fi
[ -z "$FROM_STAGE" ] && FROM_STAGE="execute"
echo "| $TS | $PHASE_SLUG | $FROM_STAGE | tdd | - | $GIT_USER |" >> .planning/HANDOFF.md
Build context blob, emit completion signal, invoke Skill() (D-06, D-07). Assemble the context blob to pass to Superpowers:
# TDD Verification — Phase <N> (<PHASE_NAME>)
## Goal
<GOAL>
## Success Criteria
<SC_TEXT>
## Instruction
Verify TDD compliance for the implementation above using superpowers:test-driven-development.
Check that: (1) tests were written before or alongside implementation, (2) all tests pass, (3) no production code exists without a corresponding test.
If TDD verification finds issues, surface them and ask the user: proceed to sg-review or retry.
After printing the context blob, emit the exact completion signal string (D-06):
echo "TDD verification complete"
Then invoke Skill() — no code runs after this point (Terminal Skill pattern):
Skill(skill="superpowers:test-driven-development", args="<the context blob above>")
Failure handling (D-01) — handled inside sg-tdd after Superpowers reports issues: If a failure signal is detected after the Superpowers skill completes, present a soft warning via AskUserQuestion:
AskUserQuestion(
questions: [{
question: "TDD verification found issues. How do you want to proceed?",
header: "sg-tdd",
multiSelect: false,
options: [
{ label: "Proceed to sg-review", description: "Continues to /super-gsd:sg-review." },
{ label: "Retry TDD verification", description: "Re-runs superpowers:test-driven-development." }
]
}]
)
<success_criteria>
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gyuha/super-gsd --plugin super-gsd25 skills in this plugin
/sg-cleanupUse this to archive accumulated phase directories from completed milestones — delegates to gsd-cleanup, then displays a table of what was archived./sg-completeComplete a phase (bare number → delegates to sg-phase) or close a milestone (vX.Y, or the current milestone when no argument) via gsd-complete-milestone./sg-executeUse this when the phase plan is ready and implementation should begin — packages PLAN/REQ/SC and hands off to Superpowers via superpowers:executing-plans./sg-exploreUse this when you need a map of the current codebase structure — invokes gsd-map-codebase to analyse and document the project layout.