hackerFish/awesome-dsh-skills / skills/dsh-test-first
dsh-test-first
Verified修复 bug 或实现新功能时使用:先写失败测试,再最小实现,最后重构。
测试优先(红 → 绿 → 重构)
流程
- 红:先写一个描述期望行为的测试,运行确认它失败(证明测试真的在测)
- 绿:写最小实现让测试通过,不做任何多余设计
- 重构:在绿灯下改善结构,每步都保持测试通过
边界用例表(写测试时逐项过)
- 空输入、单元素、满容量
- 错误类型、缺字段、超长输入
- 重复调用、并发调用
- 权限不足、文件不存在、网络失败
运行
- Node 内置:
node --test - 项目用 vitest/jest 时跟随项目配置
- 只测公共行为,不测内部实现细节;覆盖率数字不设硬指标,关键路径必须覆盖
修复 bug 的额外要求
先写一个能复现该 bug 的失败测试,再修复;提交信息里写清复现路径。
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |