write-tests
/write-tests
Write unit or integration tests for a function, module, endpoint or bug fix, in the project's existing test framework. Use when the user says "add tests", "write tests for this", "increase coverage", "test this bug fix", or "why isn't this tested".
- Author
- Kuan-AI-com ↗
- Repository
- agent-skills ↗
- Licence
- MIT
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Write unit or integration tests for a function, module, endpoint or bug fix, in the project's existing test framework. Use when the user says "add tests", "write tests for this", "increase coverage", "test this bug fix", or "why isn't this tested".
Triggers from the description
Original author description
Write unit or integration tests for a function, module, endpoint or bug fix, in the project's existing test framework. Use when the user says "add tests", "write tests for this", "increase coverage", "test this bug fix", or "why isn't this tested".
How it works
- 1. Find how this project tests
- 2. Read the code under test
- 3. Plan cases before coding
- 4. Write them
- 5. Prove each test can fail
- 6. Run and report
SKILL.md preview
--- name: write-tests description: Write unit or integration tests for a function, module, endpoint or bug fix, in the project's existing test framework. Use when the user says "add tests", "write tests for this", "increase coverage", "test this bug fix", or "why isn't this tested". --- # Write tests ## 1. Find how this project tests - Test command: `package.json` scripts, `Makefile`, `pyproject.toml`/`pytest.ini`/`tox.ini`, `go.mod`, `Cargo.toml`, CI config in `.github/workflows/`. Use that command, not a guessed one. - Find the nearest existing test for similar code and copy its location, naming, imports, fixtures, factories and mocking style. Do not add a new framework or assertion library. - Run the existing suite (or the relevant file) once before writing, so you know the baseline. If it is already red, tell the user before adding to it. ## 2. Read the code under test Read the function and its callers. The behaviors worth testing are what callers rely on: return values, thrown errors, side effects (DB writes, events, calls to other services). Not private helpers or the order of internal calls. ## 3. Plan cases before coding Write a short list, then implement: - the main path with realistic input - boundaries that matter for this code: empty, one, many, max length, zero, negative, missing optional fields, duplicates - error paths: invalid input, dependency failure or timeout, permission denied - for a bug fix: the exact input from the bug report Skip cases that only re-test the language or a library. ## 4. Write them - One behavior per test; name it as a sentence: "rejects an expired coupon". - Arrange / act / assert, visible in the test. Prefer explicit expected values over recomputing them with the same logic as the code. - Mock only boundaries you do not control: network, clock, randomness, third-party APIs. Use the project's real DB test setup if it has one. - Deterministic: freeze time, seed randomness, no reliance on test order or shared mutable state, no real sleeps. - Avoid large snapshots; they get approved without being read. ## 5. Prove each test can fail A test that cannot fail is worse than none. For each new test, break the behavior (flip a condition, return early, comment out the fix) and confirm the test goes red, then restore. For bug-fix tests, confirm it fails without the fix. ## 6. Run and report - Run the new test file first, then the whole affected suite. Show the command and the pass/fail counts. - If a test fails because the code is wrong, do not change the assertion to match. Report: "this looks like a bug: <input> gives <actual>, expected <expected>", and ask before fixing production code. - Do not modify production code just to make it testable without saying so and why. Summary at the end: which behaviors are now covered, which you deliberately left out, and any bugs found.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · Kuan-AI-com/agent-skills | 90 | MIT |
| onsi/biloba | 100 | MIT |
| runwield/runwield | 100 | MIT |
| dzhng/jevgrep | 100 | MIT |
| lukedj78/dev-flow | 100 | MIT |
| dzhng/skills | 100 | MIT |
| rowansci/rowan-python | 100 | MIT |
| yaohuangguan/agent-playbook | 100 | MIT |
| microsoft/semantic-link-labs | 100 | MIT |
Database snapshot: 13.11.2026 · package version 9c34ce33d476 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100test-unit
Write unit and integration tests for a named module or change. Use when "write unit tests" or "add tests for this function". Coverage plan → plan-test-coverage. Mutation score → test-mutation. Browser check → test-playwright. - 100test-generator
Write unit and integration tests for existing code, covering the happy path, edge cases, error paths and boundary values, using the project's own test framework and style. Use when the user asks to add tests, raise coverage, write test cases for a function, module or endpoint, or test a bug fix. - 84generate-tests
Generate comprehensive tests for code. Use when user says "write tests for this function", "add unit tests to this file", "generate integration tests for the API", "I need test coverage for this module", or "create e2e tests for the checkout flow". - 100testing
Creates and manages unit and integration tests: detects the test framework, follows project conventions, runs the fix-loop. Use when the user mentions "write tests", "unit tests", "integration tests", "test coverage", "tests missing", "TDD", or after implementation when tests… - 100unit-test-writer
Write focused unit tests for a function, class or module: one behaviour per test, Arrange-Act-Assert, descriptive names, boundary and error cases, no I/O, fast and deterministic; in the project's existing framework (pytest, JUnit 5, xUnit/NUnit, Jest/Vitest, PHPUnit, Go… - 100generate-tests
Use when asked to generate tests for a file, module or component, to raise coverage, or to bootstrap a suite for untested code. Detects the project's test framework and conventions first, then writes unit, integration and edge-case tests.