tdd

tdd is a cursor rule for Cursor from marcoemrich/mad-tdd-mob-ai-driven. It costs 1,718 tokens per session, scanned A, original, MIT.

A set of rules for test-driven development (TDD), a way of building software by writing a failing test, making it pass with a small change, and then improving the code.

In plain words
What is it for?
Use it to guide development one test at a time, predict expected failures, keep implementations minimal, and refactor with confidence.
Why use it?
It addresses the urge to build too much at once and explains why small, test-led steps can reduce unnecessary complexity.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to guide development one test at a time, predict expected failures, keep implementations minimal, and refactor with confidence.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/marcoemrich/mad-tdd-mob-ai-driven/tdd
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.

Clone the repo
git clone --depth 1 https://github.com/marcoemrich/mad-tdd-mob-ai-driven

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tdd

README.md
[![agentmods](https://agentmods.dev/badge/rules/marcoemrich/mad-tdd-mob-ai-driven/tdd.svg)](https://agentmods.dev/rules/marcoemrich/mad-tdd-mob-ai-driven/tdd)
Your own site
<a href="https://agentmods.dev/rules/marcoemrich/mad-tdd-mob-ai-driven/tdd"><img src="https://agentmods.dev/badge/rules/marcoemrich/mad-tdd-mob-ai-driven/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,718 This file is loaded in full into every session.
When invoked 1,718 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01718 $0.01718
Opus 5 $0.00859 $0.00859
Sonnet 5 $0.00344 $0.00344
Haiku 4.5 $0.00172 $0.00172

Measured 8d ago against content hash 2a682be203b3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, 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 8d 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/rules/tdd.mdc · 210 lines

How it starts

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

Test-Driven Development (TDD) Rules

TDD Mindset and Common Challenges

Expected Psychological Resistance

TDD practices will feel counterintuitive and uncomfortable:

  • Hardcoded returns feel "too simple" - Returning 0 or 1 seems wasteful, but it's the correct minimal step
  • The urge to implement ahead is strong - You'll want to solve multiple test cases at once; resist this
  • Minimal steps feel inefficient - Taking tiny steps seems slow but actually accelerates development
  • Predictions feel unnecessary - Stating what will fail seems obvious, but builds crucial understanding
  • Push through this discomfort - These feelings indicate you're following the discipline correctly

Why This Discipline Works

Understanding the deeper purposes helps maintain discipline:

  • Baby steps reveal simpler solutions - Implementing only what tests demand often uncovers approaches simpler than over-engineered first attempts
  • One-test-at-a-time prevents complexity - Not thinking ahead eliminates unnecessary features and abstractions
  • Predictions build confidence - Explicit expectations create deeper understanding of what you're testing and why
  • Refactoring becomes natural - Mandatory improvement attempts prevent technical debt accumulation
  • The process fights harmful instincts - Programming instincts often lead to premature optimization and over-engineering

Common TDD Failure Modes

Watch for these violations of discipline:

  • Planning beyond base functionality - Including advanced features in initial test list instead of focusing on core functionality
  • Multiple active tests - Converting more than one it.todo() to executable test code at once
  • Implementing beyond tests - Adding features or logic not demanded by current failing test
  • Skipping predictions - Running tests without explicitly stating expected failures
  • Avoiding refactoring - Moving to next test without attempting at least one improvement
  • Premature abstraction - Creating complex solutions when simple ones pass tests
  • Ignoring the uncomfortable - Abandoning discipline when it feels "too simple" or "too slow"

Read the full file on GitHub · 210 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. 8d ago First seen · 210 lines · 1,718 tokens per session scan A 2a682be203b3

Subscribe to this mod's changes

tdd is a cursor rule published in the GitHub repository marcoemrich/mad-tdd-mob-ai-driven (33 stars, last pushed 10mo ago), licensed MIT. It adds 1,718 tokens to every session, about $0.0086 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.