Agent skill

tdd

Enforces Test-Driven Development (Red-Green-Refactor) for rigorous code quality.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/tdd-hoangnguyen0403-agent-skills-standar

SKILL.md

Test-Driven Development (TDD)

Priority: P1 (OPERATIONAL)

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST. If you wrote code before the test: Delete it. Start over. No "adapting" or keeping as reference.

The TDD Cycle

  1. RED: Write a minimal failing test. Verify failure (Expected error, not typo).
  2. GREEN: Write the simplest code to pass. Verify pass (Pristine output).
  3. REFACTOR: Clean up code while staying green.

Core Principles

  • Watch it Fail: If you didn't see it fail, you didn't prove the test works.
  • Minimalism: Don't add features/options beyond the current test (YAGNI).
  • Real Over Mock: Prefer real dependencies unless they are slow/flaky. Avoid Anti-Patterns.

Verification Checklist

  • Every new function/method has a failing test first?
  • Failure message was expected (feature missing, not setup error)?
  • Minimal code implemented (no over-engineering)?
  • Common Pitfalls avoided?

Expert References

  • TDD Patterns & Discovery Protocols
  • Testing Anti-Patterns (Safety First)

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results