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.
npx agentmods add skills/233i/agent-skills/test-driven-developmentnpx skills add 233i/agent-skills --skill test-driven-developmentgit clone --depth 1 https://github.com/233i/agent-skillsWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00054 | $0.03618 |
| Opus 5 | $0.00027 | $0.01809 |
| Sonnet 5 | $0.00011 | $0.00724 |
| Haiku 4.5 | $0.00005 | $0.00362 |
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 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.
How it starts
The opening of the file, as written. The whole thing — 376 lines — stays where its author put it; the contents beside it link to each section on GitHub.
测试驱动开发
概览
在写让它通过的代码之前,先写一个失败的测试。对 bug 修复来说,也是在尝试修复前先用测试复现 bug。测试就是证据,“看起来对”不算完成。有高质量测试的代码库,是 AI agent 的超能力;没有测试的代码库,则是一种负担。
何时使用
- 实现任何新的逻辑或行为
- 修复任何 bug,也就是 Prove-It Pattern
- 修改现有功能
- 增加边界情况处理
- 任何可能破坏现有行为的改动
不适用的场景: 纯配置改动、文档更新,或不会影响行为的静态内容修改。
相关 skill: 对浏览器端改动,应把 TDD 和 Chrome DevTools MCP 的运行时验证结合起来,见下方 Browser Testing 部分。
TDD 循环
RED GREEN REFACTOR
Write a test Write minimal code Clean up the
that fails ──→ to make it pass ──→ implementation ──→ (repeat)
│ │ │
▼ ▼ ▼
Test FAILS Test PASSES Tests still PASS
步骤 1:RED,先写一个失败测试
先写测试,而且它必须失败。一个一开始就通过的测试,证明不了任何事情。
// RED: This test fails because createTask doesn't exist yet
describe('TaskService', () => {
it('creates a task with title and default status', async () => {
const task = await taskService.createTask({ title: 'Buy groceries' });
expect(task.id).toBeDefined();
expect(task.title).toBe('Buy groceries');
expect(task.status).toBe('pending');
expect(task.createdAt).toBeInstanceOf(Date);
});
});
步骤 2:GREEN,让它刚好通过
写出能让测试通过的最少代码,不要过度设计:
// GREEN: Minimal implementation
export async function createTask(input: { title: string }): Promise<Task> {
const task = {
id: generateId(),
title: input.title,
status: 'pending' as const,
createdAt: new Date(),
};
await db.tasks.insert(task);
return task;
}
步骤 3:REFACTOR,整理实现
当测试已经是绿色时,再在不改变行为的前提下优化代码:
- 提取共享逻辑
- 改善命名
- 去重
- 必要时做性能优化
每做一步重构,都重新跑测试,确认没有破坏行为。
举证模式(Prove-It Pattern,Bug 修复)
当收到 bug 报告时,不要一上来就修。 先写一个能复现它的测试。
Bug report arrives
│
▼
Write a test that demonstrates the bug
│
▼
Test FAILS (confirming the bug exists)
│
▼
Implement the fix
│
▼
Test PASSES (proving the fix works)
│
▼
Run full test suite (no regressions)
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.
- 2d ago First seen · 376 lines · 54 tokens per session scan A 27ac8e9fc3d4
test-driven-development is a skill published in the GitHub repository 233i/agent-skills (6 stars, last pushed 4mo ago), licensed MIT. It adds 54 tokens to every session and 3,618 once invoked, about $0.0003 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.
Other skills, from other repositories
agent-integration
Run all three agent integration phases sequentially: research, write-tests, and implement using E2E-first TDD (unit tests written last). For individual phases, use /agent-integration:research, /agent-integration:write-tests, or /agent-integration:implement. Use when the user says "integrate agent", "add agent…
engram-testing-coverage
TDD and coverage standards for Engram. Trigger: When implementing behavior changes in any package.
code-assist
Guides implementation of code tasks using test-driven development in an Explore, Plan, Code, Commit workflow. Acts as a Technical Implementation Partner and TDD Coach — following existing patterns, avoiding over-engineering, and producing idiomatic, modern code.
tdd
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
css-design-tdd
Test-driven CSS design system modifications. Run checks before/after CSS changes to verify token usage, variable definitions, fallbacks, and consistency. Use when modifying CSS tokens, fixing design inconsistencies, or auditing CSS architecture.
mobiai-mobile-tdd
You MUST use this before writing any implementation code for a mobile feature, bug fix, refactor, or behavior change. Tests come before implementation — no exceptions.