tdd-workflow
Skill1 starsChanged 3 months agoMITView on GitHub
测试驱动开发。当用户要求按 TDD 方式开发、修复 Bug,或希望代码有测试保障时,执行红灯-绿灯-重构循环,先写失败测试再实现。Use when developing with test-first discipline, fixing bugs with regression tests, or when the user explicitly asks for TDD.
128 other projects use a version of this.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- lhbsaa/apex-unifiedtheir own version, first seen Nov 8, 2026
- ahmadvahidi/skill-atlastheir own version, first seen Nov 8, 2026
- mahsumaktas/agent-evolution-kittheir own version, first seen Nov 8, 2026
- ControllableModel/SWE-Skills-Benchtheir own version, first seen Nov 8, 2026
- LuisSambrano/antigravity-configtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use brand-discovery, configure-ecc 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.
ysyecustSkillbrand-discovery
Use when a brand needs to discover or articulate its identity through structured multi-session interviews. Covers purpose, positioning, audience, personality, voice, narrative, and founder-brand tension across 8 modules using laddering, 5 Whys, and projective techniques. Produces a resumable session with disk-persisted state and a master brandbook (90_SYNTHESIS.md).
Also in 6 projects that use this
royaluniondesign-sysSkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 12 projects that use this
junimnjwSkillralphinho-rfc-pipeline
RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.
Also in 12 projects that use this
loulanyueSkillnuxt4-patterns
Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.
Also in 10 projects that use this
royaluniondesign-sysSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 16 projects that use this
RojiosSkilldart-flutter-patterns
Production-ready Dart and Flutter patterns covering null safety, immutable state, async composition, widget architecture, popular state management frameworks (BLoC, Riverpod, Provider), GoRouter navigation, Dio networking, Freezed code generation, and clean architecture.
Also in 7 projects that use this
Other versions128 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 128
- affaan-m/ECC★ 246ksame name
- vudovn/ag-kit★ 8.2ksame name
- vudovn/antigravity-kit★ 8.2ksame name
- xu-xiang/everything-claude-code-zh★ 1.9ksame name
- loulanyue/awesome-claude-notes★ 272same name
- ab604/claude-code-r-skills★ 202same name
- cloudnative-co/claude-code-starter-kit★ 153same name
- xenitV1/Antigravity-Workflows★ 130same name
- cohen-liel/hivemind★ 108same name
- travisjneuman/.claude★ 106same name
118 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 repository28 other files it gives its agents.
- api-contract-designerSkill
- api-testerSkill
- bug-diagnoserSkill
- cache-governorSkill
- ci-cd-setupSkill
- code-migratorSkill
- code-reviewerSkill
- commit-message-writerSkill
- db-migration-reviewerSkill
- db-schema-designerSkill
- dev-env-troubleshooterSkill
- frontend-debugSkill
- git-workflowSkill
- log-analysisSkill
- meeting-minutesSkill
- natural-chinese-writerSkill
- performance-profilerSkill
- release-note-writerSkill
- requirement-clarifierSkill
- requirements-reviewerSkill
- security-reviewerSkill
- skill-creator-cnSkill
- skill-style-guideSkill
- sql-reviewerSkill
- task-decomposerSkill
- tech-design-writerSkill
- tech-doc-writerSkill
- weekly-reportSkill
The file
Files
测试驱动开发(TDD)
何时使用
- 用户明确要求"按 TDD 来做""先写测试";
- 实现一个逻辑密集的功能(校验、计算、状态转换);
- 修复 Bug,需要防止回归;
- 重构代码,需要测试兜底。
使用步骤
红灯阶段:先写失败测试
- 理解需求,确定行为与边界(配合 requirement-clarifier);
- 为"还没写"的代码写测试;
- 测试必须覆盖:
- 主路径(正常输入 → 预期输出);
- 边界(空值、极值、边界值);
- 异常路径(非法输入 → 错误/异常)。
- 运行测试,确认因为正确的原因失败(测试失败说明行为未实现,而不是测试本身写错)。
绿灯阶段:最小实现
- 写最少量的代码让测试通过;
- 不要提前实现未测试的功能;
- 运行全部测试,确认全绿。
重构阶段:保持绿色
- 在测试全绿的前提下重构:消除重复、改善命名、简化结构;
- 每完成一次小重构,再跑一遍测试;
- 重构不改变行为,只改变结构。
收尾:全量验证
- 运行整个测试套件,确认无回归;
- 补上遗漏的边界测试;
- 输出:测试清单 + 覆盖率情况 + 遗留风险。
完整示例
一个可以直接运行的密码校验器红绿重构循环见 examples/password-validator:先跑测试确认红灯,再实现变绿,最后提取常量重构。
测试写法参考
测试命名、框架写法、红灯判断见 references/TEST_WRITING.md。
输入与输出
- 输入:功能描述或 Bug 描述 + 技术栈;
- 输出:失败测试 → 实现代码 → 通过的测试套件。
示例
需求: 一个函数 validatePassword(pw),至少 8 位且包含数字。
红灯(先写测试):
def test_valid_password():
assert validate_password("abc12345") is True
def test_short_password():
assert validate_password("abc12") is False
def test_no_digit_password():
assert validate_password("abcdefgh") is False绿灯(最小实现):
def validate_password(pw: str) -> bool:
return len(pw) >= 8 and any(c.isdigit() for c in pw)重构(示例): 提取常量 MIN_LENGTH = 8,让魔法数字有名字。
注意事项
- 测试先于代码:违反顺序就不是 TDD;
- 验证失败原因:测试"碰巧失败"(如编译错误)不等于有效红灯;
- 不写无意义测试:只断言实现细节的测试(如"函数被调用过")价值低;
- 测试名用中文或英文均可,但必须描述行为而非实现(
test_short_password_rejected优于test_password_1); - 若项目没有测试框架,先搭最小测试框架再进入循环。
不适用场景
- 纯 UI 视觉调整(无明显可断言行为);
- 一次性脚本(不会复用、无回归风险);
- 用户明确要求"先出原型、不写测试"。
验证方式
- 触发:"按 TDD 做""先写测试";
- 检查:提交顺序是否为 测试 → 实现 → 重构;
- 运行:测试套件全绿,且故意改错一处实现,确认有测试变红。
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.

