Token导航 LogoToken导航

Agent Skill · 开发

test-driven-development(测试驱动开发)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

test-driven-development 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 14,373。

总安装 710周安装 29GitHub Stars 1下载 227核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:test-driven-development(测试驱动开发)
来源仓库:https://github.com/pixel-process-ug/superkit-agents
仓库路径:skills/test-driven-development
安装命令:
npx skills add https://github.com/pixel-process-ug/superkit-agents --skill test-driven-development
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/pixel-process-ug/superkit-agents --skill test-driven-development

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

test-driven-development 用于辅助测试设计、用例整理和回归验证,适合编写单元测试和端到端测试。适用于测试相关的辅助工作,可整理测试计划和夹具数据。使用时需确认项目测试框架和运行命令,避免为了通过测试而改坏逻辑。涉及浏览器或外部服务时应区分本地模拟和测试环境。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/test-driven-development

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/pixel-process-ug/superkit-agents --skill test-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

test-driven-development 怎么安装?

在终端执行 npx skills add https://github.com/pixel-process-ug/superkit-agents --skill test-driven-dev…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

test-driven-development 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

test-driven-development 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

test-driven-development 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

test-driven-development 用的人多吗?

公开数据是累计安装 710 次,近一周安装 29 次,下载 227 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

test-driven-development 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
test-driven-development

测试驱动开发 · 本页

7101操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Test-Driven Development

Overview

TDD enforces the RED-GREEN-REFACTOR cycle as an unbreakable discipline: write a failing test, make it pass with minimal code, then clean up. This skill prevents untested production code from ever existing and ensures every line of implementation is driven by a verified requirement.

Announce at start: "I'm using the test-driven-development skill with the RED-GREEN-REFACTOR cycle."


Iron Law

┌─────────────────────────────────────────────────────────────────┐
│  HARD-GATE: NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST    │
│                                                                 │
│  This is non-negotiable. There are no exceptions. If you are   │
│  writing production code and there is no failing test demanding │
│  that code, you are violating this skill. STOP immediately     │
│  and write the test first.                                     │
└─────────────────────────────────────────────────────────────────┘

Phase 1: RED (Write a Failing Test)

Goal: Write exactly ONE test that fails for the right reason.

Actions

  1. Identify the smallest unit of behavior to implement next
  2. Write a test that asserts that behavior exists
  3. Run the test suite — confirm the new test FAILS
  4. Read the failure message — confirm it fails for the RIGHT reason (missing functionality, not syntax error or import error)
  5. If it fails for the wrong reason, fix the test until it fails correctly

STOP — HARD-GATE: Do NOT proceed to GREEN until:

  • Test is written and saved
  • Test suite has been run
  • New test fails
  • Failure reason is correct (tests the intended behavior)

Phase 2: GREEN (Make It Pass)

Goal: Write the MINIMUM production code to make the failing test pass.

Actions

  1. Write only enough code to make the failing test pass
  2. Do NOT refactor. Do NOT clean up. Do NOT optimize
  3. Hardcode values if that makes the test pass — that is fine
  4. Run the full test suite
  5. ALL tests must pass (not just the new one)

STOP — HARD-GATE: Do NOT proceed to REFACTOR until:

  • Production code is written
  • Full test suite has been run
  • ALL tests pass (new and existing)
  • No more code was written than necessary

Phase 3: REFACTOR (Clean Up)

Goal: Improve code quality without changing behavior.

Actions

  1. Look for duplication, poor naming, long methods, code smells
  2. Make ONE refactoring change at a time
  3. Run the full test suite after EACH change
  4. If any test fails, undo the refactoring immediately
  5. Continue until the code is clean

STOP — HARD-GATE: Do NOT proceed to next RED until:

  • Code is clean and readable
  • All tests still pass after refactoring
  • No behavior was changed during refactoring

HARD-GATE Enforcement

┌─────────────────────────────────────────────────────────────┐
│  HARD-GATE: PHASE COMPLETION CHECK                          │
│                                                             │
│  Before moving to next phase, ALL items in the              │
│  STOP MARKER checklist must be satisfied.                   │
│                                                             │
│  If ANY item is not satisfied:                              │
│  → STOP                                                    │
│  → Complete the missing item                               │
│  → Re-verify ALL items                                     │
│  → ONLY THEN proceed                                       │
└─────────────────────────────────────────────────────────────┘

Watch Mode Discipline

After every change to any file (test or production), run the relevant test suite. No exceptions.

ActionRun Tests?Expected Result
Write a testYesFailure (RED)
Write production codeYesPass (GREEN)
Refactor codeYesPass (still GREEN)
Any other editYesNo regressions

If your test runner supports watch mode, use it. If not, run tests manually after every save.


Decision Table: Test Type Selection

Behavior Being TestedTest TypeFramework Example
Pure function logicUnit testVitest, pytest, cargo test
API endpoint request/responseIntegration testSupertest, httpx
Database query correctnessIntegration testTestcontainers
UI component renderingUnit testReact Testing Library
Full user workflowE2E testPlaywright
Error handling pathUnit testVitest, pytest

Example Cycle

Requirement: "Users can register with email and password"

Behavior List:
1. Registration with valid email and password succeeds
2. Registration fails if email is empty
3. Registration fails if password is too short
4. Registration fails if email is already taken

Cycle 1 - Behavior 1:
  RED:   test_registration_with_valid_email_and_password_succeeds → FAIL (no register function)
  GREEN: def register(email, password): return User(email=email) → PASS
  REFACTOR: rename variable for clarity → PASS

Cycle 2 - Behavior 2:
  RED:   test_registration_fails_if_email_is_empty → FAIL (no validation)
  GREEN: add if not email: raise ValueError → PASS
  REFACTOR: extract validation to separate method → PASS

...continue for each behavior...

Checklist: Starting a New Feature with TDD

  1. Understand the requirement fully before writing any code
  2. Break the requirement into a list of specific behaviors
  3. Order behaviors from simplest to most complex
  4. Create a task for the first behavior
  5. Enter RED phase: write failing test for first behavior
  6. Enter GREEN phase: write minimal code to pass
  7. Enter REFACTOR phase: clean up
  8. Create task for next behavior, repeat from step 5
  9. After all behaviors are implemented, run full test suite
  10. Invoke verification-before-completion before claiming done

Test Quality Standards

Each test must be:

StandardDefinition
FastMilliseconds, not seconds
IsolatedNo shared state between tests, no test ordering dependencies
RepeatableSame result every time, no flakiness
Self-validatingPass or fail, no manual interpretation needed
TimelyWritten before the production code (that is the whole point)

Each test should:

  • Test ONE behavior or scenario
  • Have a descriptive name that explains the scenario and expected outcome
  • Follow Arrange-Act-Assert (or Given-When-Then) structure
  • Use the minimum setup necessary
  • Assert outcomes, not implementation details

Anti-Patterns / Common Mistakes

Anti-PatternWhy It Is WrongCorrect Approach
Writing production code firstDefeats the purpose of TDD; tests shaped to passWrite the test first, always
Writing multiple tests before any codeBatch testing defeats incremental designOne test, one cycle
Test passes on first runEither test is wrong or behavior already existsInvestigate before proceeding
Spending >5 minutes in GREENWriting too much code at onceSimplify; make test more specific
Modifying tests to match codeTests specify behavior; code must match testsFix the code, not the test
Skipping REFACTOR phaseTechnical debt accumulates rapidlyRefactor every cycle
Not running tests after every changeRegressions go unnoticedRun tests after every save

Rationalization Prevention

ExcuseReality
"It's just a small change"Small changes cause production outages. Test it.
"I'll write the tests after"You will not. And if you do, they will be weaker because they were shaped to pass, not to specify.
"This is just a refactor"Refactors change behavior more often than you think. The test suite proves they do not.
"I know this works"You do not. You think you do. The test proves it.
"Tests would slow me down"Debugging without tests slows you down 10x more.
"This code is too simple to test"If it is too simple to test, it is too simple to get wrong — so the test will be trivial to write. Write it.
"I can't test this because of dependencies"Then your design has a coupling problem. Fix the design.
"The test would be harder to write than the code"That means you do not understand the requirements well enough. The test forces you to clarify.
"I'll just manually verify it"Manual verification is not repeatable, not documented, and not trustworthy.
"This is throwaway/prototype code"Prototype code has a habit of becoming production code. Test it now or regret it later.
"The framework makes it hard to test"Use the framework's testing utilities, or isolate your logic from the framework.
"I'm under time pressure"TDD is faster over any timeline longer than 20 minutes. The pressure is exactly why you need it.

Red Flags

If you observe any of these, STOP and reassess:

Red FlagWhat It MeansAction
Writing production code with no failing testImmediate violationStop. Write the test.
Test passes immediately on first runTest is wrong or behavior existsInvestigate before proceeding
More than 5 minutes in GREEN phaseWriting too much codeSimplify. Make test more specific.
Refactoring changes behaviorTest coverage has a gapAdd missing tests
Tests modified to passRequirements invertedFix code to match tests
Multiple tests before any production codeBatch testing defeats purposeOne test at a time
Test suite not run after a changeRegressions invisibleRun tests. Always. Every time.

Integration Points

SkillRelationship
verification-before-completionMUST be invoked before claiming any TDD work is complete
systematic-debuggingWhen a test fails unexpectedly during REFACTOR, switch to debugging
code-reviewAfter completing a feature via TDD, review the test suite for completeness
acceptance-testingAcceptance criteria drive the behavior list for TDD cycles
planningPlan breaks features into behaviors suitable for TDD cycles
testing-strategyStrategy defines frameworks; TDD defines the cycle

Test Types in TDD

TypeScopeSpeedWhen to Write
Unit (Primary)Individual functions, methods, classesMillisecondsRED phase for every behavior
Integration (Secondary)Component interactionsSecondsAfter unit tests cover individual behaviors
E2E (Tertiary)Complete user workflowsSeconds-minutesCritical paths after unit and integration are solid

Skill Type

RIGID — The RED-GREEN-REFACTOR cycle is mandatory and cannot be reordered, skipped, or combined. Every phase has a HARD-GATE that must be satisfied before proceeding. No production code without a failing test first.

平台分布

Codex

35.02%
按下载量换算79

Claude

31.13%
按下载量换算71

Cursor

20.86%
按下载量换算47

Gemini CLI

10.79%
按下载量换算24

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills