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

red-green-proof

Verify a bug with a test that fails before the fix, passes afterward, and fails again when the fix is temporarily removed. Record actual results to show that the test detects the defect and the change addresses it.

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

원문원문 설명 보기

Turns a suspected bug into a proven one. Verify the cause against reality before claiming it, write a test that FAILS on the current code, apply the fix, watch it pass — then revert the fix and confirm the test goes red again, because a test that passes both ways proves nothing. Invoked bare after a debugging conversation, it takes the target from context rather than asking. Use when fixing a bug, investigating an incident, hardening a flaky area, or when asked to "add tests that reveal the bug". Triggers on "/red-green-proof", "prove the bug", "red-green", "make the test fail first", "is that test load-bearing", "reveal the bug with a test".

실행 점수 미검증

설치 방법 보기

이럴 때 유용합니다

  • Reproducing a suspected bug before changing code
  • Checking whether a regression test detects the defect
  • Investigating an incident with recorded test evidence
  • Preserving failure conditions for an intermittent test

포함된 파일(4)

  • SKILL.md9.4 KB
  • README.md620 B
  • scripts/README.md205 B
  • scripts/red_green_evidence.py1.5 KB

SKILL.md(원문)

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

Red-Green-Proof

A bug is not fixed because the tests pass. A bug is fixed when a test fails without your fix and passes with it, and you have watched it do both.

Overview

Use this skill when a bug, incident, flaky test, or unproven regression test is under investigation. It applies a strict red-green-red loop: establish the cause, observe a focused test fail, make the smallest fix, then remove the fix and observe the test fail again. The final revert is the proof that the test is actually coupled to the defect.

Workflow

Keep evidence for each phase separate. A test command that exits zero is not evidence that it exercised the defect; record the assertion and the observed failure or success. Do not proceed when the current phase is unobserved.

Before changing code, identify the exact test command and expected red signal. After the fix, run that same command without changing its assertions. During the revert, use the same command again and preserve the failure output. Restore the fix before running the broader suite.

Proactive Triggers

  • A pull request adds a regression test but no pre-fix failure is recorded → ask for the red run before calling it coverage.
  • A bug fix changes production code and tests in one step → verify the test fails against the parent revision or label the evidence as missing.
  • A test uses only mocks or call-count assertions → ask for the observable user-facing consequence.
  • A test is described as flaky → preserve the failing seed, timing, or interleaving before attempting a stabilization fix.

Output Format

Report each investigation with: (1) target and cause, labeled Proven, Inferred, or Unknown; (2) the red command and actual failure before the fix; (3) green and revert-red results with actual output; and (4) final suite status and remaining uncertainty.

Most "regression tests" written after a fix never had the chance to fail. They are decoration. This skill is the discipline that separates a real test from a decorative one.

Picking the target

With an argument, that is the target: /red-green-proof the status endpoint reports finished runs as running.

With no argument, take the target from the conversation. The usual case is that you have just spent a long stretch investigating something — the bug is already on screen. Do not ask what to work on. Scan back through the session and pick, in this order:

  1. A defect just identified but not yet fixed.
  2. A fix applied without a failing test to back it — the most valuable target, because the test still has to be proven load-bearing.
  3. A test written but never verified red.
  4. Something described as "still open", "not fixed yet", or "characterization only".

State your pick in one line and start:

Target: the buffer discards events when the flush write fails (checkpointBuffer.ts:271). Verifying before writing the test.

Only ask the user if two or more candidates are genuinely equal in priority — then list them as a short numbered choice and stop. If several related defects came up, handle them one at a time through the full loop rather than batching; each needs its own red.

If nothing in the conversation qualifies, say so and ask for a target rather than inventing one.

The loop

Run these in order. Do not skip 1, and never skip 4.

1. Verify the cause. Do not infer it.

Before you write a line of test code, establish what actually happened using evidence you can point at: the real record from the database or API, the real log line, the actual source of the function you are blaming.

Say which of these you have:

  • Proven — I read the value / ran the code / pulled the record.
  • Inferred — consistent with the evidence, but I have not confirmed it.
  • Unknown — I cannot determine this from what is available.

State the label out loud. If the honest answer is Unknown, say so and name the one artifact that would settle it. A confident wrong cause costs more than an admitted gap, because it sends the fix to the wrong place.

Two traps worth naming:

  • A plausible mechanism is not the mechanism. Rank candidates, then go rule them out one at a time by reading code, not by reasoning about it.
  • Check whether the "bug" was deliberate. git log -S '<the exact line>' and read the commit. If a test already asserts the current behaviour, someone may have wanted it. Understand why before you invert it.

2. Write the test. Watch it fail.

The test must fail against the code as it is right now, before any fix exists.

Name it after the defect, not the function: reveals bug: stale status shadows a terminal event, not test inferStatus.

Assert the observable consequence a user or caller would see — the wrong status, the lost record, the 500 — not an internal call count. Call counts pass for the wrong reasons.

If it does not fail, you have not reproduced the bug. Go back to step 1.

3. Fix it.

Smallest change that makes the failing test pass. If the fix needs to be large, the test was probably too broad — narrow it and split.

4. Revert the fix. Confirm red. ← the whole point

Put the buggy code back, run the test, and watch it fail. Then restore the fix.

cp path/to/fixed.ts /tmp/fix.bak
# revert the fix (edit, patch, or git stash the single file)
<run the specific test>          # MUST fail here
cp /tmp/fix.bak path/to/fixed.ts
<run the specific test>          # green again

If it stayed green, the test is fake. Not "probably fine" — fake. Rewrite it and repeat.

This is not paranoia. It catches a specific, common failure: a test that exercises a path adjacent to the bug rather than the bug. Two real examples:

  • A concurrency test modelled two writers but had no await between each writer's read and its write. Both ran to completion atomically, never interleaved, and the test passed with the lock removed. Fix: add latency between read and write, mirroring the real network gap.
  • A fault-isolation test asserted "no 500 when the store fails", but the injected failure was a missing record, which the loader turns into null rather than throwing. The error path never ran. Fix: inject a real 500.

Both looked correct on the page. Only the revert exposed them.

5. Run everything.

The full suite, plus type checks. A fix that corrects one behaviour often contradicts a test that pinned the old one — which is a finding, not an annoyance. Go read that test and decide deliberately (see step 1).

When you cannot get a true red

Sometimes the buggy code cannot be invoked: it is a closure inside a 3,000-line factory, a route handler, a private method. Do not fake a behavioural test. Pick one of these and label it in the file header:

TypeUse whenHonesty requirement
Extract, then testThe logic can be moved to a module with injected dependenciesPreferred. Do this if the extraction is small.
Structural testThe call site cannot be reached, but the invariant is visible in the sourceScan the source and assert the property (e.g. "every write cycle sits inside the lock"). It will name offenders itself. Say in the header that it is structural and should be replaced when the code becomes reachable.
Model testTesting an interaction between components you cannot both instantiateMirror the real code field-for-field, cite the file:line it models, and note in the header that it is a model. Extra important to run step 4 — models are where fake tests hide.
Characterization testDocumenting current behaviour you are not fixing yetName it as such. Do not call it a regression test. Flag that it will invert when the bug is fixed.

Reporting

When you present the work, include:

  • What you proved vs inferred vs still do not know.
  • The revert output — the actual failure line, not a claim that it failed.
  • Which tests are behavioural, structural, model, or characterization.
  • Anything you got wrong earlier in the investigation, corrected explicitly.

Do not describe a test as "revealing the bug" unless you have seen it red.

Anti-patterns

  • Writing the test after the fix and never reverting → decoration.
  • Asserting a mock was called instead of the user-visible outcome → passes for the wrong reason.
  • Widening a test until it passes → deleting the signal.
  • Inverting a pre-existing test because it blocks you → check the history first; it may encode a decision.
  • Reporting "all green" as success when nothing was ever red.

One-line version

Red first, green second, red again on purpose, then green — and say which parts you actually proved.

Attribution and License

Originally created and maintained by RooAGI as the rooagi-red-green-proof skill. Copyright © 2026 RooAGI. Contributed under the MIT License.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Audit web applications for accessibility issues against WCAG 2.2 Level A and AA, the web accessibility standards. Get framework-specific code fixes, contrast checks, verification steps, and reports, with options for automated checks in development pipelines.

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

  • Audit a web application before release
  • Fix contrast and keyboard navigation issues
  • Prepare accessibility reports for stakeholders
alirezarezvani/claude-skills2.9만2026년 10월 23일 업데이트

Plan A/B tests that compare page variations, from headlines to pricing layouts. Define a hypothesis, choose success metrics, calculate sample size and duration, and prepare launch checks and results reports to support decisions.

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

  • Comparing landing page headlines
  • Testing signup button changes
  • Planning pricing page experiments
alirezarezvani/claude-skills2.9만2026년 10월 23일 업데이트

Create paid ad headlines and body copy tailored to each platform's character limits. Use existing performance data to develop variations, explore new messaging angles, and check copy for length, quality, and potential rejection risks.

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

  • Creating Google RSA headlines
  • Writing Meta and LinkedIn ad copy
  • Developing variations of successful ads
alirezarezvani/claude-skills2.9만2026년 10월 23일 업데이트

Review code changes from three critical perspectives: production failures, maintainability, and security. Get a consolidated report that ranks findings by severity and provides merge guidance, helping examine assumptions that an ordinary self-review may overlook.

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

  • Reviewing a pull request before merging
  • Getting a second opinion on AI-written code
  • Checking authentication or data access code
alirezarezvani/claude-skills2.9만2026년 10월 23일 업데이트

aeo

무료

Audit and improve content intended for citation in AI answers. Review evidence, author information, and structure, generate revised content and structured metadata, and keep a local record of observed citations across AI services.

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

  • Audit existing articles for evidence and credibility gaps
  • Revise article structure and references for AI answers
  • Record citations observed across AI services
alirezarezvani/claude-skills2.9만2026년 10월 23일 업데이트

Create signed records for consequential agent actions such as deployments, deletions, and payments. Decide which actions need evidence, record the agent, action, target, and policy, then verify the resulting certificate offline to detect later changes.

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

  • Creating signed records for production deployments
  • Preserving evidence of deletions and payments
  • Recording access grants for later review
alirezarezvani/claude-skills2.9만2026년 10월 23일 업데이트

alirezarezvani의 스킬 모두 보기

이 스킬의 문제 신고