agentleFS
wannanbigpigwannanbigpig/ai-engineering-collaboration/skills/test-driven-change/SKILL.md

test-driven-change

Skill2 starsChanged 7 days agoMITView on GitHub

为有回归风险的功能或 Bug 变更选择测试策略;低风险修改不强制使用。

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

测试先行的变更

为有行为回归风险的代码变更选择测试策略;测试先行是默认倾向,不强制所有修改套用 TDD。

策略

  • Bug 修复:先复用能复现问题的已有失败测试;缺少有效保护时再新增。修复后确认通过并复验原场景,不写同义测试。
  • 新功能:先明确输入、输出、关键失败路径和边界,用行为测试定义正常行为与错误语义,再实现;覆盖范围由业务风险决定,不为穷举制造无价值测试。
  • 真实实现:调用实际被测代码,以契约、已知样例或独立性质断言结果,不复制业务算法计算期望值。复用现有测试设施;只在网络、时间或难以稳定复现的失败等确需控制的边界使用 mock/fake,不替换本次要验证的业务逻辑,也不为减少 mock 访问真实生产服务。
  • 适用例外:按行为风险、可逆性和回归价值判断。低影响修改、一次性实验或无法稳定自动化的场景可采用手动或专项检查,说明原因和验证方式;配置、脚本和 CI 不自动豁免,涉及部署、数据或权限时仍需相应回归保护。

验证与边界

  • 预期的修复前失败是证据,不触发重规划;非预期失败才回到根因调查。保留失败与通过的命令、范围和结果。
  • 按影响运行相关测试,项目规则或风险要求时再运行构建、Lint 等;已通过且代码、依赖、配置和环境未变的结果可复用。
  • 不为覆盖率写无回归捕获力的测试,不删除或弱化已有测试,不把“所有修改强制 TDD”写成绝对规则。
  • 只读请求只建议测试策略,不写测试或实现。已有修复授权继续有效;由入口调用时返回证据和缺口,独立使用时在当前范围内完成闭环,不自动加载影响分析或验证关卡。

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.