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가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
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
- Write production code only to make a failing test pass
- Write only enough test to demonstrate failure
- 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.
인기도
- GitHub 스타
- 48k
- 순위
- #5933
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
00-andruia-consultant
48k에이전트가 AI 프로젝트를 시작하거나 개선할 수 있도록 코드를 분석하고 스페인어로 실행 계획을 세워 줍니다.
007
48k에이전트가 보안 감사와 위협 모델링을 수행해 공격과 취약점으로부터 프로젝트를 보호하도록 돕습니다.
10-andruia-skill-smith
48k에이전트가 AI 도구의 작동 방식을 정의하고 문서를 쓰며 구조를 검증하도록 돕습니다.
20-andruia-niche-intelligence
48k에이전트가 신뢰할 수 있는 자료를 바탕으로 특정 산업의 맥락, 규칙, 사용 패턴, 위험을 정리한 요약을 만들도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.