OpenClaw
Deploy a managed OpenClaw agent in 60 seconds
Launch on Hostinger →
Hermes Agent
Run your Hermes agent, fully managed
Launch on Hostinger →
Apify
6,000+ web scrapers for your agent, free to start
Try Apify free →
Firecrawl
Crawl and scrape any site into clean data
Try Firecrawl free →
Context.dev
One API to scrape, enrich, and extract the web
Start building free →
SetupClaw
Done-for-you OpenClaw for founders and teams
Get it set up for you →
DataForSEO
SEO data APIs for your agent, $1 free credit
Try DataForSEO free →
Your product here
Reach thousands of AI builders a month
Learn more →
Claude Market
Menu
SkillsMCPPluginsSubmit MCPSkillPluginMCPMCP, plugin, or skillAdvertise
Claude Market
SkillsMCPPluginsSubmit MCPSkillPluginMCPMCP, plugin, or skillAdvertise
Skills/vinvcn/mattpocock-skills-zh-cn/tdd
tdd logo

tdd

vinvcn/mattpocock-skills-zh-cn
720 installs584 stars
Run it on Hostinger, 20% off →Your friend gets 20% off too, using this linkFree API →|View on GitHub|Create your own skill →

Installation

npx skills add https://github.com/vinvcn/mattpocock-skills-zh-cn --skill tdd

Summary

使用 red-green-refactor loop 做 test-driven development。Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.

SKILL.md

Test-Driven Development

Philosophy

核心原则:测试应该通过 public interfaces 验证行为,而不是验证 implementation details。代码可以完全改变;测试不该因此改变。

好测试偏 integration-style:它们通过 public APIs 执行真实 code paths。它们描述系统做_什么_,而不是_怎么做_。好测试读起来像 spec,比如 “user can checkout with valid cart” 清楚说明已有能力。这些测试能经受 refactor,因为它们不关心内部结构。

坏测试和 implementation 绑定。它们 mock 内部 collaborators、测试 private methods,或通过外部手段验证(例如直接查询 database,而不是使用 interface)。警示信号是:你 refactor 了,行为没变,但测试坏了。如果重命名内部函数导致测试失败,那些测试测的是 implementation,不是 behavior。

示例见 tests.md,mocking 指南见 mocking.md。

Anti-Pattern: Horizontal Slices

不要先写所有测试,再写所有实现。 这是 “horizontal slicing”,把 RED 当成“写所有测试”,把 GREEN 当成“写所有代码”。

这会产生糟糕测试:

  • 批量写出的测试验证的是_想象中_的行为,不是_实际_行为
  • 你最终测的是事物的_shape_(data structures、function signatures),而不是 user-facing behavior
  • 测试对真实变化不敏感:行为坏了仍通过,行为没坏却失败
  • 你跑得比车灯还远,在理解 implementation 之前就承诺了 test structure

正确方式:通过 tracer bullets 做 vertical slices。一个 test → 一个 implementation → 重复。每个 test 都响应上一轮学到的东西。因为代码是你刚写的,你知道什么行为重要,以及该如何验证。

WRONG (horizontal):
  RED:   test1, test2, test3, test4, test5
  GREEN: impl1, impl2, impl3, impl4, impl5

RIGHT (vertical):
  RED→GREEN: test1→impl1
  RED→GREEN: test2→impl2
  RED→GREEN: test3→impl3
  ...

Workflow

1. Planning

写任何代码之前:

  • [ ] 与用户确认需要哪些 interface changes
  • [ ] 与用户确认要测试哪些 behaviors(排序优先级)
  • [ ] 识别 deep modules 的机会(小 interface,深 implementation)
  • [ ] 为 testability 设计 interfaces
  • [ ] 列出要测试的 behaviors(不是 implementation steps)
  • [ ] 获得用户对计划的批准

问:“public interface 应该长什么样?哪些 behaviors 最值得测试?”

你无法测试所有东西。 与用户确认最重要的 behaviors。把测试精力放在 critical paths 和复杂逻辑上,而不是每一个边缘情况。

2. Tracer Bullet

写一个只确认系统一件事的测试:

RED:   Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passes

这是你的 tracer bullet,证明路径可以 end-to-end 工作。

3. Incremental Loop

对每个剩余 behavior:

RED:   Write next test → fails
GREEN: Minimal code to pass → passes

规则:

  • 一次只写一个 test
  • 只写足够让当前 test 通过的代码
  • 不预判未来 tests
  • 让测试专注于 observable behavior

4. Refactor

所有 tests 通过后,寻找 refactor candidates:

  • [ ] 提取重复
  • [ ] Deepen modules(把复杂性移到简单 interfaces 后面)
  • [ ] 在自然处应用 SOLID principles
  • [ ] 思考新代码暴露了 existing code 的哪些问题
  • [ ] 每个 refactor step 后都运行 tests

RED 状态永远不要 refactor。 先到 GREEN。

Checklist Per Cycle

[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Test would survive internal refactor
[ ] Code is minimal for this test
[ ] No speculative features added

Score

0–100
63/ 100

Grade

C

Popularity15/30

720 installs — growing adoption.

Completeness27/30

Documented: full SKILL.md body, description, one-line install. Missing: category/license metadata.

Trust15/25

Community skill with a public GitHub source repository you can review.

Freshness6/15

No update timestamp is tracked for this skill in our catalog.

Scored automatically from popularity, completeness, trust, and freshness — computed only from data in our catalog, never fabricated.

Proud of your score? Add this badge to your README.

Paste a snippet into your GitHub README. The badge updates automatically and links back to this page.

Tdd skill score badge previewScore badge

Markdown

[![Tdd skill](https://www.claudemarket.ai/skills/vinvcn/mattpocock-skills-zh-cn/tdd/badges/score.svg)](https://www.claudemarket.ai/skills/vinvcn/mattpocock-skills-zh-cn/tdd)

HTML

<a href="https://www.claudemarket.ai/skills/vinvcn/mattpocock-skills-zh-cn/tdd"><img src="https://www.claudemarket.ai/skills/vinvcn/mattpocock-skills-zh-cn/tdd/badges/score.svg" alt="Tdd skill"/></a>

Tdd FAQ

How do I install the Tdd skill?

Run “npx skills add https://github.com/vinvcn/mattpocock-skills-zh-cn --skill tdd” in your terminal. The skill is added to your agent's skills directory and picked up automatically on the next run — no restart or extra configuration needed.

What does the Tdd skill do?

使用 red-green-refactor loop 做 test-driven development。Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development. The full SKILL.md on this page shows the exact instructions the skill gives your agent.

Is the Tdd skill free?

Yes. Tdd is a free, open-source skill published from vinvcn/mattpocock-skills-zh-cn. As with any third-party skill, review the source repository before installing it into an agent with sensitive access.

Does Tdd work with Claude Code and OpenClaw?

Yes. Skills use the portable SKILL.md format, so Tdd works with Claude Code, OpenClaw, Codex, Hermes, and any other agent that reads SKILL.md skills.

Recommended skills

Browse all →
find-skills logo

find-skills

vercel-labs/skills

2.8M installsInstall
grill-me logo

grill-me

mattpocock/skills

752K installsInstall
frontend-design logo

frontend-design

anthropics/skills

741K installsInstall
grill-with-docs logo

grill-with-docs

mattpocock/skills

639K installsInstall
agent-browser logo

agent-browser

vercel-labs/agent-browser

627K installsInstall
improve-codebase-architecture logo

improve-codebase-architecture

mattpocock/skills

615K installsInstall

Related guides

Hand-picked reading to help you choose, install, and use agent skills.

GuideBest Testing Skills For AI AgentsGuide10 Openclaw Skills Every Nextjs Developer NeedsGuideHow To Build Your First Openclaw Skill

Skills by category

FrontendBackend & APIsTesting & QASecurityDevOps & CI/CDMCP & ToolingAutomationData & Analysis+20 more

MCP servers by category

AI & MLDeveloper ToolsVector & MemoryFiles & DocsDatabasesFinance & PaymentsBrowser & ScrapingCommunication+8 more

Plugins by category

developmentproductivitycommunicationdesignsecuritydatabaseworkflowcompliance+34 more

The Agent Stack

Weekly Claude Code, Agent SDK, and MCP moves worth your time — free.

Claude Market

AI agent skills directory, marketplace, and workflow hub for OpenClaw, Hermes Agent, Claude Code, Codex, and MCP-powered operator stacks.

Independent project, not affiliated with Anthropic.

Resources

  • Browse Skills
  • Browse MCP Servers
  • Browse Plugins

More

  • Submit a Tool
  • Create a Skill
  • Advertise
  • Free Tools
  • API
  • Shipping
  • Contact
  • Terms
  • Privacy
© 2026 Claude Market · Not affiliated with Anthropic
Fazier badgeFeatured on Twelve ToolsFeatured on Wired BusinessRemote OpenClaw - Featured on AI Agents DirectoryListed on Turbo0Featured on Uneed