test-building-blocks

test-building-blocks is a skill for Claude Code, Codex from bartstc/vite-ts-react-template. It costs 88 tokens per session (1,235 once invoked), scanned A, original, MIT.

A catalogue of typed patterns for testing Storybook components, Vitest hooks and units, mock network handlers, and test data fixtures.

In plain words
What is it for?
Use it when writing or changing component interaction tests, hook tests, unit tests, MSW request handlers, or test fixtures.
Why use it?
It helps developers choose the appropriate test layer and follow the project's established structure instead of inventing inconsistent tests.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/bartstc/vite-ts-react-template/test-building-blocks
Any agent
npx skills add bartstc/vite-ts-react-template --skill test-building-blocks
Clone the repo
git clone --depth 1 https://github.com/bartstc/vite-ts-react-template

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-building-blocks

README.md
[![agentmods](https://agentmods.dev/badge/skills/bartstc/vite-ts-react-template/test-building-blocks.svg)](https://agentmods.dev/skills/bartstc/vite-ts-react-template/test-building-blocks)
Your own site
<a href="https://agentmods.dev/skills/bartstc/vite-ts-react-template/test-building-blocks"><img src="https://agentmods.dev/badge/skills/bartstc/vite-ts-react-template/test-building-blocks.svg" alt="Measured on agentmods" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,235 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00088 $0.01235
Opus 5 $0.00044 $0.00617
Sonnet 5 $0.00018 $0.00247
Haiku 4.5 $0.00009 $0.00123

Measured 4d ago against content hash c86d48cbda83, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

test-building-blocks scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/test-building-blocks/SKILL.md · 82 lines

How it starts

The opening of the file, as written. The whole thing — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 }).

Read the full file on GitHub · 82 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 82 lines · 0 tokens per session scan A c86d48cbda83

Subscribe to this mod's changes

test-building-blocks is a skill published in the GitHub repository bartstc/vite-ts-react-template (121 stars, last pushed 1mo ago), licensed MIT. It adds 88 tokens to every session and 1,235 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

js-in-html-testing

Test JS logic embedded in HTML using two-layer strategy - Python unit tests + Playwright browser integration tests.

liaohch3/claude-tap · 25 tokens

designing-tests

Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.

CloudAI-X/claude-workflow-v2 · 48 tokens

check-and-test

Run lint checks (ruff for Python, Biome for TS/JS), type checks (pyright for Python, tsc for TS/JS), and the standard pytest tiers (unit + e2e + tests skipped during pre-commit). Investigates failures to determine if they are application bugs or test issues, and fixes application bugs rather than weakening tests. Does…

ReflexioAI/claude-smart · 97 tokens

qa/test-strategy

测试策略和测试金字塔原则,定义单元测试、集成测试、E2E测试的分布和覆盖要求.

echoVic/boss-skill · 33 tokens

prd-auto-test-loop

PRD 驱动的自动化测试编排技能。用于把每版 PRD 的测试计划、AI 自测与自修复、测试报告标准化落地;适用于按验收标准拆分 Unit/Integration/E2E、划分自动化与人工边界、生成版本化 TESTPLAN/TESTREPORT 的场景。.

yunshu0909/yunshu_skillshub · 79 tokens

run-tests

Run Portwood's test suites — the one-command QA harness, the anonymous-Apex e2e scripts, Apex unit tests, prettier, and Code Analyzer. Use before opening a PR, when verifying a fix, or when a test fails and you need to know whether it's your change or the harness.

Portwood-Global-Solutions/Portwood · 64 tokens