tdd-workflow

GitHub

驱动严格的测试驱动开发循环(红-绿-重构),确保测试先行。通过逐步最小化代码实现行为,防止过度设计,保证代码质量与可维护性。

exports/openclaw/tdd-workflow/SKILL.md mohitagw15856/pm-claude-skills

Trigger Scenarios

需要以测试为先导实现新功能 修复Bug并要求遵循TDD流程 明确要求先写测试再编码

Install

npx skills add mohitagw15856/pm-claude-skills --skill tdd-workflow -g -y
More Options

Non-standard path

npx skills add https://github.com/mohitagw15856/pm-claude-skills/tree/main/exports/openclaw/tdd-workflow -g -y

Use without installing

npx skills use mohitagw15856/pm-claude-skills@tdd-workflow

指定 Agent (Claude Code)

npx skills add mohitagw15856/pm-claude-skills --skill tdd-workflow -a claude-code -g -y

安装 repo 全部 skill

npx skills add mohitagw15856/pm-claude-skills --all -g -y

预览 repo 内 skill

npx skills add mohitagw15856/pm-claude-skills --list

SKILL.md

Frontmatter
{
    "name": "tdd-workflow",
    "homepage": "https:\/\/mohitagw15856.github.io\/pm-claude-skills\/skill\/tdd-workflow.html",
    "metadata": {
        "openclaw": {
            "emoji": "🪚"
        }
    },
    "description": "Drive a feature with a disciplined test-driven development loop — red, green, refactor. Use when implementing a feature or fixing a bug and you want tests to lead, or when asked to 'do this with TDD' \/ write the test first. Produces a step-by-step red-green-refactor plan: the failing test to write first, the minimal code to pass it, and the refactor — one small cycle at a time."
}

TDD Workflow Skill

The failure mode of AI-assisted coding is writing a pile of code, then maybe some tests that rubber-stamp it. TDD inverts that: the test defines the behavior first, the code does the minimum to pass, then you refactor safely. This skill runs that loop with discipline — one small red-green-refactor cycle at a time, never jumping ahead to untested code.

Required Inputs

Ask for these only if they aren't already provided:

  • The behavior to build — the feature/bugfix, stated as observable behavior (input → expected output).
  • The stack — language, test framework/runner, where tests live.
  • The seam — the function/module/endpoint under test, and any collaborators to fake/mock.
  • Edge cases — the conditions that matter (errors, empty, boundaries).

Output Format

TDD plan: [behavior]

Behavior list — the observable cases to drive out, ordered simplest → richest (happy path first, then edges/errors). Each becomes one cycle.

Then, for each cycle (do them one at a time, smallest first):

🔴 Red — the single failing test to write now (the actual test code), and why it fails (the behavior doesn't exist yet). One assertion of one behavior.

🟢 Green — the minimal code to make exactly that test pass — even if it's obvious/ugly. No extra features, no speculative generality.

🔵 Refactor — what to clean up now that it's green (naming, duplication, structure) with the test as the safety net. Skip if nothing's needed.

Run — the command to run the test(s) and what "passing" looks like.

End with: the next cycle's red test, and a note to commit at each green.

Quality Checks

  • Behaviors are listed and ordered simplest-first; each cycle tests ONE behavior
  • The red step writes a genuinely failing test before any implementation
  • The green step is the minimal code to pass — no untested extra functionality
  • Refactoring happens only on green, with tests as the safety net
  • Edge/error cases each get their own cycle, not bolted onto the happy path

Anti-Patterns

  • Do not write the implementation first and the test after — that's not TDD, it's rationalization
  • Do not write five tests then all the code — one red→green→refactor cycle at a time
  • Do not over-build in green — only enough to pass the current test
  • Do not test implementation details — test observable behavior so refactors don't break tests
  • Do not skip the refactor step when there's obvious duplication or a bad name

Based On

Test-Driven Development (Kent Beck): red → green → refactor, triangulation, one behavior per cycle.

Version History

  • 54fad50 Current 2026-07-19 12:35

Same Skill Collection

exports/openclaw/360-feedback-template/SKILL.md
exports/openclaw/401k-plan-decoder/SKILL.md
exports/openclaw/ab-test-planner/SKILL.md
exports/openclaw/ab-test-readout/SKILL.md
exports/openclaw/accessibility-audit/SKILL.md
exports/openclaw/account-plan/SKILL.md
exports/openclaw/acquirer-red-team/SKILL.md
exports/openclaw/ad-copy/SKILL.md
exports/openclaw/aeo-optimizer/SKILL.md
exports/openclaw/agenda-or-cancel/SKILL.md
exports/openclaw/agent-design-review/SKILL.md
exports/openclaw/agent-observability-spec/SKILL.md
exports/openclaw/agent-spec/SKILL.md
exports/openclaw/ai-ethics-review/SKILL.md
exports/openclaw/ai-eval-plan/SKILL.md
exports/openclaw/ai-feature-prd/SKILL.md
exports/openclaw/ai-product-canvas/SKILL.md
exports/openclaw/air-quality/SKILL.md
exports/openclaw/altitude-shifter/SKILL.md
exports/openclaw/ambiguity-resolver/SKILL.md
exports/openclaw/analyst-relations-brief/SKILL.md
exports/openclaw/announcement-card/SKILL.md
exports/openclaw/api-docs-writer/SKILL.md
exports/openclaw/api-test-plan/SKILL.md
exports/openclaw/api-versioning-strategy/SKILL.md
exports/openclaw/apology-letter/SKILL.md
exports/openclaw/architecture-decision-record/SKILL.md
exports/openclaw/architecture-diagram/SKILL.md
exports/openclaw/archive-strategy/SKILL.md
exports/openclaw/assumption-bounty/SKILL.md
exports/openclaw/assumption-mapper/SKILL.md
exports/openclaw/async-update-format/SKILL.md
exports/openclaw/auto-repair-estimate-decoder/SKILL.md
exports/openclaw/autopilot-charter/SKILL.md
exports/openclaw/benefits-decoder/SKILL.md
exports/openclaw/bid-tender-review/SKILL.md
exports/openclaw/board-deck-narrative/SKILL.md
exports/openclaw/board-minutes/SKILL.md
exports/openclaw/board-pre-read/SKILL.md
exports/openclaw/bom-cost-review/SKILL.md
exports/openclaw/bookkeeping-categorization/SKILL.md
exports/openclaw/boolean-search-builder/SKILL.md
exports/openclaw/brag-doc/SKILL.md
exports/openclaw/brainstorming/SKILL.md
exports/openclaw/brief-builder/SKILL.md
exports/openclaw/briefing-note/SKILL.md
exports/openclaw/budget-builder/SKILL.md
exports/openclaw/budget-variance-analysis/SKILL.md
exports/openclaw/bug-diagnosis/SKILL.md
exports/openclaw/bug-report/SKILL.md

Metadata

Files
0
Version
471c606
Hash
b1899cf2
Indexed
2026-07-19 12:35

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-30 06:08
浙ICP备14020137号-1 $방문자$