본문으로 건너뛰기
Skillpedia
테스트48k · #5933

tdd-workflow

하는 일

이 스킬은 체계적이고 신뢰할 수 있는 방식으로 코드를 작성하도록 돕습니다. 먼저 실패하는 테스트를 쓰고, 그다음 테스트를 통과할 최소한의 코드를 쓰고, 마지막으로 코드 품질을 개선하는 주기를 안내합니다.

사용하는 경우

  • ✓새 기능을 시작할 때.
  • ✓버그를 고칠 때.
  • ✓복잡한 로직을 다루는 경우.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/tdd-workflow/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/tdd-workflow/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“두 숫자를 더하는 함수를 만들기 위해 TDD 주기를 적용하도록 도와주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 다음 주기를 따릅니다. 먼저 코드가 무엇을 해야 하는지 설명하면 AI가 실패하는 테스트를 작성합니다. 그다음 AI가 테스트를 통과하는 가장 단순한 코드를 씁니다. 마지막으로 AI가 테스트를 깨뜨리지 않으면서 코드를 검토하고 개선합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

TDD Workflow

Write tests first, code second.


1. The TDD Cycle

🔴 RED → Write failing test
    ↓
🟢 GREEN → Write minimal code to pass
    ↓
🔵 REFACTOR → Improve code quality
    ↓
   Repeat...

2. The Three Laws of TDD

  1. Write production code only to make a failing test pass
  2. Write only enough test to demonstrate failure
  3. Write only enough code to make the test pass

3. RED Phase Principles

What to Write

Focus Example
Behavior "should add two numbers"
Edge cases "should handle empty input"
Error states "should throw for invalid data"

RED Phase Rules

  • Test must fail first
  • Test name describes expected behavior
  • One assertion per test (ideally)

4. GREEN Phase Principles

Minimum Code

Principle Meaning
YAGNI You Aren't Gonna Need It
Simplest thing Write the minimum to pass
No optimization Just make it work

GREEN Phase Rules

  • Don't write unneeded code
  • Don't optimize yet
  • Pass the test, nothing more

5. REFACTOR Phase Principles

What to Improve

Area Action
Duplication Extract common code
Naming Make intent clear
Structure Improve organization
Complexity Simplify logic

REFACTOR Rules

  • All tests must stay green
  • Small incremental changes
  • Commit after each refactor

6. AAA Pattern

Every test follows:

Step Purpose
Arrange Set up test data
Act Execute code under test
Assert Verify expected outcome

7. When to Use TDD

Scenario TDD Value
New feature High
Bug fix High (write test first)
Complex logic High
Exploratory Low (spike, then TDD)
UI layout Low

8. Test Prioritization

Priority Test Type
1 Happy path
2 Error cases
3 Edge cases
4 Performance

9. Anti-Patterns

❌ Don't ✅ Do
Skip the RED phase Watch test fail first
Write tests after Write tests before
Over-engineer initial Keep it simple
Multiple asserts One behavior per test
Test implementation Test behavior

10. AI-Augmented TDD

Multi-Agent Pattern

Agent Role
Agent A Write failing tests (RED)
Agent B Implement to pass (GREEN)
Agent C Optimize (REFACTOR)

Remember: The test is the specification. If you can't write a test, you don't understand the requirement.

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
자주 묻는 질문

'RED', 'GREEN', 'REFACTOR'는 무엇을 뜻하나요?

'RED'는 테스트가 실패하는 상태입니다. 'GREEN'은 코드가 테스트를 통과하는 상태입니다. 'REFACTOR'는 모든 것이 계속 작동하는 상태를 유지하면서 코드를 개선하는 것입니다.

왜 코드보다 테스트를 먼저 쓰나요?

테스트를 먼저 쓰면 코드가 정확히 무엇을 해야 하는지 알게 되고, 불필요한 코드를 피하는 데 도움이 됩니다.

'YAGNI'란 무엇인가요?

'You Aren't Gonna Need It'의 약자로, '그건 필요하지 않을 것이다'라는 뜻입니다. 지금 당장 꼭 필요한 코드만 작성하라는 원칙입니다.

상세 정보

작성자의 원본 설명

Test-Driven Development workflow principles. RED-GREEN-REFACTOR cycle.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5933
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬