agentsclimarketplace

507 tdd

Skill ssdiwu/507-skills/code/507-tdd

Workflow-oriented Agent Skills for writing, coding, research, and decision alignment.

Install
npx -y skills add ssdiwu/507-skills --skill 507-tdd

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 24 days oldThe repository was created 24 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

测试驱动开发:仅在用户明确要求 test-first、TDD、先写测试或红绿重构时,以垂直切片完成行为测试、最小实现和全绿重构。Use when user says tdd, test-first, 先写测试, 测试驱动, 红绿重构, test driven development.

SKILL.md

3.2 KB, as published. Nobody here has run it

测试驱动开发(tdd)

先用行为测试定义预期,再写刚好足够的实现。只有用户明确要求 TDD(测试驱动开发)、test-first(测试先行)、先写测试或红绿重构时使用。

只是补测试、跑测试或缩小失败范围时用 507-test;已知生产 bug 且没有测试先行要求时用 507-fix

核心循环

RED:写一个行为测试,确认它因预期行为缺失而失败
GREEN:写刚好足够的最小实现,确认测试通过
REFACTOR:保持全绿,改善结构;每次重构后重新验证

按 vertical slice(垂直切片)推进,不先写完所有测试再一次性实现。每轮只增加一个调用者可观察行为。

开始前

先确认:

  • 公开接口和调用者可观察结果;
  • 第一条最重要行为;
  • 当前明确不做的边界;
  • 项目现有测试框架、命令和惯例。

只列行为,不把内部模块、参数命名或测试清单转交给用户决定。

每轮步骤

1. RED

  1. 通过公共入口写一个最小行为测试;
  2. 运行它;
  3. 确认失败原因正是目标行为尚未实现。

编译错误、fixture(测试样本)错误、依赖故障或测试写错不算有效 RED,先修复测试环境再继续。

2. GREEN

  • 只写让当前测试通过的最小生产代码;
  • 不提前加入未来功能、抽象或扩展点;
  • 不通过删断言、放宽预期或 mock 内部实现来伪造通过;
  • 运行当前测试,再运行最相关回归。

3. REFACTOR

只有全绿后才重构。保持公开行为不变,小步改善命名、重复和结构;每一步后重跑测试。若暴露模块形状或接缝问题,不在 RED 状态扩大重构。

4. 下一颗示踪弹

根据上一轮学到的事实选择下一条行为测试,重复循环,直到已确认行为完成。不要预先铺满所有边界。

测试纪律

  • 测试行为,不测实现;
  • mock 只放系统边界;
  • 内部重构后测试应继续通过;
  • 巨大伪对象或穿透内部结构是接口形状警报;
  • 测试中的 partial 或故意错类型不得进入生产代码。

收口

运行项目要求的单元、集成、端到端、类型或构建验证,并报告每个完成行为、关键 RED/GREEN 证据、修改文件、命令结果和未覆盖边界。随后可用 507-review 做独立审查;用户明确要求提交时再用 507-commit

完成与接力

  • 完成信号:已确认行为按垂直切片完成 RED → GREEN → REFACTOR,相关测试层级与构建检查通过。
  • 产物:行为测试、最小生产实现、关键红绿证据和未覆盖边界。
  • 候选出口:暴露既有生产 bug 时进入 507-fix;规格取舍变化时进入 507-grill;完成后进入 507-review,用户明确要求提交时再进入 507-commit
  • 回退条件:无法先写出稳定行为测试时先缩小需求或回到 PRD/grill,不用测试内部实现冒充 TDD。

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.