skill-tdd

GitHub

指导遵循测试驱动开发(TDD)流程,严格执行红绿重构循环。要求先写失败测试验证行为,再实现最小代码使其通过,最后重构并保持测试绿色。禁止无测试直接修改生产代码。

.claude/skills/skill-tdd/SKILL.md nyldn/claude-octopus

Trigger Scenarios

用户请求使用 TDD 或测试驱动开发方法 用户启用 --peer-review 进行独立审查 需要严格的行为变更验证场景

Install

npx skills add nyldn/claude-octopus --skill skill-tdd -g -y
More Options

Non-standard path

npx skills add https://github.com/nyldn/claude-octopus/tree/main/.claude/skills/skill-tdd -g -y

Use without installing

npx skills use nyldn/claude-octopus@skill-tdd

指定 Agent (Claude Code)

npx skills add nyldn/claude-octopus --skill skill-tdd -a claude-code -g -y

安装 repo 全部 skill

npx skills add nyldn/claude-octopus --all -g -y

预览 repo 内 skill

npx skills add nyldn/claude-octopus --list

SKILL.md

Frontmatter
{
    "name": "skill-tdd",
    "paths": [
        "**\/*.test.*",
        "**\/*.spec.*",
        "**\/tests\/**",
        "**\/__tests__\/**"
    ],
    "aliases": [
        "tdd",
        "test-driven-development"
    ],
    "trigger": "Use when a feature, bug fix, or behavior change requires test-first evidence.\nDo not use for documentation-only changes or disposable exploration.\n",
    "description": "Build a behavior change with observed red, minimal green, and measured test consolidation",
    "validation_gates": [
        "focused_red_observed",
        "focused_and_affected_suites_green"
    ],
    "pre_execution_contract": [
        "observable_behavior_named"
    ],
    "disable-model-invocation": true
}

Test-driven development

Read skills/blocks/engineering-method-selection.md from the installed plugin for review admission. Natural-language requests and --peer-review share that policy. Honor host-only requests; risk alone does not authorize paid usage.

Run the red, green, and refactor cycle on the current host. Routine TDD makes zero additional provider dispatches. Use one external reviewer only when the user passes --peer-review, explicitly requests independent review, or an existing risk policy requires it. Explicit debate, council, and multi-model commands retain their own execution contracts.

NO PRODUCTION BEHAVIOR CHANGE WITHOUT AN OBSERVED, EXPECTED FAILING TEST FIRST.

The rule

Do not change production behavior until a focused test fails for the expected reason. Existing implementation outside the requested change remains intact.

  1. Name the observable behavior and the smallest public boundary that proves it.
  2. Write one focused test. Directly test an internal invariant only when the public boundary cannot isolate its failure mode.
  3. Run it and record the expected failure, command, and exit status.
  4. Implement the smallest change that passes.
  5. Run the focused test, then the affected suite.
  6. Refactor only while the tests remain green.

If a test passes before implementation, it is not red evidence. If it errors due to fixture or syntax problems, repair the test until it fails on the missing behavior.

Consolidating tests

Do not equate similar assertions with duplicate guarantees. Keep separate OS, security, cancellation, and integration boundaries. For every removed test, record old_test, behavior, replacement, mutant, red_observed, baseline_ms, candidate_ms, and reason. The retained test must kill the named mutant at the intended caller boundary.

After one warm-up, measure five isolated runs and report every sample and the median. Review a slowdown only when it exceeds both 20 percent and 100 ms.

Completion requires observed red and green evidence, affected-suite results, and the consolidation ledger when tests were removed. A missing reviewer is reported as incomplete review, never simulated.

Strategy rotation

If the same test remains red after two implementation attempts, stop and recheck the test boundary, fixture, and expected behavior. The strategy-rotation hook is a signal to try a fundamentally different hypothesis, not another variation of the same patch.

Adapted from DEEPENING in mattpocock/skills at commit 3cca18b368ae95cdbdebbff572ccafa662551015 under the MIT License. See THIRD_PARTY_NOTICES.md.

Version History

  • 2d3ee65 Current 2026-09-22 23:05

    简化了违规惩罚描述,移除了对 orchestrate.sh 的强制依赖,强调自然语言请求和 peer-review 共享准入策略,优化了测试合并与性能测量的记录规范。

  • 242e51d 2026-08-20 09:31

Same Skill Collection

.claude/skills/extract-skill/SKILL.md
.claude/skills/flow-define/SKILL.md
.claude/skills/flow-deliver/SKILL.md
.claude/skills/flow-develop/SKILL.md
.claude/skills/flow-parallel/SKILL.md
.claude/skills/flow-spec/SKILL.md
.claude/skills/skill-agent-topology/SKILL.md
.claude/skills/skill-architecture/SKILL.md
.claude/skills/skill-audit/SKILL.md
.claude/skills/skill-authoring/SKILL.md
.claude/skills/skill-claw/SKILL.md
.claude/skills/skill-code-review/SKILL.md
.claude/skills/skill-content-pipeline/SKILL.md
.claude/skills/skill-context-detection/SKILL.md
.claude/skills/skill-copilot-provider/SKILL.md
.claude/skills/skill-cost-projections/SKILL.md
.claude/skills/skill-coverage-audit/SKILL.md
.claude/skills/skill-debate/SKILL.md
.claude/skills/skill-debug/SKILL.md
.claude/skills/skill-decision-support/SKILL.md
.claude/skills/skill-deck/SKILL.md
.claude/skills/skill-deep-research/SKILL.md
.claude/skills/skill-design-lineage/SKILL.md
.claude/skills/skill-doc-delivery/SKILL.md
.claude/skills/skill-doc-sync/SKILL.md
.claude/skills/skill-doctor/SKILL.md
.claude/skills/skill-factory/SKILL.md
.claude/skills/skill-finish-branch/SKILL.md
.claude/skills/skill-intake/SKILL.md
.claude/skills/skill-intent-contract/SKILL.md
.claude/skills/skill-issues/SKILL.md
.claude/skills/skill-iterative-loop/SKILL.md
.claude/skills/skill-knowledge-work/SKILL.md
.claude/skills/skill-meta-prompt/SKILL.md
.claude/skills/skill-native-escalation-routing/SKILL.md
.claude/skills/skill-parallel-agents/SKILL.md
.claude/skills/skill-prd/SKILL.md
.claude/skills/skill-pressure-test/SKILL.md
.claude/skills/skill-prototype/SKILL.md
.claude/skills/skill-quick/SKILL.md
.claude/skills/skill-resume/SKILL.md
.claude/skills/skill-review-response/SKILL.md
.claude/skills/skill-rollback/SKILL.md
.claude/skills/skill-security-audit/SKILL.md
.claude/skills/skill-security-framing/SKILL.md
.claude/skills/skill-ship/SKILL.md
.claude/skills/skill-staged-review/SKILL.md
.claude/skills/skill-status/SKILL.md
.claude/skills/skill-task-management-v2/SKILL.md

Metadata

Files
0
Version
2d3ee65
Hash
fb6141e0
Indexed
2026-08-20 09:31

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-23 16:55
浙ICP备14020137号-1