Agent skill

Test Building Blocks

by bartstc in bartstc/vite-ts-react-template

Test building block catalog — typed patterns for Storybook play-function tests, Vitest hook tests, Vitest unit tests, MSW handlers, and test data fixtures.

MITAuto-check passedTesting & QA

Install Test Building Blocks

skills CLI
$ npx skills add bartstc/vite-ts-react-template --skill test-building-blocks -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install bartstc/vite-ts-react-template test-building-blocks --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/bartstc/vite-ts-react-template.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/test-building-blocks .claude/skills/test-building-blocks && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
test-building-blocks
GitHub stars
122
Token cost
~1.5k tokens
SKILL.md length
632 words
Files
8
Skills in repo
7
Repo updated
First seen
Licence
MIT

At a glance

Test building block catalog — typed patterns for Storybook play-function tests, Vitest hook tests, Vitest unit tests, MSW handlers, and test data fixtures.

  • Works in 4 steps: Read this file to route to the right… → Read rules/{block-name}.md for the full… → Read the implementation code (component,… → …
  • Tasks that involve Unit testing
  • SKILL.md covers How to Use, Testing Philosophy, Mocking Boundary and Block Catalog, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Test Building Blocks is an agent skill from bartstc/vite-ts-react-template. Test building block catalog — typed patterns for Storybook play-function tests, Vitest hook tests, Vitest unit tests, MSW handlers, and test data fixtures. Read the relevant rule file before writing or modifying any test, handler, or fixture. Covers: deciding which kind of test to write, authoring a new test from scratch, adding MSW mocks or fixtures, and reviewing existing tests for conformance.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files (for example `README.md`, `metadata.json` and `rules/component-story-test.md`).

It sits in Testing & QA, covering Unit testing and Test data and fixtures. It works with Vitest, Storybook, React and TanStack. The repository describes itself as: This project provides a basic dev setup intended for Single Page Application (SPA) development. It contains key tools, settings for seamless DX, and an demo app presenting good… The licence is MIT.

When your agent uses it

  • Tasks that involve Unit testing
  • Tasks that involve Test data and fixtures

Example prompts

  • “/test-building-blocks”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Read this file to route to the right block.
  2. Read rules/{block-name}.md for the full pattern and canonical example.
  3. Read the implementation code (component, hook, module) you are testing.
  4. Write the test following the rule file's constraints.

What it can do on your machine

Read from SKILL.md and the folder at commit 6aa5c9c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Test Building Blocks loads about 1.5k tokens when it runs. Until then it costs about 105 tokens; SKILL.md has 632 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~105
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from bartstc/vite-ts-react-template at commit 6aa5c9c, republished under its MIT licence (© bartstc). 632 words, ~1,545 tokens.

Download SKILL.mdSave it as .claude/skills/test-building-blocks/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
test-building-blocks
description
Test building block catalog — typed patterns for Storybook play-function tests, Vitest hook tests, Vitest unit tests, MSW handlers, and test data fixtures. Read the relevant rule file before writing or modifying any test, handler, or fixture. Covers: deciding which kind of test to write, authoring a new test from scratch, adding MSW mocks or fixtures, and reviewing existing tests for conformance.

Test Building Blocks

Typed catalog of test-related building blocks used in this project. Each block has a fixed name, layer, composition rules, and canonical example.

How to Use

Read the rule file for each block you are about to implement. The summaries below are for routing — the rule files contain the full pattern.

Typical flow:

  1. Read this file to route to the right block.
  2. Read rules/{block-name}.md for the full pattern and canonical example.
  3. Read the implementation code (component, hook, module) you are testing.
  4. Write the test following the rule file's constraints.

Testing Philosophy

The project's testing philosophy allocates verification across three layers:

  • Storybook play-function tests are the primary verification layer for feature behavior. Focus on happy paths and the main user-observable states. Anything user-facing — components composing hooks, stores, providers — is verified here.
  • Vitest hook tests (renderHook) cover custom hooks that need dedicated verification — edge cases, error paths, loading states, and hooks with logic not tied to a single component. Use independently of component-story-test; the two do not need to cover the same ground.
  • Vitest unit tests are reserved for non-hook mechanics: mappers, transformers, value objects, selectors, and other pure logic.
  • No tests for fixtures, MSW handlers, or trivial glue — these are support infrastructure, not the thing being verified.

Coverage is behavior-covered, not file-mapped. Every user-observable state has a story or a hook-test scenario; not every file has a test.

Mocking Boundary

Mock at the network boundary, not the module boundary. MSW is the default for anything HTTP-backed. Do not mock lib/api/ exports, React Query, or Zustand stores — let the real code run and intercept at the wire.

Module-level mocking (vi.mock, vi.stubGlobal) is reserved for:

  • Non-determinism sources: Date.now, crypto.randomUUID, Math.random, timers.
  • Write-only side-effect sinks: analytics, logging, toasts — centralized as project-owned spies in test-lib/.
  • Pure utilities when unit-testing their direct caller.
  • XState actors/actions via machine.provide({ actors, actions }).

Rationale: mocking lib/api/ wrappers hides the bugs most likely to ship (wrong query key, wrong select, stale-time issues, cache collisions). MSW keeps the real wiring under test and only fakes the external world.

Block Catalog

Tests
BlockLayerSummaryFile
component-story-testco-located .stories.tsxStorybook play-function test verifying user-facing behavior. Primary verification layer for rendered components.rules/component-story-test.md
hook-testco-located .test.tsxVitest test using renderHook for custom hooks — edge cases, error/loading paths, cross-component hooks.rules/hook-test.md
unit-testco-located .test.ts(x)Vitest test for non-hook mechanics — mappers, transformers, value objects, selectors, pure functions.rules/unit-test.md
Show full SKILL.md (234 more words)Show less
Support Infrastructure
BlockLayerSummaryFile
msw-handlertest-lib/handlers/One request handler per endpoint with optional resolver for per-scenario overrides. Shared across tests and stories.rules/msw-handler.md
fixturetest-lib/fixtures/Deterministic test data factory via createFixture<T>(). Supplies toStructure, createPermutation, createCollection.rules/fixture.md

Deciding Which Block to Use

Decide in this order:

  1. Is the code under test user-facing (rendered, interactive)? → component-story-test. Covers the happy path and main user-observable states. Mutation hooks, Zustand stores, XState machines, context providers composed by the component are exercised transitively.
  2. Is the code under test a custom hook that needs dedicated verification? → hook-test. Use for hooks whose edge cases, error branches, or loading states are awkward to reproduce through component UI, or for hooks used by multiple components where duplicating scenarios per component is wasteful.
  3. Is the code under test pure, non-hook mechanics? → unit-test. Mappers, transformers, value objects, selectors, date math, query-keys factories.

For support code:

  • Need to mock an HTTP endpoint? → msw-handler. One factory per endpoint; resolver at call site for per-scenario overrides.
  • Need deterministic test data? → fixture. Domain type in, factory out. No randomness, no Date.now().

Do not write tests for: fixtures, MSW handler factories, trivial glue (re-exports, constants, pass-through hooks).

Rules

  • Block files live in rules/ — one file per block.
  • Each file contains: description, constraints, and a canonical code example.
  • Block names are stable identifiers. If referenced from a spec or documentation, use the exact name from the catalog.

© bartstc, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files in .agents/skills/test-building-blocks of bartstc/vite-ts-react-template.

  • SKILL.md
  • README.md
  • metadata.json
  • rules/component-story-test.md
  • rules/fixture.md
  • rules/hook-test.md
  • rules/msw-handler.md
  • rules/unit-test.md

Open the folder on GitHubat commit 6aa5c9c

Compare with similar skills

Test Building Blocks next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Test Building Blocks compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Test Building Blocks this skillbartstc/vite-ts-react-template122—~1.5kAutomated safety check: PassMIT
Check Visual Changesigrlk/storybook-addon-test-codegen1541 repos~1.4kAutomated safety check: PassMIT
Effect TStellahq/opensession392—~3.7kAutomated safety check: PassMIT
Data Client React Testingreactive/data-client2k—~1.5kAutomated safety check: PassApache-2.0
LobeHub Testing Guidelobehub/lobehub83k—~1.6kAutomated safety check: PassCustom licence
Menu Testing Ssrasmyshlyaev177/react-horizontal-scrolling-menu790—~3.5kAutomated safety check: PassMIT

Similar skills

  • Check Visual Changes

    igrlk/storybook-addon-test-codegen

    Check the visual impact of an edit mid-task with uiverify check — render just the components you're touching on the UI Verify fleet and diff them against the real CI baseline, without opening a PR…

    154 GitHub starsUsed in 1 repo~1.4k tokens
    Testing & QAAuto-check passed
  • Effect TS

    tellahq/opensession

    Write idiomatic Effect v4 TypeScript verified against the pinned effect@4.0.0-rc.112 source.

    392 GitHub stars~3.7k tokensUpdated today
    Testing & QAAuto-check passed
  • Data Client React Testing

    reactive/data-client

    Test @data-client/react with renderDataHook and mountDataClient - jest unit tests, fixtures, interceptors, MockResolver, mock responses, nock HTTP mocking, fake timers for polling/subscription…

    2k GitHub stars~1.5k tokensUpdated today
    Testing & QAAuto-check passed
  • LobeHub Testing Guide

    lobehub/lobehub

    Explains how to write and run Vitest tests in the LobeHub monorepo: single-file commands, mocking rules, database model tests and regression tests for fixes.

    83k GitHub stars~1.6k tokensUpdated today
    Testing & QAAuto-check passed
  • Menu Testing Ssr

    asmyshlyaev177/react-horizontal-scrolling-menu

    Server rendering and testing for react-horizontal-scrolling-menu: the library is client-only ('use client' required in React Server Components, else "createContext is not a function"), SSR first…

    790 GitHub stars~3.5k tokensUpdated 5 days ago
    Testing & QAAuto-check passed
  • Implement or refactor Formax tool transcript UI using the Tool UI Blocks (C-lite) pattern (ToolUiBlocks renderer + blocks presenters) to avoid touching many tool presenter files; use when adjusting…

    195 GitHub stars~1.3k tokensUpdated 2 mo ago
    Testing & QAAuto-check passed

More from bartstc/vite-ts-react-template

  • GitHub Actions Templates

    bartstc/vite-ts-react-template

    Create production-ready GitHub Actions workflows for automated testing, building, and deploying applications.

    122 GitHub starsUsed in 13 repos~1.9k tokens
    Auto-check passed
  • Commit Work

    bartstc/vite-ts-react-template

    Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits).

    122 GitHub starsUsed in 3 repos~623 tokens
    Auto-check passed
  • Playwright Page Objects

    bartstc/vite-ts-react-template

    A skill your agent uses when creating page objects or refactoring Playwright E2E tests for better maintainability with Page Object Model patterns.

    122 GitHub stars~1k tokensUpdated yesterday
    Auto-check: notes
  • Writing Spec

    bartstc/vite-ts-react-template

    Collaboratively write a feature spec with the developer. An agent skill from bartstc/vite-ts-react-template.

    122 GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed
  • Explaining Code

    bartstc/vite-ts-react-template

    Explains code with visual diagrams and analogies. An agent skill from bartstc/vite-ts-react-template.

    122 GitHub starsUsed in 2 repos~154 tokens
    Auto-check passed
  • Building Blocks

    bartstc/vite-ts-react-template

    Frontend building block catalog — typed patterns for components, hooks, queries, mutations, stores, and models.

    122 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Test Building Blocks

What does Test Building Blocks do?

Test building block catalog — typed patterns for Storybook play-function tests, Vitest hook tests, Vitest unit tests, MSW handlers, and test data fixtures. Test Building Blocks is an agent skill from bartstc/vite-ts-react-template. Test building block catalog — typed patterns for Storybook play-function tests, Vitest hook tests, Vitest unit tests, MSW handlers, and test data fixtures.

When should I use Test Building Blocks?

Test Building Blocks fits situations like: tasks that involve Unit testing; tasks that involve Test data and fixtures.

How do I install Test Building Blocks in Claude Code?

Run `npx skills add bartstc/vite-ts-react-template --skill test-building-blocks -a claude-code`. Or copy the skill folder (.agents/skills/test-building-blocks in bartstc/vite-ts-react-template) into .claude/skills/test-building-blocks in your project. Claude Code loads it when a task matches its description.

How do I install Test Building Blocks in Codex?

Run `npx skills add bartstc/vite-ts-react-template --skill test-building-blocks -a codex`. Or copy the skill folder (.agents/skills/test-building-blocks in bartstc/vite-ts-react-template) into .agents/skills/test-building-blocks in your project. Codex loads it when a task matches its description.

Can I use Test Building Blocks in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add bartstc/vite-ts-react-template --skill test-building-blocks -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/test-building-blocks, .gemini/skills/test-building-blocks, .github/skills/test-building-blocks and .opencode/skills/test-building-blocks in your project.

What does Test Building Blocks need to run?

SKILL.md names no scripts, command-line tools or credentials: Test Building Blocks is instructions for the agent only.

Does Test Building Blocks access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Test Building Blocks safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Test Building Blocks use?

Test Building Blocks is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Test Building Blocks use?

About 1.5k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Test Building Blocks?

Skills that share tags, products or a category with Test Building Blocks: Check Visual Changes (igrlk/storybook-addon-test-codegen, 154 stars), Effect TS (tellahq/opensession, 392 stars), Data Client React Testing (reactive/data-client, 2k stars) and LobeHub Testing Guide (lobehub/lobehub, 83k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Test Building Blocks?

bartstc (a GitHub user) maintains it in bartstc/vite-ts-react-template, which has 122 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 6, 2026.

Source: bartstc/vite-ts-react-template on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.