Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问许可证需确认审计通过

tdd-workflowTDD 工作流程

Agent Skill

tdd-workflow 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

245

周安装

10

GitHub Stars

5

下载量

78
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:tdd-workflow(TDD 工作流程)
来源仓库:https://github.com/sotayamashita/dotfiles
仓库路径:skills/tdd-workflow
安装命令:
npx skills add https://github.com/sotayamashita/dotfiles --skill tdd-workflow
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/sotayamashita/dotfiles --skill tdd-workflow

简介

tdd-workflow 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 适用于测试驱动开发(TDD)流程指导与规范查询,支持单元测试与 CI/CD 集成。
  • 可返回 TDD 步骤说明、测试用例模板或常见陷阱规避建议。
  • 安装命令为 npx skills add https://github.com/sotayamashita/dotfiles --skill tdd-workflow,需确认是否修改本地配置文件。
  • 使用前应备份 dotfiles,避免自动化脚本覆盖个性化设置。

SKILL.md

Test-Driven Development

The Essence

TDD is a design workflow, not a testing technique. Writing a test is an interface design act — you decide how a behavior should be called. Making it pass is a learning act — you discover the simplest implementation. Refactoring is an implementation design act — you improve internal structure.

Every behavior is born from this cycle:

Describe the behavior in a test → Make it real → Clean up

A test that errors on import is not a failing test. A cycle that stops at RED is not a cycle.

Workflow Overview

  1. Detect project context (test framework, conventions)
  2. Confirm intent with user (strict TDD vs legacy mode)
  3. Test List — enumerate behavioral scenarios (alive, evolves during coding)
  4. Cycle — for each item: Write Test → Make Pass → Refactor → Update List
  5. Verify test quality and isolation

Step 0: Detect Project Context

Run scripts/detect_test_env.sh from the project root. If the script is unavailable, manually check:

  • Test framework (Jest, Vitest, pytest, Go test, cargo test, etc.)
  • Test file pattern (.test.ts, .spec.ts, _test.go, test_*.py)
  • Test execution command (package.json scripts, Makefile, etc.)
  • Existing test directory structure

Adapt all subsequent commands to the detected framework. Never assume npm test.

Step 1: Confirm User Intent

Strict TDD (default for new features/bug fixes):

  • Write failing test first, then implement

Legacy mode (existing code without tests):

  • See references/legacy-mode.md

Not applicable — skip TDD for:

  • Configuration files, auto-generated code, declarative CSS, throwaway prototypes

Step 2: Test List (Dynamic)

Create a list of behaviors this change needs to support. This is behavioral analysis.

GOOD (behaviors):              BAD (implementation steps):
- adds two positive numbers    - create Calculator class
- returns 0 for 0 + 0          - implement add() method
- handles negative results     - add validation logic
- rejects non-numeric input    - handle edge cases

Rules:

  1. Write entries in plain language, not code
  2. Each entry describes ONE observable behavior
  3. Order from simplest/most central to complex/edge-case
  4. Share with user, then start coding — do NOT wait for exhaustive approval
  5. This list is ALIVE — add, remove, reorder items as you learn from each cycle
  6. See references/test-case-derivation.md for systematic discovery techniques

Step 3: TDD Cycles

One cycle = one behavior. A cycle is NOT complete until GREEN.

Pick one item from the test list. Execute this cycle:

DO NOT write all tests first, then all implementation.

WRONG (horizontal):  test1, test2, test3 → impl1, impl2, impl3
RIGHT (vertical):    test1→impl1 → test2→impl2 → test3→impl3

WRITE THE TEST (Interface Design Happens Here)

Write a test for the chosen behavior. As you write, you are designing the interface:

  • Function name, parameters, return type, error format
  • The test IS the first client of the API — design for the caller

Use Arrange-Act-Assert. Your assertion must express a CONCRETE expected value. Never compute the expected value with the same logic you plan to implement.

See references/test-quality.md for good/bad test patterns.

MAKE THE TEST RUNNABLE (This Is Not RED Yet)

Before the test can fail meaningfully, it must RUN. Create scaffolding:

# Python: create calculator.py
def add(a, b):
    pass
// TypeScript: create calculator.ts
export function add(a: number, b: number): number {
  return undefined as any;
}
// Go: create calculator.go
func Add(a, b int) int {
    return 0
}

These stubs are NOT production code. They are scaffolding so the test runner can execute your test and reach the assertion.

RED — Confirm the Test Fails for the Right Reason

Run the test. Classify the result:

VALID RED — assertion fails with wrong value:

✗ Expected 5 but received 0
✗ Expected "confirmed" but received undefined
✗ Expected function to throw but it did not

→ Proceed to GREEN.

INVALID — infrastructure error (test never reached the assertion):

✗ Cannot find module './calculator'
✗ TypeError: add is not a function
✗ SyntaxError: Unexpected token

→ Fix scaffolding (create file, add stub). Re-run. Loop until you get a VALID RED.

INVALID — test passes immediately: → Test is wrong. It tests existing behavior or has weak assertions. Rewrite.

The rule: your assertion line must EXECUTE and FAIL.

GREEN — Make It Pass with Minimal Code

Write just enough code to make THIS test pass. All previous tests must also pass.

Three strategies (choose based on confidence):

  1. Fake It (default when unsure) — return a hardcoded value: Test: expect(add(2, 3)).toBe(5) Code: return 5; ← literally this The NEXT test will force generalization.
  2. Triangulation — when 2+ tests demand different hardcoded values, NOW generalize. Not before. This is how TDD drives you from specific to general.
  3. Obvious Implementation — if the correct general solution is immediately clear AND trivially simple, write it. If you hesitate, Fake It instead.

No speculative features (YAGNI). No refactoring yet.

REFACTOR (Only When Green)

All tests pass. Now improve the code:

  • Remove duplication (but duplication is a hint, not a command)
  • Improve names, extract helpers, simplify structure
  • Run tests after EVERY change — stay GREEN
  • Never add behavior during refactor (new return value or exception = new behavior = new test first)
  • See references/design-and-refactoring.md

UPDATE TEST LIST AND REPEAT

After each cycle:

  • Did you discover a new case? Add it to the list.
  • Is an item no longer relevant? Remove it.
  • Pick the next item and repeat until the list is empty.

Mocking Rules

Mock ONLY at system boundaries: external APIs, databases (prefer test DB), time, randomness. Never mock your own classes or internal collaborators. See references/mocking-guidelines.md.

Per-Cycle Checklist (all must be true before reporting to user)

[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Assertion executed and failed with WRONG VALUE (not import/type error)
[ ] Wrote minimal code to make test pass (Fake It / Triangulation / Obvious)
[ ] ALL tests pass (including pre-existing)
[ ] No speculative features added
[ ] Reported result AFTER GREEN, not after RED

Completion Checklist

[ ] Every behavior has a test that was seen failing (assertion failure) first
[ ] Edge cases and error paths covered
[ ] All tests pass with clean output
[ ] Tests run independently (no order dependency)
[ ] Test names read as behavior specifications

When Stuck

ProblemSolution
Don't know how to testWrite the API you wish existed. Assert first. Ask user.
Test too complicatedDesign too coupled. Simplify the interface.
Must mock everythingCode too coupled. Use dependency injection.
Test passes immediatelyStrengthen assertions. Verify it tests NEW behavior.
Import error on first runCreate stub file/function first, then re-run.
Tempted to skip TDDSee references/discipline.md

Resources

  • references/test-quality.md — Good vs bad tests, naming, AAA pattern
  • references/test-case-derivation.md — Systematic test case discovery
  • references/mocking-guidelines.md — When/how to mock, test doubles
  • references/design-and-refactoring.md — Interface design, deep modules, refactoring
  • references/discipline.md — Common rationalizations, red flags
  • references/legacy-mode.md — Adding tests to existing code
  • scripts/detect_test_env.sh — Auto-detect test framework and conventions

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.81%
按下载量换算27

Claude

31.57%
按下载量换算25

Cursor

17.77%
按下载量换算14

Gemini CLI

10.41%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

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

来源信息

继续浏览同类 Skills