You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .codex/skills/writing-tests/SKILL.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,23 @@ Drive the code through its user-facing surface (`editor.copy()`, `editor.click()
15
15
16
16
Everything else here is a consequence of that rule.
17
17
18
+
## When not to add a test
19
+
20
+
Do not treat line coverage or "every changed file needs a test" as the goal. Add a test only when it protects an observable behavior, domain invariant, or public boundary that could regress independently of the implementation.
21
+
22
+
Skip a new test when it would only:
23
+
24
+
- repeat declarative framework wiring, dependency setup, or static configuration;
25
+
- snapshot private query keys, option objects, CSS classes, component structure, or other implementation choices;
26
+
- exercise a trivial delegation whose behavior is already covered at the owning boundary;
27
+
- justify extracting a tiny helper solely so the implementation has something easy to unit-test;
28
+
- assert behavior already guaranteed by TypeScript, Rust's type system, or the library being configured;
29
+
- require mocks, spies, a parallel harness, or broad DOM/IPC infrastructure for code that is better verified by focused manual QA.
30
+
31
+
Examples: do not test that a `QueryClientProvider` is mounted, that a query key contains a particular string, or that a fixed-size chunk helper calls `slice()` correctly. Do test stable batching if it is exposed as a reusable contract with edge cases, or test the user-visible result through a real integration boundary when one exists.
32
+
33
+
When no worthwhile automated test exists, say so explicitly in the handoff and record the focused manual verification performed. Do not create a low-value test to make the diff look complete.
34
+
18
35
## If you're stuck, research — don't invent a mock
19
36
20
37
The moment you think "I'll just mock this out" is the moment to stop and look for prior art. Real Electron / font-editor / reactive-signal codebases have solved the same class of problem: VSCode, Obsidian, Signal Desktop, Bitwarden, Fontra, tldraw. Their patterns are on GitHub.
0 commit comments