Skip to content
Skill

Unit test

Writes frontend component and hook unit tests focused on user behavior

Unit test is an open-source agent skill for developer tools. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
13
Last commit
License
MIT
Listing updated

Similar skills

About Unit test

This skill guides the agent through writing unit tests for a frontend component or hook named as an argument. It has the agent read the target code first, then decide what to cover: rendering, prop-driven output, user interactions, loading, empty and error states, and basic accessibility. It also lists things to leave out, such as implementation details, third-party library internals, exact styling classes and snapshot tests.

The workflow covers the test file naming and co-location conventions, a Testing Library based template, a preferred query priority that favors roles and labels over test IDs, and examples for wrapping components in a router or mocking a state store. It also includes patterns for async content and keyboard focus, plus assertion and mocking conventions and suggested coverage targets.

The examples assume React with Testing Library and either Vitest or Jest, along with jsdom and jest-dom. The skill adapts to the project's own runner and framework, and includes setup commands and config samples for those stacks.

When your agent uses it

Write unit tests for frontend components and hooks. Follows testing best practices focusing on user behavior over implementation details. Adapts to the project's test runner and component framework.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (8 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the claude-kit plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add ajyadav013/claude-kit
/plugin install claude-kit@claude-kit

Or copy only this skill to ~/.claude/skills/unit-test:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/unit-test &&
cp -R "$tmp/skills/unit-test" ~/.claude/skills/unit-test &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/unit-test inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/unit-test to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/unit-test &&
cp -R "$tmp/skills/unit-test" ~/.agents/skills/unit-test &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/unit-test inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/unit-test to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/unit-test &&
cp -R "$tmp/skills/unit-test" ~/.cursor/skills/unit-test &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/unit-test inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/ajyadav013/claude-kit.git --path skills/unit-test

Or copy the folder to ~/.gemini/skills/unit-test yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/unit-test:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ajyadav013/claude-kit.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/unit-test &&
cp -R "$tmp/skills/unit-test" ~/.copilot/skills/unit-test &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/unit-test inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/ajyadav013/claude-kit.git

Then copy claude-kit/skills/unit-test into your agent's skills folder as unit-test. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Behavior-first test structure
Guides tests toward what a user sees and does rather than internal state or private functions.
Query priority guidance
Ranks Testing Library queries from accessible roles down to test IDs as a last resort.
Provider and store wrappers
Shows how to render components inside a router context or mock a state store module.
Async and accessibility checks
Includes patterns for awaiting async content, verifying accessible labels and keyboard focus.
Test file conventions
Covers naming patterns, co-located test placement and assertion preferences.
Runner setup examples
Provides install commands and config samples for Vitest or Jest with Testing Library.

Good for

  • Write unit tests for a React form component
  • Add tests for a custom hook that manages local state
  • Cover loading, empty and error states of a list component
  • Check that buttons and inputs are reachable by role and label in tests
  • Set up Vitest or Jest with Testing Library for a frontend project

Unit test FAQ

What does the skill need to run?

It is invoked with a component or hook name. The project should have a test runner and Testing Library configured; the skill includes install examples for Vitest or Jest.

Which frameworks does Unit test target?

Its examples use React with Testing Library, and it adapts to the project's own test runner and component framework.

What does Unit test tell the agent not to test?

Implementation details, third-party library behavior, exact CSS classes, mock data structure and snapshot tests.

How do I install Unit test in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/unit-test to use it in all your projects, or to .claude/skills/unit-test in one project. Or install the claude-kit plugin, which includes it: /plugin marketplace add ajyadav013/claude-kit, then /plugin install claude-kit@claude-kit.

Does Unit test run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Unit test?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Unit test?

The closest alternatives to Unit test are React frontend, Jest skill, Test authoring edho ferdian, JavaScript TypeScript jest and React native testing.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from ajyadav013/claude-kit

  1. Guides an agent through pytest, async fixtures and security-regression tests for FastAPI

    • Open source
    • 13 GitHub stars
    • Developer tools
  2. Lets your agent inspect and debug live browser pages via Chrome DevTools MCP

    • Open source
    • 13 GitHub stars
    • Browser automation
  3. Runs concurrent load and stress tests against API endpoints to find latency and throughput

    • Open source
    • 13 GitHub stars
    • Developer tools
  4. Lets an agent click through a feature in a real browser and check how it behaves

    • Open source
    • 13 GitHub stars
    • Developer tools
  5. Runs quick health checks on backend, frontend and login to catch obvious breakage

    • Open source
    • 13 GitHub stars
    • Developer tools
  6. Guides an agent through red-green-refactor, bug reproduction tests and test pyramid

    • Open source
    • 13 GitHub stars
    • Developer tools