write-tests · justxor — Claude Code skill: what it does, how to install
write-tests generates unit tests for a chosen file or function while matching existing project patterns. It runs new checks and flags discovered bugs instead of bending assertions.
MIT ★ 353 updated 2026-10-01
npx skills add justxor/claude-code-pro-course --skill write-tests -a claude-codeWhat write-tests does
The skill takes a file path or function name, inspects the active test framework, and reviews one or two nearby tests to mirror their file placement and syntax. It maps out scenarios line by line: the standard happy path, error paths, and edge values like zero, negative numbers, empty inputs, large limits, or unicode strings. External systems get mocks, while internal project logic is tested directly.
After drafting the suite, it runs only the newly generated cases. If a test fails because the underlying logic is broken, the skill will not adjust assertions to hide the defect; it reports the bug directly to the developer. The final summary outlines the total number of tests, covered areas, and discovered bugs.
What it helps with
- Write unit tests matching the structure and style of existing project tests
- Test edge cases including zero, empty strings, negative numbers, and unicode
- Uncover code bugs by running newly authored tests
- Outline test scenarios for exceptions and external dependency mocks
Example prompts for the agent
- Write tests for
src/utils/pricing.ts - Check edge cases for the
calculate_discountfunction - Cover error handling with unit tests in
src/auth.py
How to install write-tests
1Skills CLI (Vercel)
npx skills add justxor/claude-code-pro-course --skill write-tests -a claude-code2Manually: put the files in place
~/.claude/skills/write-tests/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/write-tests/
1Skills CLI (Vercel)
npx skills add justxor/claude-code-pro-course --skill write-tests -a codex2Manually: put the files in place
.agents/skills/write-tests/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add justxor/claude-code-pro-course --skill write-tests -a cursor2Manually: put the files in place
.cursor/skills/write-tests/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install justxor/claude-code-pro-course starter-kit/.claude/skills/write-tests2Manually: put the files in place
.github/skills/write-tests/SKILL.md1Skills CLI (Vercel)
npx skills add justxor/claude-code-pro-course --skill write-tests -a gemini-cli2Platform CLI
gemini skills install https://github.com/justxor/claude-code-pro-course --path starter-kit/.claude/skills/write-testsManually: put the files in place
.devin/skills/write-tests/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about write-tests
How to install write-tests in Claude Code?
Run npx skills add justxor/claude-code-pro-course --skill write-tests -a claude-code.
What does write-tests do?
It writes unit tests for a target file or function, matching the project test framework and surrounding testing style. It covers happy paths, exceptions, and edge values.
What happens if a newly generated test fails?
When a failure is caused by an actual bug in the code, the skill does not rewrite assertions to make it pass. Instead, it reports the bug in the summary.
Source text
SKILL.md · MIT
--- name: write-tests description: Пишет unit-тесты для указанного файла или функции в стиле существующих тестов проекта. Используй, когда просят добавить тесты, покрыть код тестами или проверить граничные случаи. argument-hint: <путь к файлу или имя функции> --- # Write tests Цель: $ARGUMENTS 1. Найди тестовый фреймворк и 1–2 существующих теста рядом — повторяй их стиль, структуру и расположение. 2. Прочитай тестируемый код. Составь список сценариев: - основной (happy path) - граничные значения (пусто, 0, отрицательные, очень большие, unicode) - ошибки и исключения - взаимодействие с зависимостями (моки — только для внешних систем) 3. Покажи список сценариев одной строкой каждый, затем напиши тесты. 4. Запусти только новые тесты. Если тест падает из-за бага в коде — НЕ подгоняй тест, а сообщи о баге. 5. Итог: сколько тестов, что покрыто, какие баги найдены.
© justxor · MIT · justxor/claude-code-pro-course
Similar skills
All skills for Testing and QA →write-tests by other authors comes first.