Automated summary
Provides patterns for unit testing including Vitest configuration, Testing Library component testing, MSW for HTTP mocking, parametrized tests, and async testing.
Strengths
- Emphasizes testing behavior over implementation
- Recommends MSW over jest.mock for network level mocking
- Provides ready-to-use references for common testing scenarios
- Covers both business logic and UI component testing
Limitations
- Assumes familiarity with basic testing concepts
- Examples may not cover every edge case
- Limited to JavaScript/TypeScript ecosystem
Use when setting up a new testing infrastructure or writing unit/component tests for a JavaScript/TypeScript project.
Do not use for end-to-end testing or integration tests that require full system interaction.
Security analysis
SafeThe skill defines unit testing patterns and only uses read-only tools (Read, Grep, Glob). There are no destructive actions, code execution, or data exfiltration.
No concerns found
How this analysis is madeExamples
Set up Vitest with v8 coverage for my React project.Write a unit test for a pure function that calculates discounts using parametrized tests.Mock an HTTP GET request using MSW for a component test.name: unit-testing description: | Unit testing patterns: Vitest config with v8 coverage, Testing Library behavior testing, MSW for HTTP mocking (vs jest.mock), it.each parametrized tests, spies vs mocks vs stubs, testing async code, snapshot testing guidelines. Use when writing unit and component tests. allowed-tools: Read, Grep, Glob
Unit Testing Patterns
When to use
- Setting up Vitest or Jest for a new project
- Writing unit tests for business logic
- Component testing with Testing Library
- Mocking HTTP requests with MSW
- Parametrized tests with it.each
Core principles
- Test behavior, not implementation — what does it return/do, not how
- MSW over jest.mock — mock at network level, not module level
- One assertion per test — single reason to fail per test
- Arrange-Act-Assert — consistent structure in every test
- No test interdependence — each test must run independently
References available
references/vitest-config.md— globals, environment, coverage thresholds, thread pool, MSW setupreferences/business-logic-testing.md— pure function tests, AAA pattern, it.each parametrized testsreferences/msw-http-mocking.md— handlers setup, server lifecycle, per-test handler overridesreferences/async-testing.md— await patterns, rejected promise assertions, try/catch error checksreferences/testing-library-react.md— render, screen queries, userEvent vs fireEvent, role queries
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/unit-testing-patterns-mm8o524q/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/unit-testing-patterns-mm8o524q' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/unit-testing-patterns-mm8o524q/download' --output '.skill-downloads/unit-testing-patterns-mm8o524q/SKILL.md.part' && mv '.skill-downloads/unit-testing-patterns-mm8o524q/SKILL.md.part' '.skill-downloads/unit-testing-patterns-mm8o524q/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Read, Grep, Glob
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/unit-testing-patterns-mm8o524q/SKILL.md' && test -s '.skill-downloads/unit-testing-patterns-mm8o524q/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/unit-testing' && cp -R '.skill-downloads/unit-testing-patterns-mm8o524q' '.claude/skills/unit-testing'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/unit-testing-patterns-mm8o524q'openskills read 'unit-testing-patterns-mm8o524q'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/unit-testing-patterns-mm8o524q/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
ClickHouse Performance Comparison
Testing
Evaluate ClickHouse performance test results, check PR performance changes, compare with history, and assess whether a result is actionable.
Analyze CI Performance Reports
Testing
Analyze CI performance comparison reports for a ClickHouse PR. Cross-references master history to distinguish real regressions from flaky tests.
Santa Method
Testing
Multi-agent adversarial verification with two independent reviewers. Output is checked twice and iteratively fixed until both pass before shipping.