tdd

A command for test-driven development, or TDD, where a failing test is written first, the code is made to pass, and then the code is cleaned up.

In plain words
What is it for?
Use it to add behavior-based tests for data, UI, or MCP-server changes, run the relevant test, and review the failing test before implementation continues.
Why use it?
It makes the intended behavior explicit before implementation and checks that the change works for the right reason.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/vscarpenter/gsd-task-manager/tdd
Clone the repo
git clone --depth 1 https://github.com/vscarpenter/gsd-task-manager

Made for: Claude Code.

Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 604 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00024 $0.00604
Opus 5 $0.00012 $0.00302
Sonnet 5 $0.00005 $0.00121
Haiku 4.5 $0.00002 $0.00060

Measured 3d ago against content hash d478d464b86d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tdd scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/tdd.md · 43 lines

What it actually says

Start a red/green/refactor cycle for the behavior described in the arguments. Follow the TDD protocol from coding-standards.md Part 3 and the gsd-taskmanager testing conventions in CLAUDE.md.

Behavior: $ARGUMENTS

Execute the cycle strictly in order:

  1. Red. Write a failing test in the appropriate location:

    • Data/logic tests → tests/data/
    • UI/component tests → tests/ui/
    • MCP server tests → packages/mcp-server/tests/

    Use a behavior-based name (e.g., should_skip_echo_events_from_own_device). Follow Arrange-Act-Assert. Use the project conventions:

    • Vitest with @testing-library/react + @testing-library/jest-dom
    • Mock IndexedDB is auto-imported via vitest.setup.ts
    • Use localStorage.removeItem(key) for cleanup, not localStorage.clear()
    • For sync tests, use the vi.mock('pocketbase') pattern from existing sync tests

    Run bun run test -- <test-file> (NOT bun test) and confirm it fails for the right reason — not a syntax error, missing import, or typo. Report the failure output.

  2. Pause. Stop and wait for approval of the test before writing any implementation. Do not proceed to green without confirmation.

  3. Green. Write the minimum implementation needed to make the test pass. Respect:

    • File-size limit ≤350 lines (split if needed; lib/analytics/, lib/notifications/, lib/sync/, components/task-form/, components/settings/, components/dashboard/ are reference modular layouts)
    • Function-size limit ≤30 lines
    • No extra features, no speculative abstractions, no unrelated edits

    Run the test and confirm it passes. Then run bun run test to confirm no regressions.

  4. Refactor. Propose a refactor pass: extract duplication, improve naming, simplify logic. Do not change behavior. Wait for confirmation before applying.

  5. Repeat. If the behavior requires multiple cycles, state the next failing test and return to step 1.

Rules:

  • Do not write implementation code before the test exists and has been confirmed to fail.
  • Do not bundle multiple behaviors into one cycle.
  • If touching lib/sync/**, also invoke the pb-sync-reviewer subagent before the refactor step.
  • If touching components in components/, also invoke the a11y-reviewer subagent before the refactor step.
  • If you cannot write a failing test first, stop and say the requirement is unclear — invoke /qspec instead.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 43 lines · 24 tokens per session scan A d478d464b86d

Subscribe to this mod's changes

tdd is a command published in the GitHub repository vscarpenter/gsd-task-manager (24 stars, last pushed 4d ago), licensed MIT. It adds 24 tokens to every session and 604 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.