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

test-driven-development

Unified TDD skill with three input modes — from spec, from task, or from description. Enforces test-first development using repository patterns, with proptest guidance and backpressure integration.

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

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.4 KB

SKILL.md(원문)

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

Test-Driven Development

Overview

One skill for all TDD workflows. Enforces test-first development using existing repository patterns. Three input modes handle different entry points — specs, task files, or ad-hoc descriptions — but the core cycle is always RED → GREEN → REFACTOR.

Input Modes

Detect the input type and follow the corresponding mode:

Mode A: From Spec (.spec.md)

Use when the input references a .spec.md file with Given/When/Then acceptance criteria.

  1. Locate and parse the spec file — extract all Given/When/Then triples
  2. Generate one test stub per criterion with todo!() bodies:
    /// Spec: <spec-file> — Criterion #<N>
    /// Given <given text>
    /// When <when text>
    /// Then <then text>
    #[test]
    fn <spec_name>_criterion_<N>_<slug>() {
        todo!("Implement: <then text>");
    }
    
  3. Verify stubs compile but fail: cargo test --no-run -p <crate>
  4. Proceed to the TDD Cycle to make stubs pass

Programmatic support: ralph_core::preflight::{extract_acceptance_criteria, extract_criteria_from_file, extract_all_criteria} can parse criteria from spec files.

Mode B: From Task (.code-task.md)

Use when the input references a .code-task.md file or a specific implementation task.

  1. Read the task and identify acceptance criteria or requirements
  2. Discover patterns (see Pattern Discovery)
  3. Design test scenarios covering normal operation, edge cases, and error conditions
  4. Write failing tests for all requirements before any implementation
  5. Proceed to the TDD Cycle

Mode C: From Description

Use for ad-hoc tasks without a spec or task file.

  1. Clarify requirements from the description
  2. Discover patterns (see Pattern Discovery)
  3. Write failing tests targeting the described behavior
  4. Proceed to the TDD Cycle

Pattern Discovery

Before writing tests, discover existing conventions:

rg --files -g "crates/*/tests/*.rs"
rg -n "#\[cfg\(test\)\]" crates/

Read 2-3 relevant test files near the target code. Mirror:

  • Test module layout, naming, and assertion style
  • Fixture helpers and test utilities
  • Use of tempfile, scenarios, or harnesses

TDD Cycle

1) RED — Failing Tests

  • Write tests for the exact behavior required
  • Run tests to confirm failure for the right reason
  • If tests pass without implementation, the test is wrong

2) GREEN — Minimal Implementation

  • Write the minimum code to make tests pass
  • No extra features or refactoring during this step

3) REFACTOR — Clean Up

  • Improve implementation and tests while keeping tests green
  • Align with surrounding codebase conventions
  • Re-run tests after every change

Proptest Guidance

Use proptest only when ALL of:

  • Function is pure (no I/O, no time, no globals)
  • Deterministic output for given input
  • Non-trivial input space or edge cases
proptest! {
    #[test]
    fn round_trip(input in "[a-z0-9]{0,32}") {
        let encoded = encode(input.as_str());
        let decoded = decode(&encoded).expect("should decode");
        prop_assert_eq!(decoded, input);
    }
}

Don't introduce proptest as a new dependency without strong justification.

Backpressure Integration

Include coverage evidence in completion events:

ralph emit "build.done" "tests: pass, lint: pass, typecheck: pass, audit: pass, coverage: pass (82%)"

Run cargo tarpaulin --out Html --output-dir coverage --skip-clean when feasible. If coverage cannot be run, state why and include targeted test evidence instead.

Test Location Rules

  • Spec maps to a single module → inline #[cfg(test)] tests
  • Spec spans multiple modules → integration test in crates/<crate>/tests/
  • CLI behavior → crates/ralph-cli/tests/
  • Follow existing patterns in the target crate

Anti-Patterns

  • Writing implementation before tests
  • Generating tests that pass without implementation
  • Copying tests from other crates without adapting to local patterns
  • Adding proptest when a simple example test suffices
  • Emitting completion events without coverage evidence

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Guides implementation of code tasks using test-driven development in an Explore, Plan, Code, Commit workflow. Acts as a Technical Implementation Partner and TDD Coach — following existing patterns, avoiding over-engineering, and producing idiomatic, modern code.

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

mikeyobrien/ralph-orchestrator3.2천2026년 10월 16일 업데이트

Generates structured .code-task.md files from descriptions or PDD implementation plans. Auto-detects input type, creates properly formatted tasks with Given-When-Then acceptance criteria.

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

mikeyobrien/ralph-orchestrator3.2천2026년 10월 16일 업데이트

Use when testing Ralph's hat collection presets, validating preset configurations, or auditing the preset library for bugs and UX issues.

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

mikeyobrien/ralph-orchestrator3.2천2026년 10월 16일 업데이트

Lists all code tasks in the repository with their status, dates, and metadata. Useful for getting an overview of pending work or finding specific tasks.

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

mikeyobrien/ralph-orchestrator3.2천2026년 10월 16일 업데이트

pdd

무료

Transforms a rough idea into a detailed design document with implementation plan. Follows Prompt-Driven Development — iterative requirements clarification, research, design, and planning.

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

mikeyobrien/ralph-orchestrator3.2천2026년 10월 16일 업데이트

Browser automation via Playwriter (remorses) using persistent Chrome sessions and the full Playwright Page API.

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

mikeyobrien/ralph-orchestrator3.2천2026년 10월 16일 업데이트

mikeyobrien의 스킬 모두 보기

이 스킬의 문제 신고