testing
Skill1 starsChanged 56 days agoMITView on GitHub
Write, review and place automated tests that can fail. Use for writing, generating or reviewing tests, choosing a layer (unit, DOM, runtime-specific, end-to-end, benchmark), or rejecting a test that cannot fail. Covers Vitest and Playwright.
- Reads credentials
123 other projects use a version of this.
Adopted by
Most recently taken up by
- timmo001/skillstheir own version, first seen Oct 5, 2026
- kortix-ai/sunatheir own version, first seen Oct 5, 2026
- gilsmt/skillstheir own version, first seen Oct 4, 2026
- JetBrains/intellij-communitytheir own version, first seen Oct 3, 2026
- shinpr/codex-workflowstheir own version, first seen Oct 2, 2026
- NVIDIA/nvcftheir own version, first seen Oct 1, 2026
Used with
Projects with it also use oss-pr, pr-automation and 10 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.
CES-LtdSkilloss-pr
Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.
Also in 3 projects that use this
CES-LtdSkillpr-automation
PR Automation Orchestrator: poll open PRs, check CI, run review, fix, and merge eligible PRs. Use when: (1) Invoked by daemon via scripts/pr-automation.sh, (2) User says "/pr-automation".
Also in 3 projects that use this
ffsshhttiikkSkillcicd
Continuous integration and delivery pipelines
Also in 4 projects that use this
ffsshhttiikkSkillnetworking
Practical application and coding skills for Networking
Also in 3 projects that use this
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 9 projects that use this
Cogni-AI-OUSkilldotfiles
Reference for repository dotfiles, including their purposes, standard configurations, and usage guidelines. You MUST load this skill when configuring, troubleshooting, or understanding repository dotfiles.
Also in 3 projects that use this
- +2 more from CES-Ltd
- +1 more from ffsshhttiikk
Other versions123 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 123
- lobehub/lobehub★ 83ksame name
- iOfficeAI/AionUi★ 33ksame name
- JetBrains/intellij-community★ 21ksame name
- kortix-ai/suna★ 20ksame name
- modelcontextprotocol/inspector★ 11ksame name
- microsoft/fast★ 9.7ksame name
- bytebase/dbhub★ 3.6ksame name
- theopenco/llmgateway★ 1.7ksame name
- BankrBot/skills★ 1.2ksame name
- microsoft/CCF★ 875same name
113 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.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- atlassianSkill
- auditSkill
- code-qualitySkill
- commit-expertSkill
- create-issueSkill
- create-prSkill
- debugSkill
- defineSkill
- deliverSkill
- final-reviewSkill
- gherkinSkill
- githubSkill
- handoffSkill
- second-opinionSkill
- senior-technical-writerSkill
- triageSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 11 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 105 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Stop at the first layer that can fail for the bug you care about:
- Distinctive: line 31
Check what runs the test. A file outside every include glob of the test config never runs, and green CI then proves nothing.
- Distinctive: line 35
Test a decision or a boundary:
- Distinctive: line 58
A bug's scenario is its test: When a bug has a Gherkin scenario, the regression test implements it: Given, When and Then become arrange, …
- Distinctive: line 60
A test can pin a bug: When a test contradicts the documented contract, fix the test and say so in the PR.
- Distinctive: line 91
Default: do not mock. Feed data in, read data out.
- Distinctive: line 95
If a new test mocks every collaborator, delete the mocks and test the pure core instead.
- Distinctive: line 99
Treat tests an agent wrote, your own included, as a draft:
- Distinctive: line 101
Run them at once, one file in run mode, and fix import and API errors.
- Distinctive: line 103
Look for the edge cases: empty input, a missing required field, a render that throws, every runtime the code supports.
- Distinctive: line 105
When you delegate tests to a subagent, list the cases to cover, not "write tests for this file".
- Very specific: line 109
Always use run mode (vitest run, playwright test).
“Common” is measured: kept by at least 6 in 10 of the 105 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
Testing
A test exists to catch a behaviour change someone would care about. A test that cannot fail unless the test file itself changes is waste. Prefer a few tests that pin a contract over a suite that restates the implementation.
Project specifics (test layers, commands, where files go, shared fixtures) come from the project's AGENTS.md and the project skill it names, then from the test config. Match the nearest existing test in the same package, and use the project's domain terms.
References
| Task | Read |
| Writing any test: placement, naming, files on disk, stub hygiene | references/conventions.md |
| A cache, incremental build or invalidation path | references/cache-and-invalidation.md |
| A test that needs a real DOM | references/browser.md |
| A Playwright spec or fixture | references/e2e.md |
Choose a layer
Stop at the first layer that can fail for the bug you care about:
- Unit: pure decisions and mappings, in process, no DOM.
- DOM: code that owns the DOM, such as navigation, hydration or custom elements.
- Runtime-specific: what only one runtime provides. Test the logic under the default runtime with the runtime injected or stubbed; use the real one only when the assertion needs it.
- End-to-end: the wired system, such as a dev server, real navigation, HTTP headers or build output.
- Benchmark: cost, not correctness. Back a performance claim with a before-and-after run of the project's benchmark. Never assert wall-clock time in a test.
Check what runs the test. A file outside every include glob of the test config never runs, and green CI then proves nothing.
What to test
Test a decision or a boundary:
- Input that must be rejected or left out: a missing required config field, a page whose metadata throws, a request no route matches
- Input that used to take the wrong branch: the most specific of several matching routes wins
- A mapping that would silently drift: a cache strategy to its
cache-controlheader, a file extension to its handler - Order independence: a result must not depend on glob order or on which test ran first
- Failure the user would see: an error page instead of a 404, a page missing from the output, stale HTML after an edit
Do not test:
- That a constant equals itself
- That something you just built is
toBeDefined()ortoBeTruthy() - That a mock was called, unless the call is the contract (then assert its arguments)
- A restatement of the implementation, or your own test double
- Private members reached with a cast. If a behaviour is not observable through the public surface, the seam is wrong
- Snapshot dumps of whole objects "to have something"
Litmus: if someone rewrote the internals and the user-visible result stayed the same, would this test fail? If yes, it is coupled to the implementation. Rewrite it against the result.
One non-trivial branch, loop, parser or trust boundary needs one test that fails if that logic breaks. Do not add a describe per function for coverage.
Test-only API is dead API. Do not add an exported setter, a getter, a counter or a flag that exposes internal state so a test can reach in. If only a test calls a symbol, delete both. A parameter that replaces a process boundary (a clock, a runtime, a filesystem) is a seam, not test-only API.
A bug's scenario is its test. When a bug has a Gherkin scenario, the regression test implements it: Given, When and Then become arrange, act and assert, and the test takes the scenario's title.
A test can pin a bug. When a test contradicts the documented contract, fix the test and say so in the PR. Never bend correct code to keep a test green.
Tautology (reject these)
// a constant equals itself
expect(Priority.HIGH).toBe(100);
// asserts nothing
expect(watcher).toBeDefined();
// reimplements the unit: the test sorts, the code under test never runs
const sorted = [...handlers].sort((a, b) => b.priority - a.priority);
expect(sorted[0].name).toBe('integration');
// mock theatre
expect(fileSystem.write).toHaveBeenCalled();Rewrite until the assertion names a value, error or visible state the production code could get wrong:
expect(sitemapUrls).toEqual(['https://example.com/', 'https://example.com/about']);
expect(response.headers.get('cache-control')).toBe('no-store, must-revalidate');
expect(readFileSync(path.join(outDir, 'index.html'), 'utf8')).toContain('<h1>Home</h1>');For priority logic, give the code two handlers that both match one input and assert which one handled it.
Mocks
Default: do not mock. Feed data in, read data out.
Mock at a process boundary: the network, the clock, a runtime global, a child process, the environment. The filesystem is usually not one; use a temp dir. Spy on it only to force what a real disk will not give on demand, such as an ordering or a failed write. Assert what crossed the boundary (URL, method, body, the path and content written), not how often an internal helper ran.
If a new test mocks every collaborator, delete the mocks and test the pure core instead.
Generated tests
Treat tests an agent wrote, your own included, as a draft:
- Run them at once, one file in run mode, and fix import and API errors.
- Throw out tautologies, mock-only assertions, APIs from another framework (
jest.*in a Vitest project), casts into private members, and directprocess.envwrites. - Look for the edge cases: empty input, a missing required field, a render that throws, every runtime the code supports. Add them, or delete a happy-path-only file.
When you delegate tests to a subagent, list the cases to cover, not "write tests for this file".
Running
Always use run mode (vitest run, playwright test). Watch mode never exits and hangs the agent.
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.

