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

test-driven-development

Use when implementing deterministic, reusable code where regressions would warrant a CI red light. Enforces RED-GREEN-REFACTOR. Applicability rule and skip conditions inside.

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

btseytlin/ultrapack스타 46(GitHub 46 + cccskills 0)

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.3 KB

SKILL.md(원문)

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

Test-Driven Development

Write the test first. Watch it fail. Write minimal code to pass. Refactor. Repeat.

Core principle: if you didn't watch the test fail, you don't know whether it tests the right thing.

Applicability — invoke only when all three hold

<applies-when> 1. The code produces specific outputs for specific inputs (deterministic I/O contract) 2. It is called from more than one place (library code, API method, utility, validator) 3. A regression here would warrant a CI red light </applies-when>

Skip conditions — do not invoke when any holds

<skip-when> - Training a model, hyperparameter tuning, anything stochastic with no "correct" output - Exploratory data analysis (you're figuring out what's in the data) - One-off scripts or throwaway prototypes - Research / experiment code - UI changes where the real test is "does it look right" </skip-when>

The decision is recorded during up:udesign as TDD: yes or TDD: no (reason).

Iron law when applicable — no production code without a failing test first

Wrote code before the test? Delete it. Start over from the test. Don't "adapt" what you wrote — the test will be shaped by the code instead of shaping it.

Phase 1 — RED: write a failing test

  • One behavior per test
  • Clear name describing the behavior
  • Real code path where possible; mocks only when genuinely unavoidable
def test_retry_succeeds_after_two_failures():
    attempts = 0
    def op():
        nonlocal attempts
        attempts += 1
        if attempts < 3:
            raise RuntimeError("fail")
        return "success"
    assert retry(op, max_attempts=3) == "success"
    assert attempts == 3

Phase 2 — Verify RED: run it, confirm it fails for the right reason

<required> - It fails (not an import/syntax error) - The failure reason is "feature missing", not a typo - The error message matches what you expected </required>

Test passed immediately? You're testing behavior that already exists. Fix the test.

Phase 3 — GREEN: minimal code to pass

def retry(op, max_attempts):
    for i in range(max_attempts):
        try:
            return op()
        except Exception:
            if i == max_attempts - 1:
                raise
    raise RuntimeError("unreachable")

Don't add features, options, or "while I'm here" changes. Just pass the test.

Phase 4 — Verify GREEN: run it, confirm it passes, nothing else broke

Run the new test and the existing suite. If either fails: back to GREEN (not RED — don't change the test).

Phase 5 — REFACTOR: clean up with tests green

Names, duplication, helpers. Keep tests green. Don't add behavior in this step. Then loop back to RED for the next test.

Good tests

<good-test> - Minimal — one behavior per test. If "and" appears in the name, split. - Clear — name describes what it checks. - Real — exercises actual code, not mocks pretending to be code. </good-test>

Red flags — stop and start over

<red-flags> - You wrote code before the test - A test passes immediately on first run - You can't explain why a test failed the way it did - You're keeping old code "as reference" while writing tests — delete it - You're "adapting" existing code while writing tests — that's tests-after, not TDD </red-flags>

Why order matters

Tests-after answer: what does this do? Tests-first answer: what should this do?

Tests-after are biased by the implementation you already wrote. Tests-first force edge-case discovery before you commit to a design.

When stuck

  • Don't know how to test: write the wished-for API in the test first; let it drive the implementation shape
  • Test is too complicated: the interface is too complicated; simplify it
  • Must mock everything: the code is too coupled; use dependency injection
  • Huge setup: extract helpers; if it stays huge, the design is wrong

For bug fixes

Write a failing test that reproduces the bug. Then RED-GREEN-REFACTOR. The test proves the fix and prevents regression.

Final rule

Production code → a test exists and was written first and failed first
Otherwise → not TDD

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Run a bounded implement-attack-repair loop for a user-specified task. Use when work needs repeated independent criticism: perform the task, dispatch a fresh attacker, verify significant findings, repair them, and stop on a clean attack or the user's round limit.

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

btseytlin/ultrapack462026년 10월 15일 업데이트

e

무료

Explain a file, error, design, diff, or concept like a helpful engineering colleague: grounded in evidence, concise, and with useful follow-up threads. Use when the user asks for a clear explanation of the current work or codebase.

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

btseytlin/ultrapack462026년 10월 15일 업데이트

expand

무료

Turn one user criticism into a principle-level fix: find the violated principle, every similar occurrence, and fix the shared cause. Use only when the user explicitly invokes expand, $expand, /up:expand, or /skill:expand.

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

btseytlin/ultrapack462026년 10월 15일 업데이트

Use when a task needs an isolated checkout. Verify the worktree location, keep mutable environments and build outputs local, and run only authorized setup and checks.

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

btseytlin/ultrapack462026년 10월 15일 업데이트

handsoff

무료

Contract for hands-off mode — the ultrapack workflow variant that minimizes user prompts after Design, takes the safest reversible path, and logs every auto-choice for one end-of-task review. Referenced by the workflow entry point and child skills (udesign, uplan, uexecute, uverify, ureview). Read when the task file's **Mode:** header is `hands-off`.

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

btseytlin/ultrapack462026년 10월 15일 업데이트

Use when the user explicitly asks to launch and supervise a job. Require an authorized launch, monitoring, recovery, and teardown contract. Detect failures without inventing permission to restart or spend money.

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

btseytlin/ultrapack462026년 10월 15일 업데이트

btseytlin의 스킬 모두 보기

이 스킬의 문제 신고