agentleFS
535803710535803710/ai-rd-skills/skills/tdd/SKILL.md

tdd

Skill8 starsChanged 6 months agoMITView on GitHub

使用测试驱动开发实现核心逻辑,适用于用户要求 TDD、红绿重构、先写测试再实现、用测试约束 AI 写代码,或需要为关键业务规则建立回归保护时使用。

Files
SKILL.md

TDD

目标

用测试先框住行为,再实现代码。重点是控制实现方向,减少 AI 自由发挥。

工作方式

  1. 先确认要保护的核心行为。
  2. 写最小失败测试,测试名称表达业务行为。
  3. 运行测试,确认失败原因正确。
  4. 写最小实现让测试通过。
  5. 运行测试,确认通过。
  6. 必要时重构,但不能改变测试保护的行为。

适合场景

  • 核心业务规则
  • 状态流转
  • 工具函数
  • 数据转换
  • 权限判断
  • 复杂条件分支

参考

  • 测试选择:references/tests.md
  • mock 策略:references/mocking.md
  • 重构节奏:references/refactoring.md
  • 接口设计:references/interface-design.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.