tdd-workflow (测试驱动开发工作流)

tdd-workflow (测试驱动开发工作流) is a skill for Claude Code from cfrs2005/claude-init. It costs 72 tokens per session (2,786 once invoked), scanned A, original, MIT.

A test-driven development workflow, where tests are written before the code they check. TDD means using failing tests to define a feature, then implementing and refining the code until the tests pass.

In plain words
What is it for?
Use it when adding features, fixing bugs, refactoring code, creating API endpoints, or building components with unit, integration, and browser-based end-to-end tests.
Why use it?
It reduces the chance of adding untested behavior and requires error cases, boundary conditions, and key user journeys to be checked.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it when adding features, fixing bugs, refactoring code, creating API endpoints, or building components with unit, integration, and browser-based end-to-end tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cfrs2005/claude-init/tdd-workflow
About the project

claude-init is an archived project template for initializing Claude Code development environments, with Chinese-localized configuration and workflows. Developers on macOS or Linux use it to set up agents, skills, commands, rules, hooks, and development contexts for Claude Code. Its catalogue entries provide the included commands, agents, hooks, and skills.

cfrs2005/claude-init · 1,359 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cfrs2005/claude-init --skill tdd-workflow
Clone the repo
git clone --depth 1 https://github.com/cfrs2005/claude-init

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tdd-workflow (测试驱动开发工作流)

README.md
[![agentmods](https://agentmods.dev/badge/skills/cfrs2005/claude-init/tdd-workflow/github.svg)](https://agentmods.dev/skills/cfrs2005/claude-init/tdd-workflow)
Your own site
<a href="https://agentmods.dev/skills/cfrs2005/claude-init/tdd-workflow"><img src="https://agentmods.dev/badge/skills/cfrs2005/claude-init/tdd-workflow/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tdd-workflow (测试驱动开发工作流)

Your own site · 80×15
<a href="https://agentmods.dev/skills/cfrs2005/claude-init/tdd-workflow"><img src="https://agentmods.dev/badge/skills/cfrs2005/claude-init/tdd-workflow.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,786 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00072 $0.02786
Opus 5.5 $0.00029 $0.01114
Sonnet 5.5 $0.00014 $0.00557
Haiku 4.5 $0.00007 $0.00279

Measured 3mo ago against content hash 1231c7e7ef92, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

tdd-workflow (测试驱动开发工作流) scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/.claude/skills/tdd-workflow/SKILL.md · 411 lines

How it starts

The opening of the file, as written. The whole thing — 411 lines — stays where its author put it; the contents beside it link to each section on GitHub.

测试驱动开发 (TDD) 工作流

本技能确保所有代码开发遵循 TDD 原则,并具有全面的测试覆盖率。

何时激活

  • 编写新特性或功能
  • 修复 Bug 或问题
  • 重构现有代码
  • 添加 API 端点
  • 创建新组件

核心原则

1. 先写测试,再写代码 (Tests BEFORE Code)

始终先编写测试,然后实现代码以使测试通过。

2. 覆盖率要求

  • 最低 80% 覆盖率 (单元 + 集成 + E2E)
  • 覆盖所有边缘情况
  • 测试错误场景
  • 验证边界条件

3. 测试类型

单元测试 (Unit Tests)
  • 独立函数和工具
  • 组件逻辑
  • 纯函数
  • 辅助函数和工具
集成测试 (Integration Tests)
  • API 端点
  • 数据库操作
  • 服务交互
  • 外部 API 调用
E2E 测试 (Playwright)
  • 关键用户流程
  • 完整工作流
  • 浏览器自动化
  • UI 交互

TDD 工作流步骤

步骤 1: 编写用户旅程 (User Journeys)

作为 [角色],我想要 [行动],以便 [收益]

示例:
作为用户,我想要进行语义化的市场搜索,
以便即使没有确切的关键词也能找到相关的市场。

步骤 2: 生成测试用例

为每个用户旅程创建全面的测试用例:

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: 运行测试 (应失败)

npm test
# 测试应失败 - 我们尚未实现

步骤 4: 实现代码

编写最少量的代码以使测试通过:

// 由测试引导的实现
export async function searchMarkets(query: string) {
  // 在此实现
}

步骤 5: 再次运行测试

npm test
# 测试现在应通过

步骤 6: 重构

在保持测试通过的前提下提高代码质量:

  • 消除重复
  • 改进命名
  • 优化性能
  • 增强可读性

步骤 7: 验证覆盖率

npm run test:coverage
# 验证是否达到 80%+ 覆盖率

测试模式

单元测试模式 (Jest/Vitest)

import { render, screen, fireEvent } from '@testing-library/react'
import { Button } from './Button'

describe('Button Component', () => {
  it('renders with correct text', () => {
    render(<Button>Click me</Button>)
    expect(screen.getByText('Click me')).toBeInTheDocument()
  })

  it('calls onClick when clicked', () => {
    const handleClick = jest.fn()
    render(<Button onClick={handleClick}>Click</Button>)

    fireEvent.click(screen.getByRole('button'))

    expect(handleClick).toHaveBeenCalledTimes(1)
  })

  it('is disabled when disabled prop is true', () => {
    render(<Button disabled>Click</Button>)
    expect(screen.getByRole('button')).toBeDisabled()
  })
})

Read the full file on GitHub · 411 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 411 lines · 72 tokens per session scan A 1231c7e7ef92

Subscribe to this mod's changes

tdd-workflow (测试驱动开发工作流) is a skill published in the GitHub repository cfrs2005/claude-init (1,359 stars, last pushed 8mo ago), licensed MIT. It adds 72 tokens to every session and 2,786 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

tdd-workflow (测试驱动开发工作流) compared with skills from other repositories

tdd-workflow (测试驱动开发工作流) next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
tdd-workflow (测试驱动开发工作流)cfrs2005/claude-initSkill1.4k8mo agoMITA72Claude Code
agentic-tddreticlehq/reticleSkill1.3kyesterdayApache-2.0A95Claude Code, Codex
nw-test-design-mandatesnWave-ai/nWaveSkill63611d agoMITA69Claude Code
nw-bdd-methodologynWave-ai/nWaveSkill63611d agoMITA52Claude Code
nw-test-organization-conventionsnWave-ai/nWaveSkill63611d agoMITA33Claude Code
testingnotque/vexjoy-agentSkill452todayMITA34Claude Code
nw-ad-critique-dimensionsnWave-ai/nWaveSkill63611d agoMITA53Claude Code