From coding
Decide whether and how to write tests: when a test earns its keep, what to cover, what to leave to the type system or schemas, and how to lean on surrounding patterns. TRIGGER whenever authoring a new test or test file, adding test cases to an existing file, covering code with tests, writing a regression test for a bug fix, or about to create test scaffolding/fixtures/mocks — unless the user has given clear direction on exactly what to test (specific cases, assertions, or boundaries named). SKIP only when: the user has spelled out the test cases to write, or editing an existing test that already follows a clear local pattern (mirror the pattern instead).
How this skill is triggered — by the user, by Claude, or both
Slash command
/coding:writing-testsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill to decide whether to author tests, what kind to write, and when to ask instead of inventing a fragile harness.
Use this skill to decide whether to author tests, what kind to write, and when to ask instead of inventing a fragile harness.
Add a test when it protects behavior that is likely to regress, hard to debug manually, user-visible, data/security-sensitive, or already broke once.
Do not add tests merely to increase coverage, assert implementation details, or duplicate guarantees already expressed better by the type system or runtime schemas.
Good tests assert observable behavior through stable boundaries. They are deterministic, small, and useful when they fail.
Prefer tests that would quickly answer: "what behavior broke?" Avoid tests that only answer: "which private helper changed?"
Nearby tests are stronger guidance than general advice. Match local style, fixtures, helpers, naming, and assertion granularity unless the existing pattern is clearly broken.
Pure code is usually safe for agents to test: parsers, formatters, reducers, renderers, classifiers, validators, serializers, and other input → output transformations.
Impure code is risky to test without an established harness: filesystem, network, database, timers, subprocesses, concurrency, editor/TTY behavior, global process state, and external services.
For impure code: mirror existing harnesses. Do not invent complex mocks, sleeps, monkey-patches, or live-service tests autonomously.
Entry state: CLASSIFY_CHANGE
Use table-driven tests when multiple inputs share one behavior contract.
Good targets:
now, never read the clock directlydecode(encode(x)) == xUse established local patterns for:
sleepBefore reporting a new test as good, verify:
npx claudepluginhub codethread/agents --plugin codingCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.