writing-tests

Guides writing trustworthy tests using see-it-fail discipline and snapshot gating rules.

Updated Jun 12, 2026
Ready to run
npx skills add https://github.com/missingbulb/GoogleCalendarEventCreator --skill writing-tests-missingbulb
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: writing-tests
Source: https://github.com/missingbulb/GoogleCalendarEventCreator/tree/main/.claudinite/shared/packs/basics/skills/writing-tests
Command: npx skills add https://github.com/missingbulb/GoogleCalendarEventCreator --skill writing-tests-missingbulb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Tests that never fail, stub the wrong boundary, or restate declared values give false confidence and tax every deliberate change. This Skill provides a set of practices for writing tests that actually catch defects, covering see-it-fail discipline, snapshot and golden rules, CI-only and heavy-browser test handling, and fuzzy-metric gating. ## Core Features & Use Cases - See-it-fail discipline: Write tests red before the fix, or mutate the guard and watch the test bite, including safe restore with git checkout and the staged-mutation pitfall. - Snapshot and golden rules: Drive snapshots through the real code path, inject fixed reference times, match the rasterizer to the surface, and require owner approval before re-baselining. - CI and heavy-browser guidance: Require two green CI runs for new e2e tests, make CI-only tests self-diagnosing and hang-proof, and gate fuzzy metrics behind high-watermarks. - Use Case: Before adding a regression test for a bug fix, apply the see-it-fail rule to confirm the test actually fails without the fix, then assert only the behavior the code computes rather than restating declared values. ## Quick Start Review my new test file and check it against the writing-tests practices before I commit it.

Frequently Asked Questions about writing-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a test that actually catches bugs?▼

See the test fail before trusting it: write it red before the fix, or break what it guards and watch it go red. A test that has never failed proves nothing, and a test that stubs the boundary where the bug lives cannot catch that bug.

How do I test a guard that should produce no output?▼

For a refusal or negative test, the write-it-red-first approach is unavailable since the pre-change code also yielded nothing. Instead, mutate the new guard to weaken it, watch the test fail, then restore with git checkout HEAD -- file if the mutation was staged.

Should tests assert that config values are set correctly?▼

No. Asserting a declared value equals its literal restates the file under test and only fails on deliberate changes. Test the behavior the value drives instead: feed the real code the declared value and assert what the code does with it.

When should a snapshot test baseline be regenerated?▼

Regenerate only after the diff is surfaced and an owner approves the change, since an unreviewed baseline change is an unreviewed behavior change. Keep the reverted baseline committed until approval so the branch honestly shows the test red-pending.

Why do snapshot tests fail when they depend on the current date?▼

Tests reading the real clock silently rot as wall-clock time passes, so a fixed-date fixture changes meaning over time. Inject a fixed reference instant through the code under test, defaulting to the real clock only in production.

How many CI runs should a new e2e browser test pass before merging?▼

A new e2e or heavy-browser test must go green at least twice in CI before merging, since one green run does not rule out a flake. Deterministic offline unit and integration tests only need one green run.