TDD Workflow
在编写新功能、修复 bug 或重构代码时使用此 skill。强制执行测试驱动开发,覆盖率要求 80% 以上,包括单元测试、集成测试和 E2E 测试。
Install
npx skills add zhukunpenglinyutong/ai-max --skill tdd-workflowgit clone --depth 1 https://github.com/zhukunpenglinyutong/ai-max.git /tmp/ai-max
mkdir -p ~/.claude/skills
cp -r /tmp/ai-max/skills/tdd-workflow ~/.claude/skills/tdd-workflowPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# 测试驱动开发工作流
此 skill 确保所有代码开发遵循 TDD 原则并具有全面的测试覆盖。
## 何时激活
- 编写新功能或特性
- 修复 bug 或问题
- 重构现有代码
- 添加 API 端点
- 创建新组件
## 核心原则
### 1. 代码之前先写测试
始终先写测试,然后实现代码使测试通过。
### 2. 覆盖率要求
- 最低 80% 覆盖率(单元 + 集成 + E2E)
- 覆盖所有边界情况
- 测试错误场景
- 验证边界条件
### 3. 测试类型
#### 单元测试
- 独立的函数和工具
- 组件逻辑
- 纯函数
- 辅助函数和工具
#### 集成测试
- API 端点
- 数据库操作
- 服务交互
- 外部 API 调用
#### E2E 测试(Playwright)
- 关键用户流程
- 完整工作流
- 浏览器自动化
- UI 交互
## TDD 工作流步骤
### 步骤 1:编写用户旅程
```
作为 [角色],我想要 [动作],以便 [收益]
示例:
作为用户,我想要语义搜索市场,
以便即使没有精确关键词也能找到相关市场。
```
### 步骤 2:生成测试用例
为每个用户旅程创建全面的测试用例:
```typescript
describe('Semantic Search', () => {
it('returns relevant markets for query', async () => {
// 测试实现
})
it('handles empty query gracefully', async () => {
// 测试边界情况
})
it('falls back to substring search when Redis unavailable', async () => {
// 测试回退行为
})
it('sorts results by similarity score', async () => {
// 测试排序逻辑
})
})
```
### 步骤 3:运行测试(它们应该失败)
```bash
npm test
# 测试应该失败 - 我们还没有实现
```
### 步骤 4:实现代码
编写最少的代码使测试通过:
```typescript
// 由测试指导的实现
export async function searchMarkets(query: string) {
// 这里是实现
}
```
### 步骤 5:再次运行测试
```bash
npm test
# 测试现在应该通过
```
### 步骤 6:重构
在保持测试绿色的情况下改进代码质量:
- 消除重复
- 改进命名
- 优化性能
- 增强可读性
### 步骤 7:验证覆盖率
```bash
npm run test:coverage
# 验证达到 80%+ 覆盖率
```
## 测试模式
### 单元测试模式(Jest/Vitest)Details
- Skill name
tdd-workflow- Repository
- zhukunpenglinyutong/ai-max
- Path
skills/tdd-workflow/SKILL.md- License
- MIT
- Repo updated
- 11 February 2026
FAQ
What does the TDD Workflow skill do?
在编写新功能、修复 bug 或重构代码时使用此 skill。强制执行测试驱动开发,覆盖率要求 80% 以上,包括单元测试、集成测试和 E2E 测试。
How do I install the TDD Workflow skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add zhukunpenglinyutong/ai-max --skill tdd-workflow. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is TDD Workflow popular?
It lives in zhukunpenglinyutong/ai-max, which has 335 GitHub stars and 37 forks.
Related skills
Security Review
335zhukunpenglinyutong/ai-max
在添加认证、处理用户输入、处理密钥、创建 API 端点或实现支付/敏感功能时使用此 skill。提供全面的安全检查清单和模式。
Test
434owainlewis/blueprint
Proves a code change works: runs every repository check until green, then proves each acceptance criterion with tests, and by running the real app for anything a user can see or call. Use to test or verify a diff, branch, PR, URL, or user flow.
Qt Qml Test Run
551TheQtCompanyRnD/agent-skills
Builds and runs Qt Quick Test (qmltestrunner / CTest) for a QML project, then writes a Markdown report. Use for "run qml tests", "run qmltestrunner".
Test Specialist
473ailabs-393/ai-labs-claude-skills
This skill should be used when writing test cases, fixing bugs, analyzing code for potential issues, or improving test coverage for JavaScript/TypeScript applications. Use this for unit tests, integration tests, end-to-end tests, debugging runtime errors, logic bugs, performance issues, security vulnerabilities, and systematic code analysis.
Qt Qml Test
551TheQtCompanyRnD/agent-skills
Generates Qt Quick Test cases (TestCase, SignalSpy, tryCompare) for QML components. Use for "write QML tests", "qml test", "qt quick test".
Test Skill
291joshuadavidthomas/opencode-agent-skills
A test skill to verify all plugin tools work correctly - use_skill, read_skill_file, run_skill_script, find_skills
Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.