test-driven-development

test-driven-development is a skill for Claude Code from XRenSiu/claude-code-forge. It costs 0 tokens per session (2,135 once invoked), scanned A, original, MIT.

A test-first development method known as TDD, where a failing test is written before the code that makes it pass. The cycle then improves the code after the test passes.

In plain words
What is it for?
Use it when implementing features, fixing bugs, or changing existing code through the red-green-refactor cycle: write a failing test, make it pass, then improve the design.
Why use it?
It defines expected behaviour before implementation and provides a repeatable check while fixing bugs, adding features, or refactoring.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the pdforge plugin — 10 skills, 13 commands, 5 agents, 2 hooks shipped together

Good fit Use it when implementing features, fixing bugs, or changing existing code through the red-green-refactor cycle: write a failing test, make it pass, then improve the design.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xrensiu/claude-code-forge/test-driven-development
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.

Any agent
npx skills add XRenSiu/claude-code-forge --skill test-driven-development
Clone the repo
git clone --depth 1 https://github.com/XRenSiu/claude-code-forge

Made for: Claude Code.

Or install pdforge, the plugin that ships this one along with the rest of its 10 skills, 13 commands, 5 agents, 2 hooks.

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 test-driven-development

README.md
[![agentmods](https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/test-driven-development/github.svg)](https://agentmods.dev/skills/xrensiu/claude-code-forge/test-driven-development)
Your own site
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/test-driven-development"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/test-driven-development/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-driven-development

Your own site · 80×15
<a href="https://agentmods.dev/skills/xrensiu/claude-code-forge/test-driven-development"><img src="https://agentmods.dev/badge/skills/xrensiu/claude-code-forge/test-driven-development.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,135 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.02135
Opus 5.5 $0.00000 $0.00854
Sonnet 5.5 $0.00000 $0.00427
Haiku 4.5 $0.00000 $0.00214

Measured 1mo ago against content hash 0a25987592da, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test-driven-development 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 1mo 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.

plugins/pdforge/skills/test-driven-development/SKILL.md · 277 lines

How it starts

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

Test-Driven Development

来源: PDForge 类型: 纪律强制型 Skill

Announce at start: "I'm using the test-driven-development skill to ensure code quality through test-first methodology."

Iron Law (铁律)

╔═══════════════════════════════════════════════════════════════════════════╗
║                                                                           ║
║   NO CODE WITHOUT A FAILING TEST FIRST                                    ║
║   先测试失败,后写代码。没有例外。                                           ║
║                                                                           ║
╚═══════════════════════════════════════════════════════════════════════════╝

This is not a suggestion. This is not a guideline. This is a law.

RED-GREEN-REFACTOR Cycle

digraph tdd_cycle {
    rankdir=LR;
    node [shape=box, style=filled];
    
    RED [label="🔴 RED\nWrite failing test", fillcolor="#ffcccc"];
    FAIL [label="Watch it fail", fillcolor="#ffcccc"];
    GREEN [label="🟢 GREEN\nWrite minimal code", fillcolor="#ccffcc"];
    PASS [label="Watch it pass", fillcolor="#ccffcc"];
    REFACTOR [label="♻️ REFACTOR\nImprove design", fillcolor="#cceeff"];
    COMMIT [label="📝 COMMIT", fillcolor="#ffffcc"];
    
    RED -> FAIL -> GREEN -> PASS -> REFACTOR -> COMMIT -> RED;
}

Phase Details

Phase 做什么 禁止什么
🔴 RED 写一个会失败的测试 写任何实现代码
👀 WATCH FAIL 运行测试,确认失败 跳过这步
🟢 GREEN 写最小代码让测试通过 写"顺便"的代码
👀 WATCH PASS 运行测试,确认通过 跳过这步
♻️ REFACTOR 改进代码设计 改变行为、破坏测试
📝 COMMIT 提交通过的代码 提交红灯代码

Red Flags List (反合理化清单)

这些是 AI 可能找的借口——全部无效:

AI 可能的借口 为什么是借口 正确做法
"这个改动很简单,不需要测试" 简单的改动也会引入 bug 写测试
"我已经手动测试过了" 手动测试不可重复 写自动化测试
"测试后置也能达到同样目的" 测试后置会遗漏边缘情况 先写测试
"这只是配置/文档改动" 配置错误也是 bug 写配置测试
"现有测试已经覆盖了" 真的吗?证明它 运行测试确认
"时间紧迫,先实现再补测试" 补测试的债很少还 先写测试
"这个情况不一样因为..." 没有不一样的情况 先写测试
"代码已经写好了,保留作参考" 参考会变成最终代码 删除它
"我只是先探索一下" 探索不需要写实现代码 删除实现,保留测试

Read the full file on GitHub · 277 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. 1mo ago First seen · 277 lines · 0 tokens per session scan A 0a25987592da

Subscribe to this mod's changes

test-driven-development is a skill published in the GitHub repository XRenSiu/claude-code-forge (2 stars, last pushed 29d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,135 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-09-05.