Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add justxor/claude-code-pro-course --skill write-tests -a claude-code
Open on GitHub

What 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_discount function
  • 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-code

2Manually: put the files in place

~/.claude/skills/write-tests/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/write-tests/

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.

write-tests NeoLabHQ The write-tests skill reads your uncommitted and untracked git changes and writes tests for them. Useful when the logic is done but coverage is not. CX Codex +1 1,300installs writing-mstest-tests dotnet writing-mstest-tests is a Claude Code skill for editing existing MSTest tests and explaining MSTest configuration. It activates for requests to fix test code or MSTest-specific settings. CX Codex +1 4,500installs write-unit-tests tldraw write-unit-tests — a skill that guides writing unit and integration tests in the tldraw repo: where test files belong, how to drive TestEditor, and which Vitest traps to avoid. CX Codex +1 503installs rust-write-tests pproenca rust-write-tests guides coding agents in writing deep Rust tests that target invariants, isolate test files, and systematically eradicate flaky async test runs. CX Codex +1 257installs TDD Red Phase - Write Failing Tests First official github The TDD Red Phase - Write Failing Tests First subagent pulls GitHub issue context from branch names and creates failing tests for acceptance criteria before code is written. It enforces the red stage of TDD. CX Codex +1 ★ 41,430repo stars running-release-tests aws running-release-tests runs UI and API release tests in AWS DevOps Agent from a pre-configured test profile. Useful before a rollout, when you want workflows and regressions checked. CX Codex +1 1,600installs testing Mindrally Defines software testing guidelines for AI agents, covering test isolation, table-driven checks, and mock boundaries. CX Codex +1 888installs

From the same set15

The whole set →
docs-writer docs-writer — a subagent that updates README, API docs, code comments, and ADRs whenever your code changes. It verifies actual behavior and keeps examples aligned with reality. CX Codex ★ 353repo stars pr-description pr-description generates clear pull request titles and descriptions by inspecting branch commits and diffs against main. CX Codex +1 ★ 353repo stars architect The architect subagent examines a project before implementation, compares design options, and lays out a change plan. Use it to scope a feature or a major refactor. CX Codex ★ 353repo stars code-reviewer code-reviewer reads your diff, flags security holes, missing tests and edge cases, then returns a severity-sorted report with a file and line for each fix. CX Codex ★ 353repo stars commit This skill reviews your working changes and creates a git commit in Conventional Commits format. Use it when you want an agent to make a commit that follows the repository’s message style. CX Codex +1 ★ 353repo stars refactor Runs refactoring as a sequence of small, behavior-preserving steps. Use it when you ask the agent to split a module or remove duplication. CX Codex +1 ★ 353repo stars release-notes Generates release notes and CHANGELOG entries between Git tags or from the latest tag to HEAD using Conventional Commits. CX Codex +1 ★ 353repo stars onboard The onboard skill gives a new developer a guided introduction to a codebase, from its layout to its main workflows. Use it when someone needs to get oriented and find a first task. CX Codex +1 ★ 353repo stars

Project sponsors

Companies that keep this analytics open