agentsclimarketplace

Test driven development skills dmjgilbert test driven development

Skill bg-szy/TOP-SKILLS/skills/marketplace/test-driven-development__skills-dmjgilbert-test-driven-development

全球最大的 Claude Code 技能聚合库 · 收录 3900+ 来自 12+ 来源的技能,提供在线搜索与趋势分析看板 / The world's largest Claude Code skill aggregation hub — 3900+ skills from 12+ sources with online search and trend dashboard

Install
npx -y skills add bg-szy/TOP-SKILLS --skill test-driven-development__skills-dmjgilbert-test-driven-development

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Enforce RED-GREEN-REFACTOR cycle. Use when implementing features, fixing bugs, or writing any production code.

SKILL.md

2.7 KB, as published. Nobody here has run it

Test-Driven Development

Write the test first. Watch it fail. Write minimal code to pass.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Any code written before its corresponding test must be deleted entirely - no exceptions for "reference" or "adapting" existing work.

Red-Green-Refactor Cycle

RED: Write Failing Test

  1. Write ONE minimal failing test demonstrating desired behavior
  2. Use clear naming that describes the behavior
  3. Test real code, not mocks (mock only external dependencies)
  4. Focus on ONE behavior per test

Verify RED (CRITICAL)

Run tests and confirm:

  • Test fails (not errors)
  • Failure indicates missing feature
  • Error message matches expectations

If test passes immediately → DELETE IT (it proves nothing)

GREEN: Make It Pass

  1. Implement the simplest code that passes the test
  2. Avoid over-engineering
  3. Don't add features not requested
  4. Keep scope narrow

Verify GREEN

  • All tests pass
  • No other tests broke

REFACTOR: Clean Up

  1. Clean up while ALL tests remain green
  2. Remove duplication (DRY)
  3. Improve naming
  4. Extract helpers if needed

Why Tests-First Matters

Tests written after code pass immediately, proving nothing about their validity. Tests-first:

  • Force discovery of edge cases before implementation
  • Provide systematic verification impossible with manual testing
  • Document expected behavior

Common Rationalizations (ALL REJECTED)

ExcuseWhy It's Wrong
"Too simple to test"Simple code still needs verification
"I'll test after"Tests-after pass immediately, proving nothing
"Already manually tested"Manual testing isn't repeatable or documented
"Deleting hours of work is wasteful"Sunk cost fallacy - untested code is liability

When to Use TDD

Always: New features, bug fixes, refactoring, behavior changes

Exceptions only: Throwaway prototypes, generated code, config files (with permission)

Red Flags Requiring Restart

  • Code written before test
  • Test passes immediately
  • Can't explain why test should fail
  • Rationalizing "just this once"

→ DELETE the code and recommence with failing test

When 3+ Test Fixes Fail

STOP. This signals an architectural problem:

  1. Return to investigation phase
  2. Question whether the underlying pattern is sound
  3. Discuss with user before attempting more fixes

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.