testify
Skill9 starsChanged 8 months agoMITView on GitHub
Write and improve tests — reuse existing patterns, ensure consistency, and maintain quality.
In this repository12 other files it gives its agents.
- codex-reviewSkill
- cost-reviewSkill
- coverage-reviewSkill
- db-reviewSkill
- functionalSkill
- learnifySkill
- mermaidSkill
- object-orientedSkill
- perf-reviewSkill
- proofreadSkill
- roast-reviewSkill
- test-runnerSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
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 11
Write new tests or improve existing ones, always reusing the project's established testing patterns, style of writing, mocks, and fixtures.
- Distinctive: line 19
Before writing any mock, fixture, factory, or helper, search the codebase for how other tests solve the same problem.
- Distinctive: line 20
Follow the mocking strategy already established (module mocks, dependency injection, HTTP interception, etc.).
- Distinctive: line 26
Do not mock the unit under test
- Distinctive: line 34
Remove order dependencies between tests
- Very specific: line 38
Use specific assertions (toBe(expected), assertEqual(result, expected)) over vague ones (toBeTruthy, assert result)
- Distinctive: line 39
Every test should verify a concrete outcome — if code runs but nothing is asserted, add the missing assertion
- Distinctive: line 50
Remove non-deterministic ordering assumptions
- Distinctive: line 67
When no arguments are provided, this skill is being invoked by the model — apply the principles above to whatever test code is currently …
- Distinctive: line 80
Understand the context: read the specified files (test files, source files, or both) to understand the testing framework, patterns, and …
- Distinctive: line 84
New tests: follow the project's existing test structure, naming conventions, and mocking patterns.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testify
Write new tests or improve existing ones, always reusing the project's established testing patterns, style of writing, mocks, and fixtures.
Files and instructions: $ARGUMENTS
Core principles
Reuse before creating
- Before writing any mock, fixture, factory, or helper, search the codebase for how other tests solve the same problem. If the project already has a pattern for it, use it
- Follow the mocking strategy already established (module mocks, dependency injection, HTTP interception, etc.). Only introduce a different approach when the existing one genuinely cannot cover the case
- Reuse existing test data builders and factories. If no factory exists and the same setup appears in multiple places, extract one into the project's shared test utilities
Mocking
- Mock only what is needed — not the entire module. Keep mocks scoped to the dependency being isolated
- Do not mock the unit under test
- Clean up mocks after each test to prevent leakage between tests
Structure and isolation
- Apply arrange-act-assert. Each test should verify a single behaviour
- Name tests to describe the scenario and expected outcome, not the implementation detail
- Eliminate shared mutable state between tests. Use per-test setup (
beforeEach) over shared setup (beforeAll) unless the data is truly static - Remove order dependencies between tests
Assertions
- Use specific assertions (
toBe(expected),assertEqual(result, expected)) over vague ones (toBeTruthy,assert result) - Every test should verify a concrete outcome — if code runs but nothing is asserted, add the missing assertion
Test data
- Extract hardcoded magic values into named constants or factory functions
- Reuse existing fixtures and builders from the project instead of duplicating setup
Robustness
- Replace time-dependent logic with mocked clocks
- Replace network/filesystem dependencies with stubs
- Remove non-deterministic ordering assumptions
- Fix incorrect framework usage (e.g.
beforeAllwhenbeforeEachis needed, missingawaiton async assertions, wrong matcher usage)
How to interpret arguments
The arguments are free-form and flexible. They may contain:
- File references of any type and in any format:
@service.test.ts,test_handler.py, test_utils.py,*_test.go - Source files that need tests written:
@auth.ts write tests for this,src/services/ - Natural language instructions such as:
- "align mocking patterns with the tests in tests/unit/"
- "focus only on mocking consistency"
- "write tests for the new endpoints"
- "also refactor the shared test helpers if needed"
Parse the arguments to identify which files to work on and what additional instructions apply. When instructions reference related files (e.g. other test files, test helpers), follow them to identify and include those files as well.
When no arguments are provided, this skill is being invoked by the model — apply the principles above to whatever test code is currently being written.
Examples
/testify @service.test.ts— improve an existing test file/testify @auth.ts write tests for this— write new tests for a source file/testify tests/unit/— improve all tests in a directory/testify @handler.test.ts align mocking patterns with tests/unit/auth.test.ts— match existing patterns/testify @api.test.py focus on mocking consistency and test isolation— targeted improvement/testify write tests for the functions I just added— cover recent work
How to proceed
- Understand the context: read the specified files (test files, source files, or both) to understand the testing framework, patterns, and structure
- Search for existing patterns: find how other tests in the project mock the same dependencies, set up data, and structure assertions. This step is critical — never write mocks or setup without first understanding the project's conventions
- If the user included additional instructions (e.g. "align with other tests"), follow them to identify further files to read
- Write or improve tests:
- New tests: follow the project's existing test structure, naming conventions, and mocking patterns. Place test files where the project expects them
- Existing tests: apply the core principles above — prioritise reusing established patterns over introducing new ones. Preserve what is tested; improve how it is tested
- Respect the repository's coding style rules while making changes
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.

