unit-testing
Skill1k starsChanged 11 days agoMITView on GitHub
Complete or maximize unit test coverage for a specific TypeScript file in this repo. Use when: a test run is short of the 100% coverage threshold and you need to find and close the gap, or when deciding whether an uncovered branch is genuinely unreachable. For everyday test-writing conventions (AAA, mocking, placement, type safety), see .agents/rules/unit-testing.md instead — it loads automatically for any *.spec.ts file.
We split this skill into the rules it gives an agent
6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 16 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
If uncovered logic appears obsolete, do not change production code — present evidence and request user confirmation first.
- Very specific: line 25
When a branch is genuinely unreachable at runtime and cannot be exercised through tests, mark it with an istanbul ignore comment that …
- Very specific: line 33
Always include a justification: after the -- separator.
- Distinctive: line 34
Prefer making code non-optional over ignoring it: If a default is never exercised, propose removing it — with evidence, and only once the …
- Distinctive: line 35
Only use for genuinely unreachable code: If a branch can be triggered through a public API, write a test for it.
- Distinctive: line 36
Keep the ignore scope as narrow as possible: Place on the specific line or branch, not on entire functions.
“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Unit Testing — closing coverage gaps
For the coverage threshold ("Coverage — 100% required"), AAA structure, mocking, placement, and type safety, follow .agents/rules/unit-testing.md — this skill only covers the coverage-completion workflow. For the general Nx-vs-direct command choice, see the root AGENTS.md.
Completing coverage for a specific file
- Run the target test file with coverage to get a baseline:
cd packages/<package-name> pnpm test:unit <test-file> - Find missing branches by inspecting
packages/<package-name>/coverage/lcov.infoforBRDAentries with zero hits. Map uncovered branches to exact conditions in the source. - Add tests to hit uncovered branches. Re-run after each change. Repeat until resolved or justified.
- Prefer adding tests over suppressing coverage.
- If uncovered logic appears obsolete, do not change production code — present evidence and request user confirmation first.
Handling unreachable or defensive branches
When a branch is genuinely unreachable at runtime and cannot be exercised through tests, mark it with an istanbul ignore comment that justifies why:
/* istanbul ignore next -- Defensive guard: invalid parser state is impossible through public API */Rules for istanbul ignore:
- Always include a justification after the
--separator. - Prefer making code non-optional over ignoring it. If a default is never exercised, propose removing it — with evidence, and only once the user confirms (as in step 5 above) — instead of adding an ignore comment.
- Only use for genuinely unreachable code. If a branch can be triggered through a public API, write a test for it.
- Keep the ignore scope as narrow as possible. Place on the specific line or branch, not on entire functions.
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- pulsejet/memories★ 3.9ksame name
- lichtblick-suite/lichtblick★ 1.2ksame name
- petrkindlmann/qa-skills★ 209same name
- kid-sid/claude-spellbook★ 190same name
- dprakash2101/dotnet-production-agent-skills★ 4same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- sb-dev/narrative-production-skills★ 2same name
- axross/skills★ 1same name
- iamcaominhtien/kanban-board-mcp★ 1same name
- mejbaurbahar/software-tester-skills★ 1same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use contract-testing, test-strategy and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
petrkindlmannSkillcontract-testing
Implement consumer-driven contract testing with Pact-JS (v16). Covers consumer test writing, broker-driven provider verification, Pact Broker setup, can-i-deploy as a deployment gate, webhook-triggered verification, pending pacts, and schema-first vs consumer-first approaches (OpenAPI/Ajv, Schemathesis). Use when: "contract test," "Pact," "consumer-driven," "API contract," "provider verification," "can-i-deploy." Not for: stubbing or mocking a dependency to isolate a test — use service-virtualization; general REST/GraphQL endpoint assertions against your own API — use api-testing. Related: api-testing, service-virtualization, ci-cd-integration, test-environments.
Also in 3 projects that use this
jarosser06Skilltest-strategy
Plans pytest test strategies for Drift's 90%+ coverage requirement using coverage analysis, edge case identification, and test suite design. Use when determining what tests to write, analyzing coverage gaps, or planning test strategies.
Also in 3 projects that use this
etewiahSkille2e-testing
Playwright E2E testing and Lighthouse performance auditing. Use when setting up E2E tests, running Playwright tests, performing Lighthouse audits, or debugging E2E test failures.
Also in 4 projects that use this
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- boundaries-architectSkill
- create-architectural-decision-recordSkill
- create-issueSkill
- create-prSkill
- documentation-writerSkill
- releaseSkill
- repo-architectureSkill
- review-prSkill
- write-planSkill
- writing-styleSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

