testing
Skill1 starsChanged 5 months agoMITView on GitHub
Write tests that catch real regressions — choosing what to test, structuring tests, testing behavior over implementation, handling databases and async, and killing flakiness. Use when adding or improving tests, setting up a test for a bug fix or new feature, deciding what to cover, or dealing with flaky/slow tests. Stack: vitest, `pnpm test`.
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
- andeeplus/aplustheir 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
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 repository10 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- agent-llmSkill
- dataSkill
- debugSkill
- doc-coauthoringSkill
- frontend-designSkill
- git-opsSkill
- loop-verifySkill
- refactorSkill
- securitySkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 6 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 105 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 12
Test behavior and contracts, not implementation details.
- Distinctive: line 15
Every bug fix ships with a test that fails before the fix and passes after.
- Distinctive: line 16
Don't chase a coverage number.
- Very specific: line 30
Keep tests independent and order-agnostic — no test may depend on another having run.
- Distinctive: line 31
Prefer real objects over mocks.
- Distinctive: line 35
Run integration tests against a real Postgres (a disposable/test database), not an in-memory fake — you want the real query planner, …
- Very specific: line 37
Test the migration and the constraint, not just the query: a NOT NULL/UNIQUE/FK is behavior worth asserting.
- Very specific: line 43
Never sleep(n) to wait for async — await the actual signal (the resolved value, the state change, a polled condition).
- Very specific: line 50
Run the focused test while iterating (pnpm test <file> / -t "<name>"), the full suite before you consider the work done.
- Distinctive: line 51
When you change behavior deliberately, update the test in the same change and say why in the diff — don't delete a failing test to get …
“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 earns its place by failing when the behavior breaks and passing otherwise. Tests that never fail are noise; tests coupled to implementation break on every refactor. Aim for the first, avoid the second.
What to test (and what not to)
- Test behavior and contracts, not implementation details. Assert on what a function returns / what the user sees, not which private helper it called.
- Prioritize by risk × traffic: money, auth, permissions, data integrity, and anything in
lib/auth/get thorough coverage. Trivial getters and framework glue don't. - Cover the boundaries where bugs live: empty, one, many; null/undefined; zero/negative/overflow; the error path, not just the happy path.
- Every bug fix ships with a test that fails before the fix and passes after. That test is the proof the bug is gone and the guard against its return.
- Don't chase a coverage number. 100% line coverage with no assertions on behavior is theater. Coverage shows what's untested, not what's tested well.
The test pyramid
- Unit (most): pure logic, one module, no I/O — fast, run constantly.
- Integration (some): modules together, real DB/API routes — catch the wiring bugs units miss.
- E2E (few): full user flows — expensive and slower, reserve for critical paths (signup, checkout, auth).
- Invert it and your suite gets slow and flaky. Push each test to the lowest level that can still catch the bug.
Structure
- Arrange–Act–Assert, visibly separated. One logical behavior per test.
- Name tests by the behavior:
returns 401 when the session is expired, nottest auth 3. The name should read as a spec line. - Assert on specific values, not just "truthy" or "no throw".
expect(res.status).toBe(403)beatsexpect(res).toBeDefined(). - Keep tests independent and order-agnostic — no test may depend on another having run. Reset shared state (DB rows, mocks, module state) in
beforeEach/afterEach. - Prefer real objects over mocks. Mock only at the true boundary (network, clock, randomness, third-party SDKs). Over-mocking tests your mocks, not your code.
Databases (Postgres)
- Run integration tests against a real Postgres (a disposable/test database), not an in-memory fake — you want the real query planner, constraints, and types.
- Isolate tests: wrap each in a transaction and roll back, or truncate between tests. Never let one test's rows leak into the next.
- Test the migration and the constraint, not just the query: a
NOT NULL/UNIQUE/FK is behavior worth asserting. - Seed the minimum data the test needs, inline and visible — a giant shared fixture hides what the test actually depends on.
Async, time, and flakiness
awaitevery promise and assert after it resolves; a floating promise makes a green test that proves nothing.- Never
sleep(n)to wait for async — await the actual signal (the resolved value, the state change, a polled condition). Fixed sleeps are the #1 source of flakiness. - Freeze time and seed randomness. Tests that read the real clock, timezone, or
Math.random()fail intermittently. - A flaky test is a bug — in the test or the code. Quarantine it loudly, then fix the race; don't paper over it with retries.
Working with the harness
- The Stop gate runs
pnpm testbefore letting a task finish, so a red suite blocks completion — keep it green as you go, not at the end. - Run the focused test while iterating (
pnpm test <file>/-t "<name>"), the full suite before you consider the work done. - When you change behavior deliberately, update the test in the same change and say why in the diff — don't delete a failing test to get green.
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.

