[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7598XB2KRPE48T1JXYTCGRP":3,"skill-same:01M7598XB2KRPE48T1JXYTCGRP":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7598XB2KRPE48T1JXYTCGRP","react-testing",null,"React Testing Library + Vitest\u002FJest best practices (2025–2026): unit, integration, mocking,\nasync, CI\u002FCD, and advanced (visual-regression, a11y, performance) testing. Covers the Testing\nTrophy philosophy, query priority (getByRole first, getByTestId last), userEvent over fireEvent,\nfindBy\u002FwaitFor async patterns, custom render with providers, vi.fn\u002FspyOn\u002Fmock, renderHook, React\nQuery + Suspense testing, Vitest vs Jest config (pools, sharding, coverage thresholds), and when\nto reach for axe-core, Chromatic\u002FPlaywright CT, or the Profiler.\nUse when writing or reviewing React component\u002Fhook tests, picking a query or interaction API,\nsetting up Vitest\u002FJest config or coverage gates, or deciding on visual\u002Fa11y\u002Fperf testing.\nDo NOT use for non-React testing or E2E flow design unrelated to components.","fagerbergj\u002Fquack","fagerbergj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F33072697?v=4","01M7598SKYWYZ082FS6E50M3WV","Jason Fagerberg","01M7598SMVNYG05G13KBTK1923",1,"MIT","https:\u002F\u002Fgithub.com\u002Ffagerbergj\u002Fquack\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact-testing\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: react-testing\ndescription: |\n  React Testing Library + Vitest\u002FJest best practices (2025–2026): unit, integration, mocking,\n  async, CI\u002FCD, and advanced (visual-regression, a11y, performance) testing. Covers the Testing\n  Trophy philosophy, query priority (getByRole first, getByTestId last), userEvent over fireEvent,\n  findBy\u002FwaitFor async patterns, custom render with providers, vi.fn\u002FspyOn\u002Fmock, renderHook, React\n  Query + Suspense testing, Vitest vs Jest config (pools, sharding, coverage thresholds), and when\n  to reach for axe-core, Chromatic\u002FPlaywright CT, or the Profiler.\n  Use when writing or reviewing React component\u002Fhook tests, picking a query or interaction API,\n  setting up Vitest\u002FJest config or coverage gates, or deciding on visual\u002Fa11y\u002Fperf testing.\n  Do NOT use for non-React testing or E2E flow design unrelated to components.\nlicense: MIT\n---\n\n# React testing (RTL + Vitest\u002FJest)\n\n## Overview\n\nDecision-level guidance for testing React the way users actually use it. The guiding rule: **the more your tests resemble how the software is used, the more confidence they give** ([Kent C. Dodds](https:\u002F\u002Fkentcdodds.com\u002Fblog\u002Fwrite-tests)). Invest most in integration-level tests; test behaviour, not internals.\n\nCode templates and the full tables live in `references\u002Frecipes.md`. Config, parallelism, and coverage live in `references\u002Fci-and-tooling.md`. Visual\u002Fa11y\u002Fperf live in `references\u002Fadvanced.md`.\n\nquack's web package (`packages\u002Fweb`) uses **Vitest + RTL + user-event** - match that grain before adding deps.\n\n## When to use\n\n- Writing or reviewing a component, hook, form, or async-fetch test.\n- Picking a query (`getByRole` vs `getByTestId`) or interaction API (`userEvent` vs `fireEvent`).\n- Setting up \u002F tuning Vitest or Jest config, parallelism, coverage thresholds, or CI gates.\n- Deciding whether to add visual-regression, accessibility, or performance testing.\n\n## When NOT to use\n\n- Non-React code or pure E2E user-journey design.\n- A question already answered by the repo's existing test setup - read those first.\n\n## Core rules (the reflexes)\n\n1. **Never test internal state or instance methods.** Test what the user sees.\n2. **Query by accessibility, not implementation.** Role\u002Flabel\u002Ftext - never CSS class or component name.\n3. **Don't wrap `render()` in `act()`** - RTL already does. Don't keep a `wrapper` var; destructure `{ rerender }`.\n4. **Use the global `screen`** for queries (pre-bound to `document.body`).\n5. **Default to `userEvent`, not `fireEvent`** - it models the real browser event chain and is async (`await` it).\n6. **Async = `findBy*` \u002F `waitFor` \u002F `waitForElementToBeRemoved`.** Never `setTimeout` or fake timers for async UI.\n\n## Query priority (memorize this order)\n\n`getByRole` → `getByLabelText` → `getByPlaceholderText` → `getByText` → `getByDisplayValue` → `getByAltText` → `getByTestId` (last resort). Variant by intent:\n\n- **`getBy*`** - element you expect present (throws if missing = useful signal).\n- **`queryBy*`** - asserting absence (returns `null`).\n- **`findBy*`** - element appearing after async work (polls via `waitFor`, ~1000ms default).\n\n## Mocking, at a glance\n\n- `vi.fn()` - a fake function (assert calls\u002Fargs). `vi.spyOn(obj, 'm')` - observe\u002Freplace one method.\n- `vi.mock('mod', factory)` - replace a whole module (API client, custom hook). Jest mirrors all three.\n- ESM mock hoisting gotcha → `vi.hoisted()`. Network-level mocking → MSW, not per-call stubs.\n- Hooks → `renderHook` (built into `@testing-library\u002Freact` on React 18+); pass `wrapper` for providers.\n\n## Tooling decisions\n\n- **New Vite\u002FESM project → Vitest** (native ESM, shares `vite.config.ts`, faster watch). **React Native \u002F large legacy Jest → stay on Jest.** See `references\u002Fci-and-tooling.md`.\n- **Coverage gate**: `thresholds` in config fails CI on drop. Industry baseline ~80% statements\u002F functions\u002Flines, ~75% branches. Report `lcov` to Codecov\u002FCoveralls.\n- **Snapshots: avoid** for app components (rubber-stamped, break on irrelevant changes, test structure not behaviour). OK only for truly static UI-library primitives.\n\n## Advanced (reach for these deliberately - `references\u002Fadvanced.md`)\n\n- **Visual regression**: Chromatic (Storybook-native, component-level) → first choice if Storybook exists; Playwright CT (real browser, free, manual baselines); Percy\u002FApplitools (page-level).\n- **Accessibility**: `jest-axe` inside the RTL suite; run `axe()` *after* interactions, not just on mount. Catches missing labels\u002Fcontrast\u002FARIA - not whether alt text is *meaningful*.\n- **Performance**: React `\u003CProfiler>` API; `vitest-react-profiler` for render-count assertions; performance budgets (unit render-time → page TTI → Lighthouse CI) in the pipeline.\n","# React testing (RTL + Vitest\u002FJest)\n\n## Overview\n\nDecision-level guidance for testing React the way users actually use it. The guiding rule: **the more your tests resemble how the software is used, the more confidence they give** ([Kent C. Dodds](https:\u002F\u002Fkentcdodds.com\u002Fblog\u002Fwrite-tests)). Invest most in integration-level tests; test behaviour, not internals.\n\nCode templates and the full tables live in `references\u002Frecipes.md`. Config, parallelism, and coverage live in `references\u002Fci-and-tooling.md`. Visual\u002Fa11y\u002Fperf live in `references\u002Fadvanced.md`.\n\nquack's web package (`packages\u002Fweb`) uses **Vitest + RTL + user-event** - match that grain before adding deps.\n\n## When to use\n\n- Writing or reviewing a component, hook, form, or async-fetch test.\n- Picking a query (`getByRole` vs `getByTestId`) or interaction API (`userEvent` vs `fireEvent`).\n- Setting up \u002F tuning Vitest or Jest config, parallelism, coverage thresholds, or CI gates.\n- Deciding whether to add visual-regression, accessibility, or performance testing.\n\n## When NOT to use\n\n- Non-React code or pure E2E user-journey design.\n- A question already answered by the repo's existing test setup - read those first.\n\n## Core rules (the reflexes)\n\n1. **Never test internal state or instance methods.** Test what the user sees.\n2. **Query by accessibility, not implementation.** Role\u002Flabel\u002Ftext - never CSS class or component name.\n3. **Don't wrap `render()` in `act()`** - RTL already does. Don't keep a `wrapper` var; destructure `{ rerender }`.\n4. **Use the global `screen`** for queries (pre-bound to `document.body`).\n5. **Default to `userEvent`, not `fireEvent`** - it models the real browser event chain and is async (`await` it).\n6. **Async = `findBy*` \u002F `waitFor` \u002F `waitForElementToBeRemoved`.** Never `setTimeout` or fake timers for async UI.\n\n## Query priority (memorize this order)\n\n`getByRole` → `getByLabelText` → `getByPlaceholderText` → `getByText` → `getByDisplayValue` → `getByAltText` → `getByTestId` (last resort). Variant by intent:\n\n- **`getBy*`** - element you expect present (throws if missing = useful signal).\n- **`queryBy*`** - asserting absence (returns `null`).\n- **`findBy*`** - element appearing after async work (polls via `waitFor`, ~1000ms default).\n\n## Mocking, at a glance\n\n- `vi.fn()` - a fake function (assert calls\u002Fargs). `vi.spyOn(obj, 'm')` - observe\u002Freplace one method.\n- `vi.mock('mod', factory)` - replace a whole module (API client, custom hook). Jest mirrors all three.\n- ESM mock hoisting gotcha → `vi.hoisted()`. Network-level mocking → MSW, not per-call stubs.\n- Hooks → `renderHook` (built into `@testing-library\u002Freact` on React 18+); pass `wrapper` for providers.\n\n## Tooling decisions\n\n- **New Vite\u002FESM project → Vitest** (native ESM, shares `vite.config.ts`, faster watch). **React Native \u002F large legacy Jest → stay on Jest.** See `references\u002Fci-and-tooling.md`.\n- **Coverage gate**: `thresholds` in config fails CI on drop. Industry baseline ~80% statements\u002F functions\u002Flines, ~75% branches. Report `lcov` to Codecov\u002FCoveralls.\n- **Snapshots: avoid** for app components (rubber-stamped, break on irrelevant changes, test structure not behaviour). OK only for truly static UI-library primitives.\n\n## Advanced (reach for these deliberately - `references\u002Fadvanced.md`)\n\n- **Visual regression**: Chromatic (Storybook-native, component-level) → first choice if Storybook exists; Playwright CT (real browser, free, manual baselines); Percy\u002FApplitools (page-level).\n- **Accessibility**: `jest-axe` inside the RTL suite; run `axe()` *after* interactions, not just on mount. Catches missing labels\u002Fcontrast\u002FARIA - not whether alt text is *meaningful*.\n- **Performance**: React `\u003CProfiler>` API; `vitest-react-profiler` for render-count assertions; performance budgets (unit render-time → page TTI → Lighthouse CI) in the pipeline.\n",{"name":5,"license":15,"description":24},"React Testing Library + Vitest\u002FJest best practices (2025–2026): unit, integration, mocking,\nasync, CI\u002FCD, and advanced (visual-regression, a11y, performance) testing. Covers the Testing\nTrophy philosophy, query priority (getByRole first, getByTestId last), userEvent over fireEvent,\nfindBy\u002FwaitFor async patterns, custom render with providers, vi.fn\u002FspyOn\u002Fmock, renderHook, React\nQuery + Suspense testing, Vitest vs Jest config (pools, sharding, coverage thresholds), and when\nto reach for axe-core, Chromatic\u002FPlaywright CT, or the Profiler.\nUse when writing or reviewing React component\u002Fhook tests, picking a query or interaction API,\nsetting up Vitest\u002FJest config or coverage gates, or deciding on visual\u002Fa11y\u002Fperf testing.\nDo NOT use for non-React testing or E2E flow design unrelated to components.\n","main","ee56fa2c361ddac0a541d4a37e07292226298fa4",".agents\u002Fskills\u002Freact-testing",0,"https:\u002F\u002Fgithub.com\u002Ffagerbergj\u002Fquack","https:\u002F\u002Fgithub.com\u002Ffagerbergj","2026-11-15 00:17:15",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add fagerbergj\u002Fquack --skill react-testing",{"tool":38,"command":39},"bunx","bunx skills add fagerbergj\u002Fquack --skill react-testing",{"tool":41,"command":42},"pnpm","pnpm dlx skills add fagerbergj\u002Fquack --skill react-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ffagerbergj\u002Fquack\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact-testing\u002FSKILL.md",true,[46,52,56],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fadvanced.md","REFERENCE","参考文档",3857,"https:\u002F\u002Fgithub.com\u002Ffagerbergj\u002Fquack\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact-testing\u002Freferences\u002Fadvanced.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fci-and-tooling.md",2786,"https:\u002F\u002Fgithub.com\u002Ffagerbergj\u002Fquack\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact-testing\u002Freferences\u002Fci-and-tooling.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Frecipes.md",4933,"https:\u002F\u002Fgithub.com\u002Ffagerbergj\u002Fquack\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Freact-testing\u002Freferences\u002Frecipes.md",[61],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M759959KMN4V7EXK1DP8Y8HG","write-system-prompt","Expert framework for writing, auditing, and optimizing production-grade LLM system prompts. Synthesizes patterns from OpenCode's multi-provider architecture, Claude Code\u002FAGENTS.md conventions, HumanLayer context engineering research, and community lean-prompt benchmarks. Covers structure design, persona definition, constraint setting, tool declarations, reasoning protocols, progressive disclosure, and provider-specific optimization. Use when designing, reviewing, or iterating on any agent system prompt, CLAUDE.md, AGENTS.md, or SKILL.md instruction body.","https:\u002F\u002Fgithub.com\u002Ffagerbergj\u002Fquack\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwrite-system-prompt\u002FSKILL.md",[],[]]