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

cc-tdd-cycle

Run a structured Red-Green-Refactor TDD cycle — write a failing test first, implement the minimum code to pass it, then refactor with the suite green.

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

설치 방법 보기

포함된 파일(1)

  • SKILL.md7.0 KB

SKILL.md(원문)

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

TDD Cycle — Red → Green → Refactor

Scope: $ARGUMENTS

Describe what behavior you want to implement. Include:

  • The function, method, or feature to implement
  • The expected behavior (inputs and outputs, or acceptance criteria)
  • Any known constraints or edge cases
  • Relevant files or modules (if known)

Before you begin — mandatory pre-check

This command enforces strict TDD discipline. The three phases are sequential and non-negotiable:

  1. RED — a failing test exists before any implementation code is written
  2. GREEN — the minimum implementation to make the test pass (no more)
  3. REFACTOR — clean up the code while keeping all tests green

Do not write implementation code during RED. Do not refactor during GREEN. Mixing phases invalidates the cycle.

Verifiable phase gates

RED → GREEN and GREEN → REFACTOR are enforced by tddCycleStateMachine in domain/loop. Evidence must be captured with npx cc-codeconductor tdd capture (verification runner) — do not hand-edit JSON under .codeconductor/evidence/.

  • RED→GREEN requires runner evidence that the suite failed.
  • GREEN→REFACTOR requires runner evidence that the suite passed.

Do not advance phases until that evidence exists.

When delivering a BACKLOG item, openspec done on the test or implement card uses the same runner evidence.


Phase 1 — RED (Tester role)

Adopt the Tester role as defined in CLAUDE.md.

1a — Scope clarification

Before writing any test, confirm:

  • What is the unit of behavior being tested? (function, method, endpoint, domain rule)
  • What are the inputs and expected outputs?
  • What are the failure cases?

If the scope is ambiguous, ask one clarifying question and wait for the answer.

1b — Write the failing test

Write a test that:

  • Targets exactly the behavior described in the scope
  • Fails for the right reason (not a compile error, not a missing dependency — the logic does not exist yet)
  • Has a name that describes the behavior: given_X_when_Y_then_Z or equivalent in the project's test naming convention
  • Covers at minimum: one happy path, one edge case, one failure case

Do not write the implementation. Do not make the test pass by any means other than the implementation that will follow in Phase 2.

1c — Run the test suite and confirm RED

Run the test suite. The new test must fail. Existing tests must pass.

If the new test passes without implementation, the test is wrong. Fix the test before continuing.

RED Phase Report:

## RED Phase Report

**Test file**: [path/to/test/file]
**Tests written**:
- [test name] — [what it verifies]

**Suite result**: [X passing, Y failing]
**New test status**: FAIL ✓
**Failure reason**: [quoted error or assertion message]
**Existing tests**: [all passing | N failing — list]

STOP. Show the RED Phase Report. Do not proceed to GREEN without confirmation.


Phase 2 — GREEN (Implementer role)

Adopt the Implementer role as defined in CLAUDE.md.

2a — Read the failing test before writing any code

Understand exactly what the test asserts. Write only the code that satisfies that assertion. Nothing more.

2b — Implement the minimum

Rules for GREEN phase:

  • Write the smallest amount of code that makes the failing test pass
  • Do not add features not tested
  • Do not clean up or restructure existing code — that is Refactor's job
  • Do not add new tests — that is another RED cycle
  • Hardcoding a return value is acceptable if it makes the test pass (the Refactor phase will generalize it)

2c — Run the test suite and confirm GREEN

Run the test suite. The new test must pass. All previously passing tests must still pass.

If any previously passing test now fails, you introduced a regression. Fix it before continuing.

GREEN Phase Report:

## GREEN Phase Report

**Files changed**:
- [path/to/file] — [what was added, one sentence]

**Implementation approach**: [one sentence — what the code does]
**Suite result**: [X passing, Y failing]
**New test status**: PASS ✓
**Regressions**: [none | list failing tests]

STOP. Show the GREEN Phase Report. Do not proceed to REFACTOR without confirmation.


Phase 3 — REFACTOR (Implementer role, then Reviewer role)

Adopt the Implementer role as defined in CLAUDE.md.

3a — Assess what needs cleaning

Before touching any code, identify:

  • Duplication introduced during GREEN
  • Names that do not clearly express intent
  • Abstractions that belong in a separate function or module
  • Logic that is hardcoded and should be generalized

Do not invent improvements. Only address what is directly in the implementation written in Phase 2.

3b — Refactor

Rules for REFACTOR phase:

  • All tests must remain GREEN throughout — run the suite after each change
  • Do not add new behavior
  • Do not add new tests (if you discover untested behavior, note it for a new RED cycle)
  • Do not change function signatures unless the original was clearly wrong

3c — Run the test suite and confirm GREEN after refactor

The full suite must pass. If any test fails during refactor, undo the last change and investigate.

3d — Review (Reviewer role)

Adopt the Reviewer role as defined in CLAUDE.md.

Review only the refactored code against these axes:

AxisWhat to check
ScopeDid the refactor change any behavior?
CorrectnessDoes the logic still satisfy the original test intent?
ArchitectureDoes the code follow existing project patterns?
Test coverageAre all written tests still meaningful (not trivially passing)?

Produce a Review Report. CRITICAL findings block completion.

REFACTOR Phase Report:

## REFACTOR Phase Report

**Changes made**:
- [path/to/file] — [what was cleaned up]

**Suite result**: [X passing, Y failing]
**Behavioral changes**: none (refactor only)

### Review findings
**CRITICAL**: (none) | [list]
**WARNING**: (none) | [list]
**SUGGESTION**: (none) | [list]

**Verdict**: approved | approved with warnings | blocked

Completion

The TDD cycle is complete when:

  • RED: at least one failing test was written and confirmed failing
  • GREEN: the minimum implementation makes the test pass
  • REFACTOR: the code is clean, all tests pass, no CRITICAL review findings

Final Summary:

## TDD Cycle Summary

**Behavior implemented**: [one sentence]
**Tests written**: [count] — [list test names]
**Files changed**: [list]
**Suite result**: [X passing, Y failing]
**Cycle status**: complete | blocked (reason)

If the behavior requires additional test cases, start a new /cc:tdd-cycle with the next scenario. One cycle = one behavior.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Use when adding monitoring, metrics, logging, or tracing to Spring AI or LLM integration code. Covers token tracking, latency measurement, cost estimation, and prompt/response logging. Use when user mentions AI monitoring, token costs, or LLM observability.

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

lgzarturo/springboot-course32026년 10월 20일 업데이트

android

무료

Provides expert knowledge for building modern native Android apps using Kotlin, Jetpack Compose, Material Design 3, MVI architecture, Hilt dependency injection, and Media3/ExoPlayer.

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

lgzarturo/springboot-course32026년 10월 20일 업데이트

Design, implement, review, and audit Android Jetpack Compose UI/UX for phone interfaces. Use when a request concerns concrete Compose layout, components, interaction, accessibility, or visual behavior. Do not activate for framework or dependency presence alone; non-UI Android work is excluded.

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

lgzarturo/springboot-course32026년 10월 20일 업데이트

Provides expert knowledge for designing, implementing, and managing REST API versioning strategies with deprecation workflows.

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

lgzarturo/springboot-course32026년 10월 20일 업데이트

astro

무료

Provides expert knowledge for building Astro 5+ sites with Islands Architecture, Content Collections, TypeScript, and performance-first rendering strategies.

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

lgzarturo/springboot-course32026년 10월 20일 업데이트

Audits token storage mechanisms to prevent XSS-based JWT theft.

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

lgzarturo/springboot-course32026년 10월 20일 업데이트

lgzarturo의 스킬 모두 보기

이 스킬의 문제 신고