tdd
Skill1 starsChanged 4 days agoApache-2.0View on GitHub
写代码、修 bug 或改测试前判断需要哪些验证,避免无用测试。只读问答不触发。
194 other projects use a version of this.
Adopted by
Most recently taken up by
- ishandutta2007/Awesome-Claude-Skillstheir own version, first seen Nov 8, 2026
- trpc/trpctheir own version, first seen Nov 8, 2026
- wowyuarm/dsh-agent-teamtheir own version, first seen Nov 8, 2026
- Contexera/dsh-agent-teamtheir own version, first seen Nov 8, 2026
- Dimon94/dveritytheir own version, first seen Nov 8, 2026
- Dimon94/skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use capture-learning-tools, design-frontend-dev and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
The-Vibe-CompanySkillcapture-learning-tools
Turn technical conversations, bugs, CI failures, review comments,
Also in 5 projects that use this
The-Vibe-CompanySkilldesign-frontend-dev
Clean Impeccable frontend design skill. Use when the user wants to
Also in 5 projects that use this
tristanphvnSkillketchup-video
Catch the user up like /keel:ketchup, with a short silent video of slides for what happened and the waiting calls as text under it. Use for /keel:ketchup-video.
Also in 14 projects that use this
jaydubya818Skillfigure-it-out
Use when novel or multi-phase work needs an auditable workflow and no narrower playbook fits.
Also in 54 projects that use this
jaydubya818Skillprinciple-laziness-protocol
Apply when a refactor is adding wrappers or abstractions instead of simplifying.
Also in 45 projects that use this
- +2 more from The-Vibe-Company
- +5 more from jaydubya818
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- mattpocock/skills★ 309ksame name
- trpc/trpc★ 41ksame name
- Yeachan-Heo/oh-my-claude-sisyphus★ 41ksame name
- Yeachan-Heo/oh-my-claudecode★ 41ksame name
- QuivrHQ/quivr★ 40ksame name
- The-Vibe-Company/quivr★ 40ksame name
- ccusage/ccusage★ 19ksame name
- ryoppippi/ccusage★ 19ksame name
- MODSetter/SurfSense★ 17ksame name
- GreyDGL/PentestGPT★ 16ksame name
184 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- agent-conductSkill
- asset-validationSkill
- awesome-presentationSkill
- browser-harnessSkill
- changelog-writingSkill
- debian-testvmSkill
- feature-deliverySkill
- herdrSkill
- persistent-ssh-opsSkill
- provision-xray-hy2-nodeSkill
- public-acceptanceSkill
- repo-knowledge-graphSkill
- trigger-build-workflowSkill
The file
Files
测试与 TDD
默认快速开发:先看受影响的现有验证,只为值得的契约补少量行为测试;新增、重构或删除代码本身不是理由。这个判断不需要额外文档或固定格式汇报。
测试可以领先于实现,但不能未经确认领先于需求;失败测试意味着需要评估,不总是意味着必须立即扩大实现。
判断原则
- 值不值得测:行为可能写错、错了代价高、类型检查/lint/已有测试/浏览器验收又拦不住,三者同时成立才补。代价高指权限与隔离、数据与金额、外部消费者依赖的输出、难以回滚的操作;失败路径同样按此判断,没有书面需求时以安全边界和数据完整性为准。
- 断言好不好:说得出它挡住哪种错误实现,且等价重构不会让它失败。抄实现或配置表当预期、锁调用顺序或源码写法、mock 掉被测逻辑本身,都过不了这一关。
- 测在能暴露错误的最低一层:纯逻辑用单元测试;SQL、事务、并发等只在真实依赖中成立的语义,用真实依赖或隔离副本;上层测试已能挡住同一错误时,不再重复测内部函数。只在必要边界替换外部依赖,固定时间、随机数和网络输入。
- 同一事实或规则多处维护时测一致性(如种子与常量、前后端枚举、多个入口的同一校验),不抄任一份。
- 确保断言实际执行、异步结果被等待、错误能让测试失败。不为覆盖率或用例数堆测试,不为凑用例新增导出、注入开关、fallback 等业务不需要的实现。
具体场景的正反例见 常见误区与来源。
阶段边界
- RED 前确认行为来源:预期应能追溯到当前需求/验收、已复现缺陷、当前实现必须满足的正确性/安全/数据完整性要求,或用户已确认的风险之一,再按判断原则决定是否补测试。普通边界断言、表驱动和回归测试直接进行,不逐项审批;为范围内新增或修复的行为补测试时,先确认它因预期原因失败,再做最小实现;重构前的既有行为刻画测试可以直接通过。
- 区分探索复现与修复:可以先用最小测试验证疑似竞态或安全假设;探索中发现失败,先核实触发条件与影响,不能仅凭红灯把假设升级为必须实现的契约。探索复现不自动授权生产行为或基础设施扩张;涉及范围或复杂性取舍时遵循全局“开发与工作区”的复杂性规则。
- GREEN:用满足当前需求和有效测试的最简实现变绿,不预留假想接口、配置或扩展点;最简不等于按用例硬编码、遗漏明确错误处理或降低安全底线。
- REFACTOR:只改善当前的重复、耦合和可读性,不为未来需求做架构通用化;需求满足、相关验证通过、设计清晰即停止。
常见场景
- 修 bug:先复现(命令或手工即可)并检查相邻逻辑;逻辑错误留回归用例,环境类问题不固化。
- 重构:已有测试即护栏;值得测的逻辑没有覆盖时,先补测试固定现有行为。
- 接线、类型、注释、文档和生成物:工程检查和已有消费者测试,接线有风险时从入口验证实际操作,接线本身构成权限边界(路由守卫、中间件挂载)时按高代价处理;文案、样式和布局做浏览器验收,同步已有断言或 locator。
- 停用或兼容端点:只重复无条件错误/占位常量的专属用例通常可删;仍有输入、鉴权、状态、转换或错误映射等契约时按判断原则保留,不凭固定状态码或测试名判断。
- 时间相关行为:超时、重试和过期用受控时钟验证结果;不在普通单测中断言真实执行耗时阈值,性能要求用独立、受控的 benchmark 验证。
- 数据库迁移:验证空库安装、历史数据升级和重复执行;回填和转换逻辑按上述原则判断。
- 探索阶段先跑通,契约稳定后再固定预期。
删除功能
- 同步清理实现及专属测试、fixture、mock 和快照;混合用例保留仍有效的断言,不要求删一个补一个。
- 不留防恢复痕迹:不加「block recovery」、源码禁词或旧文件/符号不存在的守卫,也不断言已删 API/路由、导出、配置键或菜单项不在注册表里;不把旧测试改成「已移除版本」,不留空壳、跳过用例或占位兼容实现。删除靠类型检查、已有消费者测试和一次性搜索残留验证,不自行固化成扫描脚本或 CI 规则。
- 删除不产生新的拒绝或兼容契约;需求明确要求的负向行为仍要验证,如越权不能写入、响应不泄露敏感字段。条件注册、持续有效的架构/部署边界也按当前契约判断,不因负向断言而删测试。
完成条件
- 运行前确认测试 setup 连接的数据库和服务,会写共享或持久数据时改用隔离环境。沿用现有验证方式,只跑受影响的检查,前端做浏览器验收;无测试栈而含易错逻辑时用临时脚本,不为小改动新建测试栈,不机械走红绿流程。
- 已有测试失败时按当前需求判断:失效断言更新或删除;有效断言不能为变绿而放宽、跳过或照抄实际输出。只修当前改动及直接相关的问题,不借机重写整套测试。
- 对值得用户决策的重要范围外风险,交代发现、未处理原因、影响和最小后续动作,不静默忽略或全部实现;普通边界无需逐项报告。
- 没有新增测试也可以交付,报告实际验证结果。
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
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.

