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

tdd-workflow

Use this skill when the user explicitly asks for TDD or a tests-first workflow, or when developing a new feature with a test coverage requirement. Provides a structured red-green-refactor workflow with unit, integration, and E2E test guidance.

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

설치 방법 보기

포함된 파일(4)

  • SKILL.md4.1 KB
  • references/test-templates.md3.8 KB
  • references/testing-mistakes.md2.3 KB
  • scripts/check-coverage.sh1.3 KB

SKILL.md(원문)

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

Test-Driven Development Workflow

This skill provides a structured TDD workflow for projects that adopt tests-first development.

When to Activate

  • The user explicitly asks for TDD or tests-first development
  • New feature work where test coverage is a stated requirement
  • Adding API endpoints or components under a coverage policy

For routine bug fixes or refactors, add focused tests for the changed behavior instead of invoking this full workflow (the /tdd command and tdd-guide agent remain available when you want it explicitly).

Core Principles

1. Tests BEFORE Code

Within this workflow, the default is to write tests first, then implement code to make tests pass.

2. Coverage Guidance

  • Coverage target follows the project's own standard (e.g., 80% as a common baseline); scale effort with the size of the change
  • Cover relevant edge cases
  • Test error scenarios
  • Verify boundary conditions

3. Test Types

Unit Tests - Individual functions, utilities, component logic, pure functions, helpers.

Integration Tests - API endpoints, database operations, service interactions, external API calls.

E2E Tests (Playwright) - Critical user flows, complete workflows, browser automation, UI interactions. Applies to web UI projects only.

TDD Workflow Steps

Step 1: Write User Journeys

As a [role], I want to [action], so that [benefit]

Example:
As a user, I want to search for markets semantically,
so that I can find relevant markets even without exact keywords.

Step 2: Generate Test Cases

For each user journey, create comprehensive test cases covering happy paths, edge cases, fallback behavior, and sorting/filtering logic.

Step 3: Run Tests (They Should Fail)

Use the project's test runner. Examples:

npm test                      # Node.js
pytest                        # Python
bash tests/run-unit-tests.sh  # shell projects
# Tests should fail - we haven't implemented yet

Step 4: Implement Code

Write minimal code to make tests pass.

Step 5: Run Tests Again

Re-run the same test command (e.g., npm test, pytest):

npm test
# Tests should now pass

Step 6: Refactor

Improve code quality while keeping tests green:

  • Remove duplication
  • Improve naming
  • Optimize performance
  • Enhance readability

Step 7: Verify Coverage

Use the project's coverage tooling. Examples:

npm run test:coverage   # Node.js
pytest --cov            # Python
# Verify coverage meets the project's target

Best Practices

  1. Write Tests First - Always TDD
  2. One Assert Per Test - Focus on single behavior
  3. Descriptive Test Names - Explain what's tested
  4. Arrange-Act-Assert - Clear test structure
  5. Mock External Dependencies - Isolate unit tests
  6. Test Edge Cases - Null, undefined, empty, large
  7. Test Error Paths - Not just happy paths
  8. Keep Tests Fast - Unit tests < 50ms each
  9. Clean Up After Tests - No side effects
  10. Review Coverage Reports - Identify gaps

Success Metrics

  • Coverage target met (per project standard, e.g., 80%)
  • All tests passing (green)
  • No skipped or disabled tests
  • Fast test execution (< 30s for unit tests)
  • E2E tests cover critical user flows
  • Tests catch bugs before production

References

These templates target JavaScript/TypeScript stacks; adapt the structure for other languages.

  • references/test-templates.md - Unit, integration, E2E, and mocking code templates (JS/TS)
  • references/testing-mistakes.md - Common pitfalls, file organization, coverage config, CI setup (JS/TS)

Remember: Give changed behavior a focused test. Tests are the safety net that enables confident refactoring, rapid development, and production reliability.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.

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

cloudnative-co/claude-code-starter-kit1542026년 10월 12일 업데이트

ClickHouse database patterns, query optimization, analytics, and data engineering best practices for high-performance analytical workloads.

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

cloudnative-co/claude-code-starter-kit1542026년 10월 12일 업데이트

日本語の業務文書を作成・修正するときに使用する共通品質基準。事実性、確度、論理、簡潔さ、自然な日本語を守る。提案書、報告、技術説明、議事録、メール、Slack、要約、レビューに適用する。創作、広告コピー、コードや構造化データだけの生成には使用しない。

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

cloudnative-co/claude-code-starter-kit1542026년 10월 12일 업데이트

Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.

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

cloudnative-co/claude-code-starter-kit1542026년 10월 12일 업데이트

Formal evaluation framework for Claude Code sessions implementing eval-driven development (EDD) principles.

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

cloudnative-co/claude-code-starter-kit1542026년 10월 12일 업데이트

Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.

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

cloudnative-co/claude-code-starter-kit1542026년 10월 12일 업데이트

cloudnative-co의 스킬 모두 보기

이 스킬의 문제 신고