writing-tests
Skill2 starsChanged 7 months agoMITView on GitHub
Analyze existing code and write comprehensive unit and integration tests for it. Detects the test framework, identifies untested code paths, and generates tests with proper mocking, edge cases, and assertions. Use when the user asks to add tests, improve coverage, or test a specific module. Use when the user says "/writing-tests", "writing tests", or asks about writing tests.
- Installs packages
16 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- PostHog/posthogtheir own version, first seen Oct 4, 2026
- PostHog/posthog-fosstheir own version, first seen Oct 4, 2026
- JetBrains/intellij-communitytheir own version, first seen Oct 3, 2026
- iliaal/ai-skillstheir own version, first seen Oct 3, 2026
- ZeroTokenClaw/agents-skillsedited, first seen Sep 21, 2026
- schmitthub/clawkertheir own version, first seen Sep 8, 2026
Used with
Projects with it also use create-tasks.
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.
NTCodingSkillcreate-tasks
Creates well-formed tasks following a template that engineers can implement. Triggers on: 'create tasks', 'define work items', 'break this down', creating tasks from PRD, converting requirements into actionable tasks, feature breakdown, sprint planning.
Also in 3 projects that use this
Other versions16 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- ZeroTokenClaw/agents-skills★ 199% same
- matarpeles/skills-registry-demo★ 099% same
Wrote their own version · 14
- PostHog/posthog★ 40ksame name
- JetBrains/intellij-community★ 21ksame name
- cashew-labs/libretto★ 904same name
- PostHog/posthog-foss★ 721same name
- ZaxbyHub/opencode-swarm★ 485same name
- NTCoding/claude-skillz★ 352same name
- schmitthub/clawker★ 54same name
- iliaal/ai-skills★ 43same name
- lox/agent-skills★ 15same name
- augmnt/webdev-skills★ 1same name
4 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 repository85 other files it gives its agents.
- accessibility-auditingSkill
- adding-analyticsSkill
- adding-api-docsSkill
- adding-authSkill
- adding-dockerSkill
- adding-e2e-testsSkill
- adding-error-trackingSkill
- adding-feature-flagsSkill
- adding-stripeSkill
- api-smoke-testingSkill
- architecture-decision-recordsSkill
- auditing-performanceSkill
- auditing-securitySkill
- auto-type-checkingSkill
- babysitting-prSkill
- best-of-n-solvingSkill
- building-skills-from-patternsSkill
- cavemanSkill
- codebase-onboardingSkill
- comparing-branches-visuallySkill
- converting-css-modules-to-tailwindSkill
- converting-css-to-tailwindSkill
- creating-prSkill
- dark-mode-testingSkill
- database-designSkill
- design-an-interfaceSkill
- detecting-port-conflictsSkill
- domain-modelSkill
- edit-articleSkill
- exporting-to-pngSkill
- finding-dev-server-urlSkill
- fixing-broken-linksSkill
- form-testingSkill
- generating-imagesSkill
- git-guardrails-claude-codeSkill
- github-triageSkill
- grill-meSkill
- grinding-until-passSkill
- improve-codebase-architectureSkill
- incident-responseSkill
- kubernetes-deployingSkill
- migrate-to-shoehornSkill
- monitoring-terminal-errorsSkill
- network-request-auditingSkill
- obsidian-vaultSkill
- parallel-ci-triageSkill
- parallel-code-reviewSkill
- parallel-exploringSkill
- parallel-test-fixingSkill
- profiling-performanceSkill
- prompt-engineeringSkill
- python-tdd-with-uvSkill
- qaSkill
- react-native-patternsSkill
- recording-browser-flow-as-testSkill
- request-refactor-planSkill
- responsive-testingSkill
- reviewing-codeSkill
- saving-workspace-contextSkill
- scaffold-exercisesSkill
- The first 60 shown.
The 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 8
Use this skill when the user asks to add tests to existing code, improve test coverage, or write tests for a specific file or module.
- Very specific: line 19
Look for config files: vitest.config.ts, jest.config.ts, playwright.config.ts, .mocharc.*.
- Very specific: line 27
Add a test script to package.json:
- Distinctive: line 100
If any fail, fix the test or the code (depending on whether the test expectation or the implementation is wrong).
- Distinctive: line 110
Don't test implementation details — test behavior and outputs, not internal method calls.
- Distinctive: line 111
Use descriptive test names that explain the scenario: "returns 0 when cart is empty" not "test1".
“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
Writing Tests
Use this skill when the user asks to add tests to existing code, improve test coverage, or write tests for a specific file or module.
Steps
Detect the test setup — check what's already configured:
# Check package.json for test runner cat package.json | grep -E "jest|vitest|mocha|playwright|cypress"Look for config files:
vitest.config.ts,jest.config.ts,playwright.config.ts,.mocharc.*. Check for existing test files to understand the project's test patterns and conventions.If no test runner exists — set one up:
npm install -D vitest @testing-library/react @testing-library/jest-domAdd a
testscript topackage.json:{ "test": "vitest run", "test:watch": "vitest" }- Analyze the target code — read the file(s) to test and identify:
- Public API: exported functions, classes, components, hooks
- Code paths: conditionals, error handling, edge cases
- Dependencies: external services, databases, APIs that need mocking
- Side effects: file I/O, network calls, DOM mutations
Create the test file — place it next to the source file or in a
__tests__/directory, matching the project's convention:src/utils/format.ts→src/utils/format.test.tssrc/components/Button.tsx→src/components/Button.test.tsx
Write tests following this structure:
import { describe, it, expect, vi } from "vitest"; describe("functionName", () => { // Happy path it("returns formatted output for valid input", () => { ... }); // Edge cases it("handles empty string", () => { ... }); it("handles null/undefined input", () => { ... }); // Error cases it("throws on invalid argument", () => { ... }); // Boundary conditions it("handles maximum length input", () => { ... }); });Mock external dependencies — don't make real API calls or database queries in unit tests:
vi.mock("@/lib/db", () => ({ query: vi.fn().mockResolvedValue([{ id: 1, name: "test" }]), }));For React components, mock hooks that fetch data:
vi.mock("@/hooks/useUser", () => ({ useUser: () => ({ user: { name: "Test" }, isLoading: false }), }));Test React components with Testing Library:
import { render, screen, fireEvent } from "@testing-library/react"; it("renders the button and handles click", () => { const onClick = vi.fn(); render(<Button onClick={onClick}>Click me</Button>); fireEvent.click(screen.getByRole("button", { name: "Click me" })); expect(onClick).toHaveBeenCalledOnce(); });Run the tests and verify they pass:
npm testIf any fail, fix the test or the code (depending on whether the test expectation or the implementation is wrong).
What to Test
- Always test: public API, error handling, edge cases (empty, null, zero, negative), state transitions, async behavior
- Skip testing: private implementation details, third-party library internals, simple getters/setters, type-only code
Notes
- Match the project's existing test style — if they use
test()instead ofit(), follow that. - Don't test implementation details — test behavior and outputs, not internal method calls.
- Use descriptive test names that explain the scenario: "returns 0 when cart is empty" not "test1".
- One assertion concept per test — multiple
expectcalls are fine if they verify the same behavior. - For async code, always
awaitthe result or useresolves/rejectsmatchers.
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.

