diff --git a/skills/engineering/bdd/SKILL.md b/skills/engineering/bdd/SKILL.md index 02b1103..df0a59a 100644 --- a/skills/engineering/bdd/SKILL.md +++ b/skills/engineering/bdd/SKILL.md @@ -13,18 +13,14 @@ description: Drive implementation with a strict red-green-refactor loop where ev change, side effect) — pure refactors are out of scope. ## Language references — Python - Pytest only — `@pytest.fixture`, `parametrize`, scenario as docstring. - - [tests-py.md](tests-py.md) — paired good/bad examples. - [interface-design-py.md](interface-design-py.md) — DI, pure functions, typing, deep modules. *Before step 1.* - [mocking-py.md](mocking-py.md) — boundaries only, façade + DI over patching. *Before `patch` / `monkeypatch`.* - [docstrings-py.md](docstrings-py.md) — Google style, types in annotations not prose. ## Language references — R - Testthat ed. 3+, `box::use`, `describe`/`it`. - - [tests-r.md](tests-r.md) — paired good/bad examples. - [interface-design-r.md](interface-design-r.md) — DI, pure functions, minimal surface. *Before step 1.* - [deep-modules-r.md](deep-modules-r.md) — small interface, large impl. @@ -80,39 +76,21 @@ Testthat ed. 3+, `box::use`, `describe`/`it`. - No production code exists that is not exercised by a test added in this loop. -## Fixtures must match the graph the producer really emits +## After green — necessary, not sufficient -Hand-built unit fixtures encode the shape you *imagine*, and stay green -while the real producer emits a different one. A query tool was written -assuming `calls` edges reach callee definitions; the real mappers stop a -cross-file call at a same-named reference node, so the tool was blind across -files — and the hand-made fixtures hid it the whole way (rule 17). Before -building on a stored shape, **probe what the writer actually produces** (or -generate the fixture *with* the real producer), and **live-verify on a -realistic multi-file input** before calling a phase done. - -## Green is necessary, not sufficient - -A passing scenario suite does not exercise thread death, lock contention, -caller ordering, hostile filesystem layouts, or stale stored data (rule 13). -A green suite is a *claim*, not a proof. After the loop is green, **budget a -recall-biased review pass** — [`../review-angles/SKILL.md`](../review-angles/SKILL.md) -— and refute the green ([`../review-angles/refute.md`](../review-angles/refute.md)) -before calling it done. Fix findings red-test-first, like any other feature. - -## Anti-patterns - -See [anti-patterns.md](anti-patterns.md) — horizontal slicing, passing on -first run, refactoring while red, silently dropping an untestable scenario. +A green suite is a *claim*, not a proof: it never exercised thread death, +caller ordering, stale data, or the shape the real producer emits (see +[anti-patterns.md](anti-patterns.md) *"Fixtures that don't match what the +producer emits"*). After the loop is green, **budget a recall-biased +review pass** — [`../review-angles/SKILL.md`](../review-angles/SKILL.md) — and +refute it ([refute.md](../review-angles/refute.md)) before calling it done. +Fix findings red-test-first, like any other feature. ## Guardrails -- **Never** skip the red step (see anti-patterns.md *"Passing on first run"*). -- **Never** write more than one failing test at a time (see anti-patterns.md - *"Horizontal slicing"*). -- Refactor only with a green bar (see anti-patterns.md - *"Refactoring while red"*). -- If a scenario turns out untestable at the chosen level, surface it (see - anti-patterns.md *"Silently dropping…"*). +- **Never** skip red, write >1 failing test at once, or refactor while red. +- A scenario untestable at the chosen level gets surfaced, not dropped. +See [anti-patterns.md](anti-patterns.md) — horizontal slicing, passing on +first run, refactoring while red, dropping an untestable scenario. ## See also - [../diagnose/SKILL.md](../diagnose/SKILL.md) — chasing an existing bug? diff --git a/skills/engineering/bdd/anti-patterns.md b/skills/engineering/bdd/anti-patterns.md index d3a8d0c..326eb5f 100644 --- a/skills/engineering/bdd/anti-patterns.md +++ b/skills/engineering/bdd/anti-patterns.md @@ -37,3 +37,14 @@ If a scenario from step 0 turns out to be untestable at the chosen level, surface it — don't quietly delete it. Move it up (integration) or down (unit) one level and reconfirm with the user. A dropped scenario is a contract the suite no longer protects. + +## Fixtures that don't match what the producer emits + +Hand-built unit fixtures encode the shape you *imagine*, and stay green +while the real producer emits a different one. A query tool was +written assuming `calls` edges reach callee definitions; the real mappers +stop a cross-file call at a same-named reference node, so the tool was blind +across files — and the hand-made fixtures hid it the whole way. Before +building on a stored shape, **probe what the writer actually produces** (or +generate the fixture *with* the real producer), and **live-verify on a +realistic multi-file input** before calling a phase done. diff --git a/skills/productivity/jj-atomic/SKILL.md b/skills/productivity/jj-atomic/SKILL.md index fb48348..986db59 100644 --- a/skills/productivity/jj-atomic/SKILL.md +++ b/skills/productivity/jj-atomic/SKILL.md @@ -73,15 +73,12 @@ jj diff --revision @- # 4. verify the message matches what shippe jj new -m 'WIP' # 5. open a fresh empty @ for the next unit ``` -**Step 5 is not optional.** After `jj describe`, the current change is -sealed; without `jj new`, every subsequent edit accumulates into a -change with an outdated message. Open a fresh empty `@` immediately so -the next concern starts in a clean working copy. +**Step 5 is not optional.** Without `jj new`, edits accumulate into the +sealed change and its message rots into a lie — open a fresh empty `@` +immediately. -**Run every `jj` mutation in the foreground.** `squash`, `describe`, -`split`, `new` rewrite the working copy; backgrounding one (a detached -`ruff format && jj squash …`) races the working-copy snapshot and the -op aborts. Background only long read-only work (builds, test runs). See +**Run every `jj` mutation in the foreground** (split/describe/new rewrite the +working copy; backgrounding races the snapshot and aborts). See [anti-patterns.md](anti-patterns.md) *"Backgrounding a `jj` mutation"*. ## Anti-patterns @@ -90,11 +87,9 @@ See [anti-patterns.md](anti-patterns.md) — `jj describe` before `jj diff`, mixed-bag commits, past-tense messages, missing scope, docs deferred to the next commit, skipping `jj new` after describe. -## Examples -See [examples.md](examples.md) for a real before/after where a -working-copy is split into two atomic commits with proper messages. - ## See also +- [examples.md](examples.md) — a real before/after where a working copy is + split into two atomic commits with proper messages. - [`../../engineering/r-style/SKILL.md`](../../engineering/r-style/SKILL.md) — style refactors are their own atomic change. - [`../../engineering/bdd/SKILL.md`](../../engineering/bdd/SKILL.md)