超能力

人工智能 社区

技能解读

当前原文的自动摘译,尚未人工审校。

何时使用该技能

可以进行单元测试的新功能错误修复(如果可行,请始终添加回归测试)重构(首先通过测试保护行为)

规则

更喜欢红色 -> 绿色 -> 重构。如果测试很困难,仍然需要添加验证:最少的重现脚本、集成测试或明确的手动步骤。保持测试重点:尽可能每个测试一种行为。按行为命名测试,而不是实现细节。

工艺流程

定义行为改变(之后应该是什么)。编写/调整测试以捕获它(如果可能的话,使其首先失败)。实施最小的改变才能通过。如果需要的话进行重构(继续通过)。运行相关的测试套件+任何 linter。

输出要求

当您更改代码时,请包括: 您添加/更改了哪些测试 如何运行它们 它们证明了什么

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
人工智能
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@anthonylee991 · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
即装即用
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

# TDD Skill

## When to use this skill
- new features that can be unit tested
- bug fixes (always add a regression test if practical)
- refactors (protect behavior with tests first)

## Rules
- Prefer **red -> green -> refactor**.
- If tests are hard, still add **verification**: minimal repro script, integration test, or clear manual steps.
- Keep tests focused: one behavior per test where possible.
- Name tests by behavior, not implementation details.

## Process
1. Define the behavior change (what should be true after).
2. Write/adjust a test to capture it (make it fail first if possible).
3. Implement the minimal change to pass.
4. Refactor if needed (keep passing).
5. Run the relevant test suite + any linters.

## Output requirements
When you change code, include:
- what tests you added/changed
- how to run them
- what they prove

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。