code-quest: Skill for Claude Code

.claude/skills/frontend-testing/SKILL.md

frontend-testing is a skill for Claude Code from recca0120/code-quest. It costs 101 tokens per session (3,335 once invoked), scanned A, original, MIT.

A testing guide for React components, hooks, and stores using Testing Library, Vitest, and Storybook. It explains how to test what users can observe and when to replace outside services with test substitutes.

In plain words
What is it for?
Use it when writing or refactoring frontend tests, testing hooks or stores, isolating child components, and choosing between test doubles.
Why use it?
It helps developers choose suitable tests and test substitutes without depending unnecessarily on implementation details or difficult external systems.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is recca0120/code-quest's own configuration. It tells Claude Code how to work on code-quest itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything code-quest configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import type { ComposeToolbarProps } from '../components/ComposeToolbar';.

Reuse

Borrowing it

Nothing to install: this file belongs to recca0120/code-quest. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/recca0120/code-quest/main/.claude/skills/frontend-testing/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/recca0120/code-quest

Made for: Claude Code.

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 frontend-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/recca0120/code-quest/frontend-testing/github.svg)](https://agentmods.dev/skills/recca0120/code-quest/frontend-testing)
Your own site
<a href="https://agentmods.dev/skills/recca0120/code-quest/frontend-testing"><img src="https://agentmods.dev/badge/skills/recca0120/code-quest/frontend-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for frontend-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/recca0120/code-quest/frontend-testing"><img src="https://agentmods.dev/badge/skills/recca0120/code-quest/frontend-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,335 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00101 $0.03335
Opus 5.5 $0.00040 $0.01334
Sonnet 5.5 $0.00020 $0.00667
Haiku 4.5 $0.00010 $0.00333

Measured 2mo ago against content hash eed344ec06e1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

frontend-testing 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 2mo 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.

.claude/skills/frontend-testing/SKILL.md · 251 lines

How it starts

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

Frontend Testing Guide

相關 skill 分工:

  • 五型經典定義(Dummy/Stub/Fake/Spy/Mock)→ test-doubles
  • Server 測試 pattern(DB / socket.io server-side)→ vitest-testing (server)
  • TDD 流程 → tdd-guidelines
  • Socket + pipeline test harness → fake-summoner-client
  • Hook / Context 慣例 → react-hooks
  • Storybook play function / 視覺回歸 → storybook-component
  • 共通慣例(RTL query、userEvent)→ testing-best-practices

Core Principles

這六條依序優先,後條在前條同時成立時才考慮。

1. Testing Library first; no unit/integration split

使用者視角撰寫測試,render 有意義的最小 tree;只有一種檔名 *.test.ts / *.test.tsx,不再有 *.integration.test.* 或其他變體。

  • ✅ 用 render() + testing-library query,不用 shallow render
  • ✅ 斷言使用者可觀察到的結果(DOM、callback、store 狀態),不斷言實作細節
  • ❌ 不在 vitest.config.ts 區分 unit / integration glob

2. Fake first — when the real external dependency is hard to use in tests

當測試對象依賴「外部系統」(網路、Socket.IO、瀏覽器 API、時間、CLI)且真實依賴不易在測試中使用時,Fake 是首選替代品。對「內部 module」的觀察仍用 Spy;完全替換整個內部 module(vi.mock)是最後手段。

決策流程見 Test Double Decision Flow。

3. Fake Component for subcomponent isolation

隔離子元件(不想連動其 deps)時,MUST 撰寫 Fake<Name> React 元件共用原 prop 型別,勝過 vi.mock('./X', () => ({ X: () => null }))。

// ❌ BAD — 失去型別檢查,重構脆弱
vi.mock('./ComposeToolbar', () => ({ ComposeToolbar: () => null }));

// ✅ GOOD — Fake Component 契約對齊
// src/test/fake-compose-toolbar.tsx
import type { ComposeToolbarProps } from '../components/ComposeToolbar';

export function FakeComposeToolbar(props: ComposeToolbarProps) {
  return <div data-testid="fake-toolbar" data-mode={props.mode} />;
}

// test
vi.mock('./ComposeToolbar', () => ({ ComposeToolbar: FakeComposeToolbar }));
// 或 test helper 透過 props 注入

好處:

  • 維持 prop 型別檢查(重構 real component 時,fake 編譯錯誤提醒更新)
  • 可 data-testid 斷言 parent 傳進去的 prop
  • 明確可見「這是測試替身」

4. Tests live at the smallest meaningful render root

用 testing-library 時,測試 render 的是對使用者有意義的最小單位,不是對原始碼檔案一檔對一檔。

情境 要不要建專屬 .test?
純 util / store / hook ✅ 建(.test.ts / renderHook)
有自身邏輯 / state / 複雜渲染的元件(如 EffortSwitch) ✅ 建
簡單 presentational primitive(Badge / IconButton / PaletteEmpty) ❌ 不建;透過 consumer 測試覆蓋
Context / Provider ✅ 建(測 provider 本身),但簡單 state passthrough 可由 consumer 覆蓋

Read the full file on GitHub · 251 lines

Files

What ships with it

3 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. 2mo ago First seen · 251 lines · 101 tokens per session scan A eed344ec06e1

Subscribe to this mod's changes

frontend-testing is a skill published in the GitHub repository recca0120/code-quest (11 stars, last pushed 4mo ago), licensed MIT. It adds 101 tokens to every session and 3,335 once invoked, about $0.0004 per session on Opus 5.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

react-native-testing

Write tests using React Native Testing Library (RNTL) v13 and v14 (@testing-library/react-native). Use when writing, reviewing, or fixing React Native component tests. Covers: render, screen, queries (getBy/getAllBy/queryBy/findBy), Jest matchers, userEvent, fireEvent, waitFor, and async patterns. Supports v13 (React…

callstack/react-native-testing-library · 134 tokens

verify-work

Verify feature, bug, UI, API, mobile, security, or deployment work against acceptance criteria.

HoangNguyen0403/agent-skills-standard · 23 tokens

vitest

Set up Vitest testing in any project — detects type (Cloudflare Workers, React, Node, library), generates vitest.config.ts, test setup, utilities, and a sample test. Covers mocking patterns, coverage config, workspace setup, Jest migration. Use whenever the user mentions adding tests, setting up Vitest, configuring…

jezweb/claude-skills · 87 tokens

authoring-data-quality-checks

Adds and runs data quality checks (dbt-test style assertions) on a project's warehouse tables and saved-query views, and HogQL catalog metrics: not-null, uniqueness, accepted values, referential integrity, row-count bounds, freshness, and custom HogQL. Metrics support custom SQL checks only. Use when asked to test a…

PostHog/posthog · 174 tokens

appbuilder-testing

Generate and run tests for Adobe App Builder actions and UI components. Scaffolds Jest unit tests, integration tests against deployed actions, contract tests for Adobe API interactions, and React component tests using Testing Library. Provides mock helpers for State, Files, Events SDKs, @adobe/aio-lib- clients, ExC…

adobe/skills · 201 tokens

authoring-benchmarks

Design, implement, run, debug, and interpret browser performance benchmarks for Elements components and utilities. Use whenever the user asks to benchmark or performance-test runtime code, create or update a .test.bench.ts file, compare benchmark results, investigate a browser performance regression, understand Vitest…

NVIDIA/elements · 105 tokens