norbertsuski/sdd-toolkit/sdd-tdd

Claude Code and agent skill by norbertsuski/sdd-toolkit

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Drive an approved plan from CONTEXT_ROOT/changes/<change-id>/plan.md phase by phase, test-first, through red→green→refactor — only for TDD'able phases not yet implemented; everything else routes to /sdd-implement. Use when the user says "tdd", "test-first", "red green refactor", or wants to execute a plan via TDD.

Install

npx vskill@latest install norbertsuski/sdd-toolkit/sdd-tdd

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as norbertsuski/sdd-toolkit/sdd-tdd.

SDD TDD — Test-First Plan Execution

You drive an approved technical plan from $CONTEXT_ROOT/changes/<change-id>/plan.md (legacy: context/changes/<change-id>/plan.md) to completion one phase at a time, test-first. This skill operates under the CONTEXT_ROOT handed to it (the resolved base) — it does not run its own discovery; app: may be absent for flat roots. This skill only applies when the phase's production implementation is still absent. For each eligible phase you run the classic loop:

RED → write a failing test that pins the next behavior
GREEN → write the minimal production code to make it pass
REFACTOR → clean up with the test staying green

This skill is the test-first sibling of `/sdd-implement`. It reads the same plan, mutates the same canonical ## Progress section, and uses the same phase-end commit ritual and clipboard handoffs. The only difference is ordering: here the failing test is written before the production code. Because that order is the point, do not use this skill to add tests after the implementation already exists. Because the two skills share ## Progress, you can interleave them freely — TDD a phase here, hand the next phase to /sdd-implement, come back, and state is never lost.

Plan path: $ARGUMENTS

What this skill assumes — and what it will not do

  • Test infrastructure already exists. A runner (Vitest / Playwright / Jest / pytest / …), a way to run a single file, and the project's test conventions are assumed to be in place. This skill discovers them; it does not install a runner, scaffold configs, create fixtures, or wire up CI. If no runner exists at all, stop and tell the user to set one up first (point them at /sdd-test-plan for a phased test rollout, or /sdd-bootstrapper for scaffolding).
  • Production implementation is not there yet. TDD only works when the failing test can lead the implementation. If the phase's relevant behavior, endpoint, component, migration, wiring, or other production change already exists, stop immediately; do not write retroactive tests and do not continue the phase under a TDD label. Tell the user to use /sdd-implement <change-id> phase N to proceed with the already-started phase.
  • It drives implementation, not just test scaffolding. Unlike the old "write all the tests up front" flow, this skill writes a small failing test, then immediately makes it green, phase by phase. There is no separate batch of orphaned failing tests.
  • It gates every phase on whether test-first actually fits and whether implementation is absent. Some phases (config, scaffolding, visual polish, infra wiring) cannot be meaningfully driven by a failing test. Already-started implementation also cannot be recovered into true TDD. Those cases are redirected or stopped as described below.

Phase overview

SETUP → Resolve plan, read fully, confirm test infra exists, create per-phase tasks
For each phase:
├─ GATE → Is this phase TDD'able, and is implementation absent? If not → redirect or stop
├─ RED/GREEN/REFACTOR → Loop per behavior in the phase until its success criteria are met
└─ PHASE END → Full suite green → manual gate → commit ritual → next-phase decision (clipboard)
After all phases → Completion summary + optional /sdd-impl-review

Each phase ends with a user checkpoint. Never silently skip a phase or merge two phases into one commit.


Setup

When this skill is invoked:

  1. Resolve the plan:
  • /sdd-tdd <change-id> [phase N] → $CONTEXT_ROOT/changes/<change-id>/plan.md.
  • @$CONTEXT_ROOT/changes/<change-id>/plan.md (legacy: @context/changes/<change-id>/plan.md) or a full path → accept as-is.
  • Refuse if the resolved path starts with `$CONTEXT_ROOT/archive/` (legacy: context/archive/) — print "This change is archived. Open a new change with /sdd-new instead." and STOP.
  • If nothing was provided, print the message below and STOP and wait:
I'll drive an approved plan test-first (red → green → refactor), phase by phase. Please provide:
1. A change-id (e.g., `/sdd-tdd oauth-login phase 1`), or
2. A full path (e.g., `@$CONTEXT_ROOT/changes/oauth-login/plan.md`).
You can list active changes with: `ls "$CONTEXT_ROOT/changes/"`
Tip: the plan should already be reviewed and approved — this skill implements it, it doesn't write it.
  1. Read the plan completely — every phase, every Changes Required block, every Success Criteria item. Never use limit/offset; you need full context. The ## Progress section at the bottom is authoritative for execution state — checkmarks (- [x]) live ONLY there (see references/progress-format.md). Phase blocks carry plain - bullets, no checkboxes.
  1. Read `$CONTEXT_ROOT/foundation/lessons.md` if present and internalize each entry before starting any phase — these are the team's accepted recurring rules and must shape every implementation choice in this run.
  1. Confirm test infrastructure exists (light check — do not research the world):
  • If $CONTEXT_ROOT/foundation/test-stack.md exists, read it — it records the runner, environment, conventions, and run commands. Use it and skip the scan. If it looks stale (references tools/configs that no longer exist), note that to the user and fall back to a quick scan.
  • Otherwise do a quick conventions scan (this is not the heavy infra-research phase): find the test config and 1–2 representative existing test files to learn the import style, describe/it nesting, mock patterns, and the command to run a single test file. A single Glob for *.test.* / *.spec.* plus reading one example is enough.
  • If there is no runner and no test config at all, STOP:
This plan needs a test runner in place before I can drive it test-first — I found none
(no vitest/jest/playwright/pytest config, no test scripts, no existing *.test.* files).
This skill assumes test infrastructure already exists; it won't set it up. Options:
• Set up a runner first, then re-run /sdd-tdd.
• Use /sdd-implement to build the plan without test-first.
• Use /sdd-test-plan for a phased test-rollout strategy.
  1. Update `change.md`: with pending executable work, apply ../sdd-run/references/verification-freshness.md — set status: implementing from {planned, plan_reviewed, implemented, impl_reviewed} and bump updated before editing. This invalidates any older snapshot.
  1. Create one task per phase (these surface in the user's status bar): for each ## Phase N: header, create a task with subject: "Phase N: [Phase Name]" and activeForm: "TDD Phase N". Mark the current phase in_progress before starting; mark it completed when its success criteria pass.
  1. Find the starting point: scan ## Progress — the first - [ ] in document order is where you start. If a phase N argument was passed, jump to the first - [ ] under ### Phase N:.
Clipboard convention. Wherever this skill says copy `X` to the clipboard, pipe the exact string X to the platform clipboard — try pbcopy (macOS), then clip.exe (Windows/WSL), then xclip -selection clipboard (Linux), and fall back silently if none exist. Then display the copied command on its own line suffixed with (✓ copied).

The TDD eligibility gate — run before every phase

Before you write a single test for a phase, decide two things in this order:

  1. Implementation absence — the phase's production implementation is not already present.
  2. TDD-ability — the phase can be meaningfully driven by a failing test.

A phase is eligible for this skill only when both are true.

Existing-implementation stop

First, inspect the phase's Changes Required, Success Criteria, and pending ## Progress rows, then do a focused code search for the files, symbols, endpoints, migrations, commands, UI surfaces, or config entries the phase is supposed to add or change. This is a quick reality check, not a broad research pass.

If the core implementation for the phase is already present or partially present, STOP immediately. Do not add tests after the fact, do not refactor the existing code, do not mark Progress rows, and do not offer to continue inline. TDD does not work for already existing code because the failing test no longer leads the implementation.

Print this block, filling in the concrete evidence:

Phase [N] already has implementation in place, so I can't drive it with TDD.
TDD does not work for already existing code; the failing test has to come before the production code. Here I found existing implementation:
- [file/symbol/endpoint/etc. evidence]
Use /sdd-implement to proceed with this phase:
→ /sdd-implement <change-id> phase [N]

Copy /sdd-implement <change-id> phase [N] to the clipboard per the clipboard convention, display it with (✓ copied) when successful, and STOP. /sdd-implement can continue the phase from the existing code and plan state.

If the implementation is absent, continue to the TDD-ability check.

TDD-ability check

After confirming the implementation is absent, decide whether the phase can be meaningly driven by a failing test. A phase is TDD'able when there is an observable outcome you can assert before the code exists.

TDD'able — drive it hereNot TDD'able — redirect to /sdd-implement
Pure functions, data transforms, parsers, validatorsPure scaffolding: creating dirs, config files, package.json/manifest edits
State machines / reducers / flag computationWiring & infra: CI files, Dockerfiles, env setup, deploy config
API request → response contracts (status, shape, auth, gating)Visual / styling polish with no automated assertion path in the stack
Business logic with clear inputs/outputsExploratory spikes where the contract isn't known yet
Integration flows across mockable boundaries (DB/KV/HTTP)Documentation, comments, content-only edits
Bug fixes (write the failing repro first)Thin glue where a test would only restate the implementation (tautological)

How to apply the TDD-ability check:

  • If the implementation is absent and the phase is clearly TDD'able, state that in one line and proceed to the red-green-refactor loop.
  • If the phase is clearly not TDD'able, run the redirect (below).
  • If it's mixed or ambiguous (e.g., a phase that scaffolds a config and adds a validator with real logic), ask the user: "Phase [N] is partly scaffolding, partly logic. How should I drive it?" with options:
  • "TDD the testable part (Recommended)": "I'll red-green-refactor the [logic] and implement the scaffolding inline as plain steps."
  • "Redirect whole phase to /sdd-implement": "Hand the entire phase off — copy the resume command to the clipboard."
  • "TDD the whole phase anyway": "Force test-first even for the thin parts. May produce low-value tests."
Redirect a non-TDD'able phase to /sdd-implement

State why the phase isn't a fit (one or two sentences, grounded in the table above), then ask the user: "Phase [N] isn't a good test-first fit. How do you want to handle it?" with options:

  • "Hand off to /sdd-implement (Recommended)": "Copy /sdd-implement <change-id> phase N to the clipboard. Clear context, run it, then resume TDD on the next phase."
  • "Implement inline here (no test-first)": "I'll build this phase directly from the plan and run its success criteria — then continue to the next phase's gate."
  • "Skip — already done": "Mark the phase's Progress rows and move to the next phase."

On "Hand off": copy /sdd-implement <change-id> phase [N] to the clipboard (per the clipboard convention), print the block below, and STOP — /sdd-implement will flip this phase's Progress rows and run its own commit ritual. Tell the user to resume TDD afterward.

Phase [N] isn't test-first material — [one-line reason].

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/norbertsuski/sdd-toolkit/sdd-tdd/badge)](https://verified-skill.com/skills/norbertsuski/sdd-toolkit/sdd-tdd)

Something wrong with this skill or its page? Tell us.