refactor(skills): trim bdd and jj-atomic SKILL.md under the 100-line cap
Both SKILL.md exceeded the repo's 100-line ceiling (bdd 120, jj-atomic 105). Relocate prose lessons into the existing anti-patterns.md siblings so each SKILL.md stays the routing layer; no content lost. - refactor(bdd): move the producer-fixture lesson to anti-patterns.md, compress green-is-not-sufficient to a pointer (review-angles owns it), fold the redundant Anti-patterns section into Guardrails, tighten language-ref spacing (120 -> 98) - refactor(jj-atomic): inline the Step-5 and foreground-mutation prose, fold Examples into See also (105 -> 100)
This commit is contained in:
parent
1e55224733
commit
5885cff284
@ -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.
|
change, side effect) — pure refactors are out of scope.
|
||||||
|
|
||||||
## Language references — Python
|
## Language references — Python
|
||||||
|
|
||||||
Pytest only — `@pytest.fixture`, `parametrize`, scenario as docstring.
|
Pytest only — `@pytest.fixture`, `parametrize`, scenario as docstring.
|
||||||
|
|
||||||
- [tests-py.md](tests-py.md) — paired good/bad examples.
|
- [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.*
|
- [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`.*
|
- [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.
|
- [docstrings-py.md](docstrings-py.md) — Google style, types in annotations not prose.
|
||||||
|
|
||||||
## Language references — R
|
## Language references — R
|
||||||
|
|
||||||
Testthat ed. 3+, `box::use`, `describe`/`it`.
|
Testthat ed. 3+, `box::use`, `describe`/`it`.
|
||||||
|
|
||||||
- [tests-r.md](tests-r.md) — paired good/bad examples.
|
- [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.*
|
- [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.
|
- [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
|
- No production code exists that is not exercised by a test added in this
|
||||||
loop.
|
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
|
A green suite is a *claim*, not a proof: it never exercised thread death,
|
||||||
while the real producer emits a different one. A query tool was written
|
caller ordering, stale data, or the shape the real producer emits (see
|
||||||
assuming `calls` edges reach callee definitions; the real mappers stop a
|
[anti-patterns.md](anti-patterns.md) *"Fixtures that don't match what the
|
||||||
cross-file call at a same-named reference node, so the tool was blind across
|
producer emits"*). After the loop is green, **budget a recall-biased
|
||||||
files — and the hand-made fixtures hid it the whole way (rule 17). Before
|
review pass** — [`../review-angles/SKILL.md`](../review-angles/SKILL.md) — and
|
||||||
building on a stored shape, **probe what the writer actually produces** (or
|
refute it ([refute.md](../review-angles/refute.md)) before calling it done.
|
||||||
generate the fixture *with* the real producer), and **live-verify on a
|
Fix findings red-test-first, like any other feature.
|
||||||
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.
|
|
||||||
|
|
||||||
## Guardrails
|
## Guardrails
|
||||||
- **Never** skip the red step (see anti-patterns.md *"Passing on first run"*).
|
- **Never** skip red, write >1 failing test at once, or refactor while red.
|
||||||
- **Never** write more than one failing test at a time (see anti-patterns.md
|
- A scenario untestable at the chosen level gets surfaced, not dropped.
|
||||||
*"Horizontal slicing"*).
|
See [anti-patterns.md](anti-patterns.md) — horizontal slicing, passing on
|
||||||
- Refactor only with a green bar (see anti-patterns.md
|
first run, refactoring while red, dropping an untestable scenario.
|
||||||
*"Refactoring while red"*).
|
|
||||||
- If a scenario turns out untestable at the chosen level, surface it (see
|
|
||||||
anti-patterns.md *"Silently dropping…"*).
|
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
- [../diagnose/SKILL.md](../diagnose/SKILL.md) — chasing an existing bug?
|
- [../diagnose/SKILL.md](../diagnose/SKILL.md) — chasing an existing bug?
|
||||||
|
|||||||
@ -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
|
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
|
(unit) one level and reconfirm with the user. A dropped scenario is a
|
||||||
contract the suite no longer protects.
|
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.
|
||||||
|
|||||||
@ -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
|
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
|
**Step 5 is not optional.** Without `jj new`, edits accumulate into the
|
||||||
sealed; without `jj new`, every subsequent edit accumulates into a
|
sealed change and its message rots into a lie — open a fresh empty `@`
|
||||||
change with an outdated message. Open a fresh empty `@` immediately so
|
immediately.
|
||||||
the next concern starts in a clean working copy.
|
|
||||||
|
|
||||||
**Run every `jj` mutation in the foreground.** `squash`, `describe`,
|
**Run every `jj` mutation in the foreground** (split/describe/new rewrite the
|
||||||
`split`, `new` rewrite the working copy; backgrounding one (a detached
|
working copy; backgrounding races the snapshot and aborts). See
|
||||||
`ruff format && jj squash …`) races the working-copy snapshot and the
|
|
||||||
op aborts. Background only long read-only work (builds, test runs). See
|
|
||||||
[anti-patterns.md](anti-patterns.md) *"Backgrounding a `jj` mutation"*.
|
[anti-patterns.md](anti-patterns.md) *"Backgrounding a `jj` mutation"*.
|
||||||
|
|
||||||
## Anti-patterns
|
## 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
|
`jj diff`, mixed-bag commits, past-tense messages, missing scope, docs
|
||||||
deferred to the next commit, skipping `jj new` after describe.
|
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
|
## 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)
|
- [`../../engineering/r-style/SKILL.md`](../../engineering/r-style/SKILL.md)
|
||||||
— style refactors are their own atomic change.
|
— style refactors are their own atomic change.
|
||||||
- [`../../engineering/bdd/SKILL.md`](../../engineering/bdd/SKILL.md)
|
- [`../../engineering/bdd/SKILL.md`](../../engineering/bdd/SKILL.md)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user