본문으로 건너뛰기
cccskills
무료GitHub에 공개

tdd

Discipline skill — TDD red-green-refactor cycle. Use when implementing any feature or bugfix, before writing implementation code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md5.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Test-Driven Development (TDD)

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

Core principle: If you didn't watch the test fail, you don't know if it tests the right thing.

Usage

/tdd

Invoke this skill before implementing any feature or bugfix. It establishes the discipline for your implementation session.

When to use

  • New features
  • Bug fixes
  • Refactoring
  • Behavior changes

Exceptions (ask the user): throwaway prototypes, generated code, configuration files.

The Iron Law

NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST

Write code before the test? Delete it. Start over.

  • Don't keep it as "reference"
  • Don't "adapt" it while writing tests
  • Don't look at it
  • Delete means delete

Red-Green-Refactor

RED - Write Failing Test

Write one minimal test showing what should happen.

Requirements:

  • One behavior per test
  • Clear name that describes behavior
  • Real code (no mocks unless unavoidable)

Run the test. Confirm:

  • Test fails (not errors)
  • Failure message is expected
  • Fails because feature missing (not typos)

Test passes? You're testing existing behavior. Fix the test.

GREEN - Minimal Code

Write the simplest code to pass the test.

Don't add features, refactor other code, or "improve" beyond the test.

Run the test. Confirm:

  • Test passes
  • Other tests still pass
  • Output pristine (no errors, warnings)

Test fails? Fix code, not test.

REFACTOR - Clean Up

After green only:

  • Remove duplication
  • Improve names
  • Extract helpers

Keep tests green. Don't add behavior.

Repeat

Next failing test for next behavior.

Good Tests

QualityGoodBad
MinimalOne thing. "and" in name? Split it.test('validates email and domain and whitespace')
ClearName describes behaviortest('test1')
Shows intentDemonstrates desired APIObscures what code should do

Common Rationalizations

ExcuseReality
"Too simple to test"Simple code breaks. Test takes 30 seconds.
"I'll test after"Tests passing immediately prove nothing.
"Tests after achieve same goals"Tests-after = "what does this do?" Tests-first = "what should this do?"
"Already manually tested"Ad-hoc is not systematic. No record, can't re-run.
"Deleting X hours is wasteful"Sunk cost fallacy. Keeping unverified code is technical debt.
"Need to explore first"Fine. Throw away exploration, start with TDD.
"Test hard = design unclear"Listen to the test. Hard to test = hard to use.
"TDD will slow me down"TDD is faster than debugging.

Red Flags - STOP and Start Over

  • Code before test
  • Test after implementation
  • Test passes immediately
  • Can't explain why test failed
  • Rationalizing "just this once"
  • "I already manually tested it"
  • "Keep as reference"

All of these mean: Delete code. Start over with TDD.

Bug Fix Flow

  1. Write failing test reproducing the bug
  2. Verify RED (test fails as expected)
  3. Implement minimal fix
  4. Verify GREEN (test passes, all tests pass)
  5. Refactor if needed

Never fix bugs without a test.

When Stuck

ProblemSolution
Don't know how to testWrite wished-for API. Write assertion first.
Test too complicatedDesign too complicated. Simplify interface.
Must mock everythingCode too coupled. Use dependency injection.
Test setup hugeExtract helpers. Still complex? Simplify design.

Verification Checklist

Before marking work complete:

  • Every new function/method has a test
  • Watched each test fail before implementing
  • Each test failed for expected reason
  • Wrote minimal code to pass each test
  • All tests pass
  • Output pristine (no errors, warnings)
  • Tests use real code (mocks only if unavoidable)
  • Edge cases and errors covered

Can't check all boxes? You skipped TDD. Start over.

Related Skills

  • /debug — systematic debugging when tests reveal unexpected failures
  • /verify — verification before claiming work is complete

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Full pipeline: evaluation -> spec -> implementation -> review -> QA

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Guild-Agents/guild42026년 7월 21일 업데이트

council

무료

Convenes multiple agents to debate an important decision

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Guild-Agents/guild42026년 7월 21일 업데이트

create-pr

무료

Create a pull request from the current branch with structured summary

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Guild-Agents/guild42026년 7월 21일 업데이트

debug

무료

Discipline skill — systematic debugging process. Use when encountering any bug, debug issue, test failure, broken function, or unexpected behavior, before proposing fixes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Guild-Agents/guild42026년 7월 21일 업데이트

Enriches CLAUDE.md by exploring the project and specializes agents to the real stack

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Guild-Agents/guild42026년 7월 21일 업데이트

qa-cycle

무료

QA + bugfix cycle until it passes

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Guild-Agents/guild42026년 7월 21일 업데이트

Guild-Agents의 스킬 모두 보기

이 스킬의 문제 신고