Thin component or hook contract tests for real app behavior.
Golden input or output tests when serialized output is the contract.
Hard constraints:
Prefer Bun for the fast local loop.
Keep the default suite fast.
No browser or e2e coverage unless the app behavior truly needs it.
Coverage is a hotspot tool, not a vanity score.
Core Rules
Assert public behavior, not implementation detail.
Keep tests next to the code they cover with *.spec.ts[x].
Keep helpers local. Do not import one spec from another.
Prefer explicit assertions over snapshots.
Delete skipped, commented, or placeholder tests instead of babysitting them.
Seam Selection
Use plain function tests for pure logic.
Use rendered React tests for hooks, components, rerender behavior, and DOM behavior.
Use browser checks only when the contract is actually browser-specific.
Fixtures And Assertions
Keep fixtures small.
Use plain objects for simple state.
Use it.each for small behavior matrices.
In Bun + Testing Library, prefer render-returned queries over screen.
Use direct style-property assertions instead of toHaveStyle.
Use snapshots only when serialized output is the contract and inline assertions would be worse.
Quick Reference
Keep tests fast and local.
Start with the smallest seam that proves the behavior.
Prefer explicit assertions.
Browser checks are for real UI behavior, not lazy coverage.
1---2name: testing-23description: Skill: testing4---56## Testing Goal78Keep tests in three buckets only:910- Pure unit tests for deterministic logic.11- Thin component or hook contract tests for real app behavior.12- Golden input or output tests when serialized output is the contract.1314Hard constraints:1516- Prefer Bun for the fast local loop.17- Keep the default suite fast.18- No browser or e2e coverage unless the app behavior truly needs it.19- Coverage is a hotspot tool, not a vanity score.2021## Core Rules2223- Assert public behavior, not implementation detail.24- Keep tests next to the code they cover with `*.spec.ts[x]`.25- Keep helpers local. Do not import one spec from another.26- Prefer explicit assertions over snapshots.27- Delete skipped, commented, or placeholder tests instead of babysitting them.2829## Seam Selection3031- Use plain function tests for pure logic.32- Use rendered React tests for hooks, components, rerender behavior, and DOM behavior.33- Use browser checks only when the contract is actually browser-specific.3435## Fixtures And Assertions3637- Keep fixtures small.38- Use plain objects for simple state.39- Use `it.each` for small behavior matrices.40- In Bun + Testing Library, prefer render-returned queries over `screen`.41- Use direct style-property assertions instead of `toHaveStyle`.42- Use snapshots only when serialized output is the contract and inline assertions would be worse.4344## Quick Reference4546- Keep tests fast and local.47- Start with the smallest seam that proves the behavior.48- Prefer explicit assertions.49- Browser checks are for real UI behavior, not lazy coverage.
Run npx skillmds@latest add lofcz/testing-2 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Skill: testing It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
lofcz (@lofcz) published this skill. Their other Agent Skills are listed on their SkillMD profile.