WR

writing-tests

Provides testing patterns and debugging support for AiderDesk using Vitest and React Testing Library.

Install

mkdir -p .claude/skills/writing-tests && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4125" && unzip -o skill.zip -d .claude/skills/writing-tests && rm skill.zip

Installs to .claude/skills/writing-tests

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Write unit tests, component tests, and integration tests for AiderDesk using Vitest and React Testing Library. Use when creating new tests, adding test coverage, configuring mocks, setting up test files, or debugging failing tests.
231 chars✓ has a “when” trigger
Beginner

Key capabilities

  • Create unit tests for pure functions
  • Test React components for user interactions
  • Configure centralized mock factories
  • Debug failing assertions in tests
  • Organize test files by directory structure

How it works

It guides the creation of unit tests for logic, component tests for React components, and the configuration of mocks using Vitest and React Testing Library.

Inputs & outputs

You give it
TypeScript code for AiderDesk project
You get back
Unit, component, or integration tests using Vitest and React Testing Library

When to use writing-tests

  • Write unit tests for utility functions
  • Create component tests with React Testing Library
  • Configure vitest mocks

About this skill

Writing Tests

Write effective tests using Vitest and React Testing Library.

Quick Start

Create a unit test in packages/common/__tests__/utils/math.test.ts:

import { describe, it, expect } from 'vitest';
import { add } from '../../utils/math';

describe('math utility', () => {
  it('adds two numbers correctly', () => {
    expect(add(1, 2)).toBe(3);
  });
});

Run tests with npm run test.

Core Patterns

Unit Testing

Focus on pure functions and logic in src/main or packages/common. Use vi.mock() for dependencies.

Component Testing

Test React components in src/renderer. Focus on user interactions and props.

Mocking

Use centralized mock factories for consistent testing across components and contexts.

Debugging Failing Tests

  1. Read the error output and identify the failing assertion
  2. Check mock setup — verify vi.mock() paths and return values match expectations
  3. For component tests, inspect rendered output with screen.debug()
  4. Run a single test in isolation: npm run test:node -- --no-color -t "test name"
  5. Verify coverage: npm run test:coverage to confirm new code is tested

Advanced Usage

For detailed information:

How it compares

This skill provides specific patterns and commands for AiderDesk projects, unlike general testing guides.

Compared to similar skills

writing-tests side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
writing-tests (this skill)14moNo flagsBeginner
react-best-practices223moNo flagsIntermediate
frontend-testing113moReviewIntermediate
feature-flags66moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry