tdd

tdd is a cursor rule for coding agents from Jkudjo/oh-my-cursor. It costs 9 tokens per session (361 once invoked), scanned A, original, MIT.

A test-driven development rule set: write failing tests, add the smallest code that passes them, then clean up the code without changing its behavior.

In plain words
What is it for?
Use it when building a new function, module, or feature, or when fixing a reproduced bug.
Why use it?
It makes the expected behavior explicit before implementation and helps catch broken edge cases or regressions.

Cursor rule

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 rules/jkudjo/oh-my-cursor/tdd
Clone the repo
git clone --depth 1 https://github.com/Jkudjo/oh-my-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/jkudjo/oh-my-cursor/tdd.svg)](https://agentmods.dev/rules/jkudjo/oh-my-cursor/tdd)
Your own site
<a href="https://agentmods.dev/rules/jkudjo/oh-my-cursor/tdd"><img src="https://agentmods.dev/badge/rules/jkudjo/oh-my-cursor/tdd.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 361 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.00009 $0.00361
Opus 5 $0.00005 $0.00180
Sonnet 5 $0.00002 $0.00072
Haiku 4.5 $0.00001 $0.00036

Measured 3d ago against content hash dac3d5e50982, 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.

rules/tdd.mdc · 43 lines

What it actually says

@tdd

Trigger: When building a new function, module, or feature from scratch, or reproducing a bug.

Protocol

Red phase — write failing tests

  1. Read clarified scope from get_memory key=clarified-scope (if available).
  2. Write tests that define the contract:
    • Happy path: normal inputs produce expected outputs
    • Edge cases: empty, null, boundary values, large inputs
    • Error cases: invalid inputs raise correct errors
  3. Run the tests. All must fail (red). If any pass, the test is wrong — fix it.
  4. Call update_mode_state mode=tdd-like phase=red (use deep-interview mode as proxy if tdd not registered).

Green phase — minimum implementation

  1. Write the minimum code to make all tests pass.
  2. Run tests. Iterate until green.
  3. No over-engineering — if tests pass with 5 lines, write 5 lines.

Refactor phase — clean without breaking

  1. Identify: duplication, poor naming, long functions, unclear logic.
  2. Refactor — do NOT change observable behavior.
  3. Run tests. Must still be green.

Commit

  1. Two commits:
    • test: add tests for {feature}
    • feat: implement {feature}

Rules

  • Tests before implementation — always, no exceptions.
  • Never delete or skip tests to make them pass.
  • Never modify tests in the green/refactor phase.
  • If a test seems impossible to pass: the design may be wrong — revisit the interface.
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 · 9 tokens per session scan A dac3d5e50982

Subscribe to this mod's changes

tdd is a cursor rule published in the GitHub repository Jkudjo/oh-my-cursor (1 stars, last pushed 5mo ago), licensed MIT. It adds 9 tokens to every session and 361 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.