TDD Workflow
在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,确保单元测试、集成测试和端到端测试的覆盖率超过80%。
Install
/plugin marketplace add xu-xiang/everything-claude-code-zhThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add xu-xiang/everything-claude-code-zh --skill tdd-workflowgit clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git /tmp/everything-claude-code-zh
mkdir -p ~/.claude/skills
cp -r /tmp/everything-claude-code-zh/docs/zh-CN/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
# 测试驱动开发工作流
此技能确保所有代码开发遵循TDD原则,并具备全面的测试覆盖率。
## 何时激活
* 编写新功能或功能
* 修复错误或问题
* 重构现有代码
* 添加API端点
* 创建新组件
## 核心原则
### 1. 测试优先于代码
始终先编写测试,然后实现代码以使测试通过。
### 2. 覆盖率要求
* 最低80%覆盖率(单元 + 集成 + 端到端)
* 覆盖所有边缘情况
* 测试错误场景
* 验证边界条件
### 3. 测试类型
#### 单元测试
* 单个函数和工具
* 组件逻辑
* 纯函数
* 辅助函数和工具
#### 集成测试
* API端点
* 数据库操作
* 服务交互
* 外部API调用
#### 端到端测试 (Playwright)
* 关键用户流程
* 完整工作流
* 浏览器自动化
* UI交互
## TDD 工作流步骤
### 步骤 1: 编写用户旅程
```
As a [role], I want to [action], so that [benefit]
Example:
As a user, I want to search for markets semantically,
so that I can find relevant markets even without exact keywords.
```
### 步骤 2: 生成测试用例
针对每个用户旅程,创建全面的测试用例:
```typescript
describe('Semantic Search', () => {
it('returns relevant markets for query', async () => {
// Test implementation
})
it('handles empty query gracefully', async () => {
// Test edge case
})
it('falls back to substring search when Redis unavailable', async () => {
// Test fallback behavior
})
it('sorts results by similarity score', async () => {
// Test sorting logic
})
})
```
### 步骤 3: 运行测试(它们应该失败)
```bash
npm test
# Tests should fail - we haven't implemented yet
```
### 步骤 4: 实现代码
编写最少的代码以使测试通过:
```typescript
// Implementation guided by tests
export async function searchMarkets(query: string) {
// Implementation here
}
```
### 步骤 5: 再次运行测试
```bash
npm test
# Tests should now pass
```
### 步骤 6: 重构
在保持测试通过的同时提高代码质量:
* 消除重复
* 改进命名
* 优化性能
* 增强可读性
### 步骤 7: 验证覆盖率Details
- Skill name
tdd-workflow- Repository
- xu-xiang/everything-claude-code-zh
- Path
docs/zh-CN/skills/tdd-workflow/SKILL.md- License
- MIT
- Repo updated
- 5 March 2026
FAQ
What does the TDD Workflow skill do?
在编写新功能、修复错误或重构代码时使用此技能。强制执行测试驱动开发,确保单元测试、集成测试和端到端测试的覆盖率超过80%。
How do I install the TDD Workflow skill?
Claude Code plugin: /plugin marketplace add xu-xiang/everything-claude-code-zh. 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 xu-xiang/everything-claude-code-zh, which has 2,037 GitHub stars and 332 forks.
Related skills
Backend Patterns
2kxu-xiang/everything-claude-code-zh
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Coding Standards
2kxu-xiang/everything-claude-code-zh
Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
Frontend Patterns
2kxu-xiang/everything-claude-code-zh
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
Benchmark Report
1.1kagentic-community/mcp-gateway-registry
Generate a benchmark report from stress test results (registration, API performance, search concurrency). Reads JSON result files and produces a markdown report suitable for docs/benchmarks/.
TDD Workflow
2kxu-xiang/everything-claude-code-zh
在编写新功能、修复 Bug 或重构代码时使用此技能。强制执行测试驱动开发(TDD),包括单元测试、集成测试和端到端(E2E)测试,覆盖率需达到 80% 以上。
New Feature Design
1.1kagentic-community/mcp-gateway-registry
Design and document new features with GitHub issue, low-level design (LLD), expert review, and testing plan. Creates structured documentation in .scratchpad/ with issue spec, technical design with diagrams and pseudo-code, multi-persona expert review, and a testing plan covering functional (curl and registry_management.py), backwards-compatibility, UX, ECS/terraform, and E2E API tests. Supports starting from a user description OR an existing GitHub issue URL. Folder naming: issue-{number}/ for existing issues, {feature-name}/ for new features.
Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.