
write-tests
Add missing test coverage for your local code changes by generating new test files (covers uncommitted and untracked changes, or the latest commit if everything is committed). Use when you want write tests for new logic or increase test coverage.
- Installs
- 1.2K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/neolabhq/context-engineering-kit --skill write-tests- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads write-tests automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Cover Local Changes with Tests
User Arguments
User can provide a what tests or modules to focus on:
$ARGUMENTS
If nothing is provided, focus on all changes in current git diff that not commited. If everything is commited, then will cover latest commit.
Context
After implementing new features or refactoring existing code, it's critical to ensure all business logic changes are covered by tests. This command orchestrates automated test creation for local changes using coverage analysis and specialized agents.
Goal
Achieve comprehensive test coverage for all critical business logic in local code changes.
Important Constraints
- Focus on critical business logic - not every line needs 100% coverage
- Preserve existing tests - only add new tests, don't modify existing ones
- "Analyse complexity of changes" -
- if there 2 or more changed files, or one file with complex logic, then Do not write tests yourself - only orchestrate agents!
- if there is only one changed file, and it's a simple change, then you can write tests yourself.
Workflow Steps
Preparation
-
Read sadd skill if available
- If available, read the sadd skill to understand best practices for managing agents
-
Discover test infrastructure
- Read @README.md and package.json (or equivalent project config)
- Identify commands to run tests and coverage reports
- Understand project structure and testing conventions
-
Run all tests
- Execute full test suite to establish baseline
Analysis
Do steps 4-5 in parallel using haiku agents:
-
Verify single test execution
- Choose any passing test file
- Launch haiku agent with instructions to find proper command to run this only test file
- Ask him to iterate until you can reliably run individual tests
- After he complete try running a specific test file if it exists
- This ensures agents can run tests in isolation
-
Analyze local changes
- Run
git status -uto identify all changed files (including untracked files)- If there no uncommited changes, then run
git show --name-statusto get the list of files that were changed in the latest commit.
- If there no uncommited changes, then run
- Filter out non-code files (docs, configs, etc.)
- Launch separate haikue agent per changed file to analyze file itself, and the complexity of the changes, and prepare short summary of it.
- Extract list of files with actual logic changes
- Run
Test Writing
Simple Single File Flow
If there is only one changed file, and it's a simple change, then you can write tests yourself. Following this guidline:
- Read TDD skill for best practices on writing tests
- Read the target file {FILE_PATH} and understand the logic
- Review existing test files for patterns and style, if not exists then create it.
- Analyse which tests cases should be added to cover the changes.
- Create comprehensive tests for all identified cases
- Run the test command identified before.
- Iterate and fix any issues until all tests pass
Ensure tests are:
- Clear and maintainable
- Follow project conventions
- Test behavior, not implementation
- Cover edge cases and error paths
Multiple Files or Complex File Flow
If there are multiple changed files, or one file with complex logic, then you need to use specialized agents to cover the changes. Following this guidline:
-
Launch
review:test-coverage-revieweragents (parallel) (Sonnet or Opus models)- Launch one coverage-reviewer agent per changed file
- Provide each agent with:
- Context: What changed in this file (git diff)
- Target: Which specific file to analyze
- Resources: Read README and relevant documentation
- Goal: Identify what test suites need to be added
- Output: List of test cases needed for critical business logic
- Collect all coverage review reports
-
Launch
developeragents for test file (parallel) (Sonnet or Opus models)- Launch one developer agent per changed file that needs tests
- Provide each agent with:
- Context: Coverage review report for this file
- Target: Which specific file to create tests for
- Test cases: List from coverage-reviewer agent
- Guidance: Read TDD skill (if available) for best practices on writing tests.
- Resources: Read README and test examples
- Command: How to run tests for this file
- Goal: Create comprehensive tests for all identified cases
- Constraint: Add new tests, don't modify existing logic (unless clearly broken)
-
Verify coverage (iteration) (Sonnet or Opus models)
- Launch
review:test-coverage-revieweragents again per file - Provide:
- Context: Original changes + new tests added
- Goal: Verify all critical business logic is covered
- Output: Confirmation or list of missing coverage
- Launch
-
Iterate if needed
- If any files still lack coverage: Return to step 5
- Launch new developer agents only for files with gaps
- Provide specific instructions on what's still missing
- Continue until all critical business logic is covered
- Final verification
- Run full test suite to ensure all tests pass
- Generate coverage report if available
- Verify no regressions in existing tests
Success Criteria
- All critical business logic in changed files has test coverage ✅
- All tests pass (new and existing) ✅
- Test quality verified by coverage-reviewer agents ✅
Agent Instructions Templates
Coverage Review Agent (Initial Analysis)
Analyze the file {FILE_PATH} for test coverage needs.
Context: This file was modified in local changes:
{GIT_DIFF_OUTPUT}
Your task:
1. Read the changed file and understand the business logic
2. Identify all critical code paths that need testing:
- New functions/methods added
- Modified business logic
- Edge cases and error handling
- Integration points
3. Review existing tests (if any) to avoid duplication
4. Create a list of test cases needed, prioritized by importance:
- CRITICAL: Core business logic, data mutations
- IMPORTANT: Error handling, validations
- NICE_TO_HAVE: Edge cases, performance
Output format:
- List of test cases with descriptions
- Priority level for each
- Suggested test file location
Developer Agent (Test Creation)
Create tests for file {FILE_PATH} based on coverage analysis.
Coverage review identified these test cases:
{TEST_CASES_LIST}
Your task:
1. Read TDD skill (if available) for best practices on writing tests
2. Read @README.md for project context and testing conventions
3. Read the target file {FILE_PATH} and understand the logic
4. Review existing test files for patterns and style
5. Create comprehensive tests for all identified cases
6. Run the tests: {TEST_COMMAND}
7. Iterate until all tests pass
8. Ensure tests are:
- Clear and maintainable
- Follow project conventions
- Test behavior, not implementation
- Cover edge cases and error paths
Test command: {TEST_COMMAND}
Coverage Review Agent (Verification)
Verify test coverage for file {FILE_PATH}.
Context: Tests were added to cover local changes in this file.
Your task:
1. Read the changed file {FILE_PATH}
2. Read the new test file(s) created
3. Verify all critical business logic is covered:
- All new functions have tests
- All modified logic has tests
- Edge cases are tested
- Error handling is tested
4. Identify any gaps in coverage
5. Confirm test quality (clear, maintainable, follows TDD principles)
Output:
- PASS: All critical business logic is covered ✅
- GAPS: List specific missing test cases that need to be added
FAQ
What does the write-tests skill do?
Add missing test coverage for your local code changes by generating new test files (covers uncommitted and untracked changes, or the latest commit if everything is committed). Use when you want write tests for new logic or increase test coverage.
How do I install write-tests?
Run npx skills add https://github.com/neolabhq/context-engineering-kit --skill write-tests in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/write-tests/ (personal) or .claude/skills/write-tests/ (project).
Which AI agents can use write-tests?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is write-tests safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains write-tests?
It is published by neolabhq in neolabhq/context-engineering-kit. It has 1,237 recorded installs.
More from neolabhq/context-engineering-kit
prompt-engineering
neolabhq/context-engineering-kit
Use this skill when you writing commands, hooks, skills for Agent, or prompts for sub agents or any other LLM interaction, including optimizing prompts, improving LLM outputs, or designing production prompt templates.
thought-based-reasoning
neolabhq/context-engineering-kit
Use when tackling complex reasoning tasks requiring step-by-step logic, multi-step arithmetic, commonsense reasoning, symbolic manipulation, or problems where simple prompting fails - provides comprehensive guide to Chain-of-Thought and related prompting techniques (Zero-shot CoT, Self-Consistency, Tree of Thoughts, Least-to-Most, ReAct, PAL, Reflexion) with templates, decision matrices, and research-backed patterns
context-engineering
neolabhq/context-engineering-kit
Understand the components, mechanics, and constraints of context in agent systems. Use when writing, editing, or optimizing commands, skills, or sub-agents prompts.
reflect
neolabhq/context-engineering-kit
Reflect on previus response and output, based on Self-refinement framework for iterative improvement with complexity triage and verification
write-concisely
neolabhq/context-engineering-kit
Apply writing rules to any documentation that humans will read. Makes your writing clearer, stronger, and more professional.
kaizen
neolabhq/context-engineering-kit
Use when Code implementation and refactoring, architecturing or designing systems, process and workflow improvements, error handling and validation. Provide tehniquest to avoid over-engineering and apply iterative improvements.
Popular testing & qa skills
tdd
mattpocock/skills
Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
grilling
mattpocock/skills
Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.
migrate-to-shoehorn
mattpocock/skills
Migrate test files from as type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace as in tests, or needs partial test data.
run-train
lllllllama/rigorpilot-skills
Rigor Train skill for deep learning research repositories. Use when a documented or selected training command should be run conservatively for startup verification, short-run verification, full kickoff, or resume, with command, config, seed, log, checkpoint, status, and metric evidence written to standardized trainoutputs/. Do not use for environment setup, exploratory sweeps, speculative idea implementation, or end-to-end orchestration.
test-driven-development
obra/superpowers
Use when implementing any feature or bugfix, before writing implementation code
finishing-a-development-branch
obra/superpowers
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work