tdd-start

A session command that turns on strict test-driven development, or TDD: writing tests as part of the process of building code.

In plain words
What is it for?
Use it before coding when you want the session to follow TDD practices for projects using npm, pytest, or Go tests.
Why use it?
It records the project’s test command and activates the settings used to enforce the selected TDD mode.

Command

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/hculap/better-code/tdd-start
Clone the repo
git clone --depth 1 https://github.com/hculap/better-code
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 829 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.00008 $0.00829
Opus 5 $0.00004 $0.00415
Sonnet 5 $0.00002 $0.00166
Haiku 4.5 $0.00001 $0.00083

Measured yesterday against content hash 0b12c984cac8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tdd-start 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 yesterday.

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.

plugins/tdd-dev/commands/tdd-start.md · 107 lines

How it starts

The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TDD Mode Activation

Activate TDD Dev Mode for this session. From now on, apply strict Test-Driven Development practices to all coding requests.

Step 1: Detect Configuration First

Before creating the flag file, detect the test command:

  1. Check for settings file: Look for .claude/tdd-dev.local.md in project root
  2. Auto-detect test command:
    • If package.json exists: Use npm test or check for vitest/jest in devDependencies
    • If pyproject.toml or pytest.ini exists: Use pytest
    • If go.mod exists: Use go test ./...
    • Otherwise: Ask user for test command
  3. Read strictness setting: Default to strict if not configured

Step 2: Create TDD Mode Flag File

CRITICAL: Create the flag file that enables hook enforcement.

  1. Ensure .claude/ directory exists in project root
  2. Create the TDD mode state file at .claude/.tdd-mode-active with the following JSON content:
{
  "active": true,
  "activatedAt": "[current ISO timestamp]",
  "strictness": "strict",
  "testCommand": "[detected or configured test command]"
}

This file signals to hooks that TDD mode is active and stores the detected configuration for use by commands and hooks.

Step 2.5: Initialize TDD Cycle State

CRITICAL: Create the cycle state file that tracks TDD phases.

Create .claude/.tdd-cycle-state with the following JSON content:

{
  "phase": "red",
  "testFilesWritten": [],
  "testsRan": false,
  "testsFailed": false
}

This file tracks the current TDD phase:

  • red: Waiting for failing test to be written and run
  • green: Test failed, now implement to make it pass
  • refactor: Tests passing, safe to refactor

The hooks use this file to enforce the TDD cycle:

  • PreToolUse (Write|Edit) blocks source file edits unless phase is "green" or "refactor"
  • PostToolUse (Bash) detects test runs and transitions phases automatically

Step 3: Session State

Set the following TDD mode state:

  • TDD Mode: ACTIVE (flag file created)
  • Strictness: [detected or default: strict]
  • Test Command: [detected command]

Read the full file on GitHub · 107 lines

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. yesterday First seen · 107 lines · 8 tokens per session scan A 0b12c984cac8

Subscribe to this mod's changes

tdd-start is a command published in the GitHub repository hculap/better-code (2 stars, last pushed 7mo ago), licensed MIT. It adds 8 tokens to every session and 829 once invoked, about $0.0000 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-31.