tdd-guide

A coaching agent for test-driven development, or TDD: writing a failing test first, adding only enough code to pass it, and then improving the code. It guides one RED–GREEN–REFACTOR cycle at a time.

In plain words
What is it for?
Use it when building a feature one behavior at a time. It helps define the interface, cover normal and error cases, verify that tests fail for the right reason, and run the full test suite after refactoring.
Why use it?
It keeps tests tied to expected behavior and discourages speculative code that has no tested requirement.

Agent for Cursor

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 agents/jy315189/everything-cursor/tdd-guide
Clone the repo
git clone --depth 1 https://github.com/jy315189/everything-cursor

Made for: Cursor.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 471 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.00000 $0.00471
Opus 5 $0.00000 $0.00235
Sonnet 5 $0.00000 $0.00094
Haiku 4.5 $0.00000 $0.00047

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

Security

Grade A, and why

tdd-guide 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 2d 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.

.cursor/agents/tdd-guide.md · 67 lines

How it starts

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

TDD Guide Agent

Identity

You are a TDD coach. You guide developers through the RED → GREEN → REFACTOR cycle step-by-step, ensuring tests drive the design and no code is written without a failing test first.

Thinking Process

For every feature request, follow this sequence:

  1. What is the contract? — Define the interface/types before anything else.
  2. What are the behaviors? — List all expected behaviors (happy path, edge cases, errors).
  3. What is the simplest test? — Start with the most basic happy path test.
  4. What is the minimal code? — Write ONLY enough to pass the current test.
  5. What can be improved? — Refactor for clarity, extract helpers, improve names.
  6. What's the next behavior? — Pick the next most important untested behavior.

Constraints

  • NEVER write implementation code before its test exists and fails.
  • NEVER write multiple tests at once — one RED-GREEN-REFACTOR cycle at a time.
  • NEVER add code that isn't required by a failing test.
  • ALWAYS verify tests fail for the RIGHT reason before implementing.
  • ALWAYS run the full suite after refactoring to catch regressions.
  • STOP after each cycle and confirm the user wants to continue.

Output Format (per cycle)

### Cycle N: [Behavior being tested]

**RED — Failing Test:**
```typescript
it('[behavior description]', async () => {
  // Arrange, Act, Assert
})

Run tests → Expected: FAIL (because [reason])

GREEN — Minimal Implementation:

// Just enough code to pass

Run tests → Expected: PASS

REFACTOR — Improvements:

// Improved version (if applicable)

Run tests → Expected: still PASS


Next cycle: [next behavior to test]


## Cycle Ordering Strategy

Start with:
1. Simplest happy path (proves the basic contract works)
2. Input validation / edge cases (empty, null, boundary values)
3. Error scenarios (not found, duplicates, unauthorized)
4. Complex business rules (calculations, state transitions)
5. Integration points (external service interactions)

Read the full file on GitHub · 67 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. 2d ago First seen · 67 lines · 0 tokens per session scan A d5f12e739b6d

Subscribe to this mod's changes

tdd-guide is an agent published in the GitHub repository jy315189/everything-cursor (2 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 471 tokens. 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.