[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M799XCMVX8QVPEECAMYAQFYR":3,"skill-same:01M799XCMVX8QVPEECAMYAQFYR":50},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M799XCMVX8QVPEECAMYAQFYR","react-testing-library",null,"General-purpose React Testing Library guide with Vitest. Use when writing, reviewing, or setting up React component and hook tests. Covers project setup from scratch, RTL query priority, userEvent, async patterns, mocking strategies, and common anti-patterns. Applicable to any Vite + React project.","SyukPublic\u002Fdev-digest-ai-marketplace","SyukPublic","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211482903?v=4","01M799WENGJRH924NQACAF41WB","Roman","01M799WEP642M9AWFZ4NWSWNT8",0,"MIT","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Freact-testing-library\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: react-testing-library\ndescription: \"General-purpose React Testing Library guide with Vitest. Use when writing, reviewing, or setting up React component and hook tests. Covers project setup from scratch, RTL query priority, userEvent, async patterns, mocking strategies, and common anti-patterns. Applicable to any Vite + React project.\"\n---\n\n# React Testing Library\n\nGeneral-purpose guide for testing React components and hooks with React Testing Library (RTL) and Vitest. Project-agnostic — works with any Vite + React setup.\n\n## Philosophy: Fewer Tests, Real Scenarios\n\n> \"Write tests. Not too many. Mostly integration.\" — Kent C. Dodds\n\n1. **Use-case coverage > code coverage** — aim for 100% use-case coverage, not 100% line coverage. Think about what the user can DO, not what the code does internally.\n2. **Write fewer, longer tests** — one test that walks through a full user flow beats six isolated assertions. Combine related steps (render → interact → verify) into a single test.\n3. **Test behavior, not implementation** — assert on what the user sees and can do. Never assert on internal state, hook calls, or DOM structure.\n4. **Mock at boundaries only** — mock API calls and external services. Never mock your own components, hooks, or context internals.\n5. **Each test must justify its existence** — if removing a test wouldn't reduce your confidence that the app works, delete it.\n\n### The Testing Trophy (what to invest in)\n\n```\n    E2E        ← Few: critical user journeys only (Playwright\u002FCypress)\n  Integration  ← MOST tests: components with real providers, MSW for APIs\n  Unit         ← Some: complex pure logic, utilities, formatters\nStatic Analysis ← Always: TypeScript, ESLint\n```\n\n---\n\n## Setup from Scratch\n\n### 1. Install Dependencies\n\n```bash\nnpm install -D vitest @testing-library\u002Freact @testing-library\u002Fjest-dom @testing-library\u002Fuser-event jsdom\n```\n\nOptional but recommended:\n```bash\nnpm install -D msw                     # Network-level API mocking\nnpm install -D @vitest\u002Fcoverage-v8     # Code coverage\n```\n\n### 2. Vitest Config\n\nCreate `vitest.config.js` at the client root (or extend `vite.config.js`):\n\n```js\nimport { defineConfig, mergeConfig } from 'vitest\u002Fconfig';\nimport viteConfig from '.\u002Fvite.config.js';\n\nexport default mergeConfig(viteConfig, defineConfig({\n  test: {\n    globals: true,\n    environment: 'jsdom',\n    setupFiles: ['.\u002Fsrc\u002Ftest\u002Fsetup.js'],\n    css: true,\n    include: ['src\u002F**\u002F*.test.{js,jsx,ts,tsx}'],\n  },\n}));\n```\n\n### 3. Setup File\n\nCreate `src\u002Ftest\u002Fsetup.js`:\n\n```js\nimport '@testing-library\u002Fjest-dom\u002Fvitest';\n```\n\nThis registers matchers like `toBeInTheDocument()`, `toBeVisible()`, `toHaveTextContent()`.\n\n### 4. Package Scripts\n\nAdd to `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"vitest run\",\n    \"test:watch\": \"vitest\",\n    \"test:coverage\": \"vitest run --coverage\"\n  }\n}\n```\n\n---\n\n## Test Scenarios by Component Type\n\nBefore writing tests, identify the component type and pick scenarios from this matrix. Write **1-3 tests per component** — each test covers a full user flow, not a single assertion.\n\n### Form Component (e.g., BlogEditor, LoginForm, CommentForm)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Happy path: fill all fields → submit → success feedback** | Rendering, typing, validation passing, API call, success state |\n| 2 | **Validation: submit empty\u002Finvalid → error messages appear** | Required fields, validation rules, error rendering |\n| 3 | **API failure: fill valid → submit → server error shown** | Error handling, error UI, form stays filled |\n\n### List\u002FTable Component (e.g., BlogList, CommentList, Dashboard)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Happy path: data loads → items render → user interacts** | Loading state, data rendering, click\u002Fnavigation |\n| 2 | **Empty state: no data → empty message shown** | Zero-data handling |\n| 3 | **Error state: API fails → error message shown** | Network failure handling |\n\n### Detail\u002FView Component (e.g., BlogDetail, UserProfile)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Happy path: data loads → full content renders → user actions work** | Data fetching, rendering, interactions (edit\u002Fdelete\u002Fcomment) |\n| 2 | **Not found \u002F error: invalid ID → appropriate message** | 404 handling, error boundaries |\n\n### Auth-Gated Component (e.g., AdminPanel, ProtectedRoute)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Authenticated: user sees protected content and can interact** | Auth context, content rendering, user actions |\n| 2 | **Unauthenticated: redirects or shows login prompt** | Guard behavior, redirect |\n\n### Shared\u002FPresentational Component (e.g., BlogCard, Button, Modal)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Renders with props and handles user interaction** | Props → UI mapping, click\u002Fhover callbacks |\n| 2 | **Conditional rendering: different props → different output** | Only if the component has meaningful branching |\n\n---\n\n## Complete Spec Template\n\nThis is what a well-structured test file looks like. Each test walks through a real user flow.\n\n```jsx\n\u002F\u002F BlogList.test.jsx\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\nimport { render, screen, within } from '@testing-library\u002Freact';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport { MemoryRouter } from 'react-router';\nimport { http, HttpResponse } from 'msw';\nimport { setupServer } from 'msw\u002Fnode';\nimport BlogList from '.\u002FBlogList';\n\n\u002F\u002F --- MSW setup: mock the API at the network level ---\nconst blogs = [\n  { _id: '1', title: 'First Post', category: 'Technology', excerpt: 'About tech' },\n  { _id: '2', title: 'Second Post', category: 'Startup', excerpt: 'About startups' },\n];\n\nconst server = setupServer(\n  http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: true, blogs })),\n);\n\nbeforeAll(() => server.listen());\nafterEach(() => server.resetHandlers());\nafterAll(() => server.close());\n\n\u002F\u002F --- Render helper (keeps tests DRY) ---\nconst renderBlogList = () =>\n  render(\u003CMemoryRouter>\u003CBlogList \u002F>\u003C\u002FMemoryRouter>);\n\n\u002F\u002F --- Tests: 3 tests covering ALL real scenarios ---\ndescribe('BlogList', () => {\n  it('loads blogs and lets user navigate to a post', async () => {\n    const user = userEvent.setup();\n    renderBlogList();\n\n    \u002F\u002F Loading state appears first\n    expect(screen.getByText(\u002Floading\u002Fi)).toBeInTheDocument();\n\n    \u002F\u002F Blogs appear after fetch\n    expect(await screen.findByText('First Post')).toBeInTheDocument();\n    expect(screen.getByText('Second Post')).toBeInTheDocument();\n\n    \u002F\u002F User clicks a blog card\n    await user.click(screen.getByRole('link', { name: \u002Ffirst post\u002Fi }));\n    \u002F\u002F Assert navigation happened (or verify detail view renders)\n  });\n\n  it('shows empty state when no blogs exist', async () => {\n    server.use(\n      http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: true, blogs: [] })),\n    );\n    renderBlogList();\n\n    expect(await screen.findByText(\u002Fno blogs\u002Fi)).toBeInTheDocument();\n    expect(screen.queryByRole('article')).not.toBeInTheDocument();\n  });\n\n  it('shows error message when API fails', async () => {\n    server.use(\n      http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json(\n        { success: false, message: 'Server error' },\n        { status: 500 },\n      )),\n    );\n    renderBlogList();\n\n    expect(await screen.findByRole('alert')).toBeInTheDocument();\n    expect(screen.queryByRole('article')).not.toBeInTheDocument();\n  });\n});\n```\n\n### Form Spec Template\n\n```jsx\n\u002F\u002F LoginForm.test.jsx\ndescribe('LoginForm', () => {\n  it('logs in with valid credentials and shows dashboard', async () => {\n    const user = userEvent.setup();\n    render(\u003CMemoryRouter>\u003CLoginForm \u002F>\u003C\u002FMemoryRouter>);\n\n    \u002F\u002F Fill form\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'admin@test.com');\n    await user.type(screen.getByLabelText(\u002Fpassword\u002Fi), 'password123');\n    await user.click(screen.getByRole('button', { name: \u002Fsign in\u002Fi }));\n\n    \u002F\u002F Success: redirected or success message\n    expect(await screen.findByText(\u002Fwelcome\u002Fi)).toBeInTheDocument();\n  });\n\n  it('shows validation errors when submitted empty', async () => {\n    const user = userEvent.setup();\n    render(\u003CMemoryRouter>\u003CLoginForm \u002F>\u003C\u002FMemoryRouter>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fsign in\u002Fi }));\n\n    \u002F\u002F Both fields show errors\n    expect(await screen.findByText(\u002Femail is required\u002Fi)).toBeInTheDocument();\n    expect(screen.getByText(\u002Fpassword is required\u002Fi)).toBeInTheDocument();\n\n    \u002F\u002F Form is still visible (not redirected)\n    expect(screen.getByRole('button', { name: \u002Fsign in\u002Fi })).toBeInTheDocument();\n  });\n\n  it('shows server error when API returns 401', async () => {\n    server.use(\n      http.post('\u002Fapi\u002Fadmin\u002Flogin', () =>\n        HttpResponse.json({ success: false, message: 'Invalid credentials' }, { status: 401 }),\n      ),\n    );\n    const user = userEvent.setup();\n    render(\u003CMemoryRouter>\u003CLoginForm \u002F>\u003C\u002FMemoryRouter>);\n\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'admin@test.com');\n    await user.type(screen.getByLabelText(\u002Fpassword\u002Fi), 'wrongpassword');\n    await user.click(screen.getByRole('button', { name: \u002Fsign in\u002Fi }));\n\n    expect(await screen.findByText(\u002Finvalid credentials\u002Fi)).toBeInTheDocument();\n  });\n});\n```\n\n---\n\n## Import Rules\n\n```js\n\u002F\u002F Test runner — ALWAYS from vitest\nimport { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';\n\n\u002F\u002F RTL — render, screen, waitFor\nimport { render, screen, waitFor, within } from '@testing-library\u002Freact';\n\n\u002F\u002F User interaction — ALWAYS userEvent, NEVER fireEvent\nimport userEvent from '@testing-library\u002Fuser-event';\n\n\u002F\u002F Hook testing\nimport { renderHook, act } from '@testing-library\u002Freact';\n```\n\nNEVER import from `jest`. Use `vi.fn()`, `vi.spyOn()`, `vi.mock()`.\n\n---\n\n## Query Priority\n\nQueries are ordered by how closely they reflect user experience.\n\n### Tier 1 — Accessible (default choice)\n\n| Query | Use For |\n|-------|---------|\n| `getByRole` | Buttons, links, headings, inputs, checkboxes, comboboxes — **always try first** |\n| `getByLabelText` | Form fields with a `\u003Clabel>` |\n| `getByPlaceholderText` | Inputs without a label (prefer adding a label instead) |\n| `getByText` | Static text content — paragraphs, spans, error messages |\n| `getByDisplayValue` | Input with a current value |\n\n### Tier 2 — Semantic\n\n| Query | Use For |\n|-------|---------|\n| `getByAltText` | Images |\n| `getByTitle` | Elements with `title` attribute |\n\n### Tier 3 — Last resort\n\n| Query | Use For |\n|-------|---------|\n| `getByTestId` | Only when no accessible query works; requires `data-testid` |\n\n### Query Variants\n\n| Variant | Returns | Use When |\n|---------|---------|----------|\n| `getBy` | Element or throws | Element **must** be present |\n| `queryBy` | Element or `null` | Asserting element does **not** exist |\n| `findBy` | Promise\\\u003CElement\\> | Element appears **after** an async operation |\n| `*AllBy` | Array variants | Multiple matching elements |\n\n### Role Query Patterns\n\n```\ngetByRole('button', { name: \u002Fsubmit\u002Fi })\ngetByRole('heading', { level: 2 })\ngetByRole('textbox', { name: \u002Femail\u002Fi })\ngetByRole('link', { name: \u002Fread more\u002Fi })\ngetByRole('checkbox', { name: \u002Fagree\u002Fi })\ngetByRole('combobox')              \u002F\u002F \u003Cselect>\ngetByRole('status')                \u002F\u002F role=\"status\"\ngetByRole('alert')                 \u002F\u002F role=\"alert\"\ngetByRole('dialog')                \u002F\u002F \u003Cdialog> or role=\"dialog\"\ngetByRole('navigation')            \u002F\u002F \u003Cnav>\n```\n\n---\n\n## userEvent\n\nAlways call `userEvent.setup()` before rendering. All methods are async.\n\n| Method | Purpose |\n|--------|---------|\n| `user.click(el)` | Click |\n| `user.dblClick(el)` | Double-click |\n| `user.type(el, 'text')` | Type text (appends to existing value) |\n| `user.clear(el)` | Clear input value |\n| `user.selectOptions(el, 'value')` | Select dropdown option |\n| `user.tab()` | Tab to next focusable element |\n| `user.keyboard('{Enter}')` | Press a key |\n| `user.hover(el)` \u002F `user.unhover(el)` | Mouse hover |\n| `user.upload(el, file)` | File upload |\n\nPattern:\n```js\nconst user = userEvent.setup();\nrender(\u003CComponent \u002F>);\nawait user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n```\n\n---\n\n## Async Testing\n\n### `findBy` — element appears after async work\n\n```js\nrender(\u003CBlogList \u002F>);\nexpect(await screen.findByText('Blog Title')).toBeInTheDocument();\n```\n\n### `waitFor` — multiple assertions, complex conditions\n\n```js\nawait waitFor(() => {\n  expect(screen.getAllByRole('listitem')).toHaveLength(3);\n});\n```\n\n### `waitForElementToBeRemoved` — element disappears\n\n```js\nrender(\u003CBlogList \u002F>);\nawait waitForElementToBeRemoved(() => screen.queryByText('Loading...'));\n```\n\n### Rules\n\n- **Never** use `setTimeout` or fixed delays\n- **Never** use `act()` directly unless testing hooks outside components — RTL wraps it\n- `findBy` is preferred over `waitFor` + `getBy` for single-element waits\n- `waitFor` retries until the callback passes or times out (default 1000ms)\n\n---\n\n## Component Testing Patterns\n\n### Basic render + interaction\n\n```\n1. Arrange — render the component with props\u002Fproviders\n2. Act — simulate user interaction via userEvent\n3. Assert — check what the user would see\n```\n\nCombine all three into a single test when they form one user flow. Don't split Arrange\u002FAct\u002FAssert into separate `it()` blocks.\n\n### Render helper\n\nCreate a local `renderComponent` function when the component needs providers:\n\n```js\nconst renderComponent = (props = {}) =>\n  render(\n    \u003CMemoryRouter>\n      \u003CMyComponent defaultProp=\"value\" {...props} \u002F>\n    \u003C\u002FMemoryRouter>\n  );\n```\n\n### Asserting absence\n\n```js\n\u002F\u002F queryBy returns null — safe with .not\nexpect(screen.queryByText('Error')).not.toBeInTheDocument();\n```\n\n### Scoping queries with `within`\n\n```js\nconst card = screen.getByRole('article');\nexpect(within(card).getByText('Title')).toBeInTheDocument();\n```\n\n---\n\n## Hook Testing\n\nUse `renderHook` for hooks with **complex pure logic** only. If a hook just fetches data or manages simple state, test it through the component that uses it instead.\n\n```js\nimport { renderHook, act } from '@testing-library\u002Freact';\n\nconst { result } = renderHook(() => useCounter());\nact(() => result.current.increment());\nexpect(result.current.count).toBe(1);\n```\n\nFor hooks needing providers, pass a `wrapper`:\n\n```js\nrenderHook(() => useAuth(), {\n  wrapper: ({ children }) => \u003CAuthProvider>{children}\u003C\u002FAuthProvider>,\n});\n```\n\n---\n\n## React Router Wrapping\n\nComponents using `\u003CLink>`, `useNavigate`, `useParams`, or `useLocation` must be wrapped:\n\n```js\n\u002F\u002F Simple\nrender(\u003CMemoryRouter>\u003CMyComponent \u002F>\u003C\u002FMemoryRouter>);\n\n\u002F\u002F With route params\nrender(\n  \u003CMemoryRouter initialEntries={['\u002Fblogs\u002F123']}>\n    \u003CRoutes>\n      \u003CRoute path=\"\u002Fblogs\u002F:id\" element={\u003CBlogDetail \u002F>} \u002F>\n    \u003C\u002FRoutes>\n  \u003C\u002FMemoryRouter>\n);\n```\n\n---\n\n## Mocking Strategies\n\n### MSW (Mock Service Worker) — preferred for all data-fetching components\n\nIntercepts at the network layer. Tests don't couple to HTTP client internals. Most realistic approach.\n\n```js\nimport { setupServer } from 'msw\u002Fnode';\nimport { http, HttpResponse } from 'msw';\n\nconst server = setupServer(\n  \u002F\u002F Default happy-path handlers\n  http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: true, blogs: [...] })),\n  http.post('\u002Fapi\u002Fblogs', async ({ request }) => {\n    const body = await request.json();\n    return HttpResponse.json({ success: true, blog: { _id: '1', ...body } }, { status: 201 });\n  }),\n);\n\nbeforeAll(() => server.listen());\nafterEach(() => server.resetHandlers());\nafterAll(() => server.close());\n\n\u002F\u002F Override for specific tests:\nit('handles error', async () => {\n  server.use(\n    http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: false }, { status: 500 })),\n  );\n  \u002F\u002F ...\n});\n```\n\n### Module mock (`vi.mock`) — fallback when MSW is overkill\n\n```js\nvi.mock('..\u002F..\u002Fapi\u002FblogApi', () => ({\n  getBlogs: vi.fn(),\n}));\n```\n\n- Mock at the API\u002Fhook level, not at Axios\u002Ffetch level\n- Reset in `beforeEach`: `vi.clearAllMocks()`\n- Use `vi.mocked(fn)` for type-safe access to mock methods\n\n### Context mocking\n\nWrap component in a test provider with controlled values. Don't mock context internals — render with the real provider.\n\n### Timers\n\n```js\nvi.useFakeTimers();\n\u002F\u002F ... render and trigger timer-dependent code\nvi.advanceTimersByTime(3000);\nvi.useRealTimers(); \u002F\u002F restore in afterEach\n```\n\n---\n\n## What to Test \u002F What to Skip\n\n**Test (as user-visible flows):**\n- User journeys: form fill → submit → feedback\n- Data display: loading → loaded → interaction\n- State transitions: empty → filled, logged out → logged in\n- Error boundaries: API failure → error message\n- Conditional UI: different user roles see different things\n\n**Skip:**\n- Internal state (`useState` values)\n- Implementation details (hook calls, private functions)\n- CSS classes or inline styles\n- Third-party library internals\n- Render counts or performance\n- Snapshot tests (unless explicitly requested)\n- Constants or static data\n- Individual assertions that belong inside a longer flow test\n\n---\n\n## jest-dom Matchers Reference\n\n| Matcher | Checks |\n|---------|--------|\n| `toBeInTheDocument()` | Element is in the DOM |\n| `toBeVisible()` | Element is visible to the user |\n| `toBeEnabled()` \u002F `toBeDisabled()` | Enabled\u002Fdisabled state |\n| `toHaveTextContent(\u002Ftext\u002Fi)` | Contains text |\n| `toHaveValue('val')` | Input\u002Fselect current value |\n| `toHaveAttribute('href', '\u002Fpath')` | HTML attribute |\n| `toBeChecked()` | Checkbox\u002Fradio is checked |\n| `toHaveFocus()` | Element has focus |\n| `toBeRequired()` | Input is required |\n| `toHaveClass('cls')` | Has CSS class (use sparingly) |\n| `toHaveAccessibleDescription()` | `aria-describedby` text |\n| `toBeEmptyDOMElement()` | No visible content |\n\n---\n\n## Test File Conventions\n\n- Place tests next to source: `BlogCard.jsx` -> `BlogCard.test.jsx`\n- Use `.test.jsx` extension (not `.spec.jsx`)\n- One `describe` per component\u002Fhook\n- Test names describe user-visible behavior: `\"user fills form and sees success message\"`\n- Use `vi.fn()` for all mock functions\n- Call `userEvent.setup()` before `render()`\n- Always use `screen` — never destructure from `render()`\n- **1-3 tests per component** (user flows), 1-2 per hook, 2-3 per utility\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Fix |\n|-------------|-----|\n| Many tiny tests with one assertion each | Combine into fewer flow tests that walk through a user journey |\n| `fireEvent.click()` | Use `await user.click()` from `userEvent.setup()` |\n| Destructuring from `render()` | Use `screen.getByRole(...)` |\n| `getByTestId` as first choice | Try `getByRole`, `getByLabelText`, `getByText` first |\n| Testing `useState` \u002F hook internals | Test the rendered output instead |\n| `setTimeout` \u002F fixed delays | Use `findBy` or `waitFor` |\n| Snapshot tests replacing behavior tests | Write explicit assertions |\n| `container.querySelector()` | Use RTL queries |\n| Shared mutable state between tests | Reset in `beforeEach` |\n| Importing from `jest` | Import from `vitest` (`vi.fn()`, `vi.mock()`) |\n| Mocking what you're testing | Mock dependencies, not the subject |\n| `act()` wrapping RTL calls | RTL handles `act()` internally |\n| Mocking Axios\u002Ffetch directly | Use MSW for network-level mocking |\n| Testing every prop combination | Test the meaningful user-facing differences only |\n","# React Testing Library\n\nGeneral-purpose guide for testing React components and hooks with React Testing Library (RTL) and Vitest. Project-agnostic — works with any Vite + React setup.\n\n## Philosophy: Fewer Tests, Real Scenarios\n\n> \"Write tests. Not too many. Mostly integration.\" — Kent C. Dodds\n\n1. **Use-case coverage > code coverage** — aim for 100% use-case coverage, not 100% line coverage. Think about what the user can DO, not what the code does internally.\n2. **Write fewer, longer tests** — one test that walks through a full user flow beats six isolated assertions. Combine related steps (render → interact → verify) into a single test.\n3. **Test behavior, not implementation** — assert on what the user sees and can do. Never assert on internal state, hook calls, or DOM structure.\n4. **Mock at boundaries only** — mock API calls and external services. Never mock your own components, hooks, or context internals.\n5. **Each test must justify its existence** — if removing a test wouldn't reduce your confidence that the app works, delete it.\n\n### The Testing Trophy (what to invest in)\n\n```\n    E2E        ← Few: critical user journeys only (Playwright\u002FCypress)\n  Integration  ← MOST tests: components with real providers, MSW for APIs\n  Unit         ← Some: complex pure logic, utilities, formatters\nStatic Analysis ← Always: TypeScript, ESLint\n```\n\n---\n\n## Setup from Scratch\n\n### 1. Install Dependencies\n\n```bash\nnpm install -D vitest @testing-library\u002Freact @testing-library\u002Fjest-dom @testing-library\u002Fuser-event jsdom\n```\n\nOptional but recommended:\n```bash\nnpm install -D msw                     # Network-level API mocking\nnpm install -D @vitest\u002Fcoverage-v8     # Code coverage\n```\n\n### 2. Vitest Config\n\nCreate `vitest.config.js` at the client root (or extend `vite.config.js`):\n\n```js\nimport { defineConfig, mergeConfig } from 'vitest\u002Fconfig';\nimport viteConfig from '.\u002Fvite.config.js';\n\nexport default mergeConfig(viteConfig, defineConfig({\n  test: {\n    globals: true,\n    environment: 'jsdom',\n    setupFiles: ['.\u002Fsrc\u002Ftest\u002Fsetup.js'],\n    css: true,\n    include: ['src\u002F**\u002F*.test.{js,jsx,ts,tsx}'],\n  },\n}));\n```\n\n### 3. Setup File\n\nCreate `src\u002Ftest\u002Fsetup.js`:\n\n```js\nimport '@testing-library\u002Fjest-dom\u002Fvitest';\n```\n\nThis registers matchers like `toBeInTheDocument()`, `toBeVisible()`, `toHaveTextContent()`.\n\n### 4. Package Scripts\n\nAdd to `package.json`:\n\n```json\n{\n  \"scripts\": {\n    \"test\": \"vitest run\",\n    \"test:watch\": \"vitest\",\n    \"test:coverage\": \"vitest run --coverage\"\n  }\n}\n```\n\n---\n\n## Test Scenarios by Component Type\n\nBefore writing tests, identify the component type and pick scenarios from this matrix. Write **1-3 tests per component** — each test covers a full user flow, not a single assertion.\n\n### Form Component (e.g., BlogEditor, LoginForm, CommentForm)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Happy path: fill all fields → submit → success feedback** | Rendering, typing, validation passing, API call, success state |\n| 2 | **Validation: submit empty\u002Finvalid → error messages appear** | Required fields, validation rules, error rendering |\n| 3 | **API failure: fill valid → submit → server error shown** | Error handling, error UI, form stays filled |\n\n### List\u002FTable Component (e.g., BlogList, CommentList, Dashboard)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Happy path: data loads → items render → user interacts** | Loading state, data rendering, click\u002Fnavigation |\n| 2 | **Empty state: no data → empty message shown** | Zero-data handling |\n| 3 | **Error state: API fails → error message shown** | Network failure handling |\n\n### Detail\u002FView Component (e.g., BlogDetail, UserProfile)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Happy path: data loads → full content renders → user actions work** | Data fetching, rendering, interactions (edit\u002Fdelete\u002Fcomment) |\n| 2 | **Not found \u002F error: invalid ID → appropriate message** | 404 handling, error boundaries |\n\n### Auth-Gated Component (e.g., AdminPanel, ProtectedRoute)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Authenticated: user sees protected content and can interact** | Auth context, content rendering, user actions |\n| 2 | **Unauthenticated: redirects or shows login prompt** | Guard behavior, redirect |\n\n### Shared\u002FPresentational Component (e.g., BlogCard, Button, Modal)\n\n| # | Test | What it covers |\n|---|------|----------------|\n| 1 | **Renders with props and handles user interaction** | Props → UI mapping, click\u002Fhover callbacks |\n| 2 | **Conditional rendering: different props → different output** | Only if the component has meaningful branching |\n\n---\n\n## Complete Spec Template\n\nThis is what a well-structured test file looks like. Each test walks through a real user flow.\n\n```jsx\n\u002F\u002F BlogList.test.jsx\nimport { describe, it, expect, vi, beforeEach } from 'vitest';\nimport { render, screen, within } from '@testing-library\u002Freact';\nimport userEvent from '@testing-library\u002Fuser-event';\nimport { MemoryRouter } from 'react-router';\nimport { http, HttpResponse } from 'msw';\nimport { setupServer } from 'msw\u002Fnode';\nimport BlogList from '.\u002FBlogList';\n\n\u002F\u002F --- MSW setup: mock the API at the network level ---\nconst blogs = [\n  { _id: '1', title: 'First Post', category: 'Technology', excerpt: 'About tech' },\n  { _id: '2', title: 'Second Post', category: 'Startup', excerpt: 'About startups' },\n];\n\nconst server = setupServer(\n  http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: true, blogs })),\n);\n\nbeforeAll(() => server.listen());\nafterEach(() => server.resetHandlers());\nafterAll(() => server.close());\n\n\u002F\u002F --- Render helper (keeps tests DRY) ---\nconst renderBlogList = () =>\n  render(\u003CMemoryRouter>\u003CBlogList \u002F>\u003C\u002FMemoryRouter>);\n\n\u002F\u002F --- Tests: 3 tests covering ALL real scenarios ---\ndescribe('BlogList', () => {\n  it('loads blogs and lets user navigate to a post', async () => {\n    const user = userEvent.setup();\n    renderBlogList();\n\n    \u002F\u002F Loading state appears first\n    expect(screen.getByText(\u002Floading\u002Fi)).toBeInTheDocument();\n\n    \u002F\u002F Blogs appear after fetch\n    expect(await screen.findByText('First Post')).toBeInTheDocument();\n    expect(screen.getByText('Second Post')).toBeInTheDocument();\n\n    \u002F\u002F User clicks a blog card\n    await user.click(screen.getByRole('link', { name: \u002Ffirst post\u002Fi }));\n    \u002F\u002F Assert navigation happened (or verify detail view renders)\n  });\n\n  it('shows empty state when no blogs exist', async () => {\n    server.use(\n      http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: true, blogs: [] })),\n    );\n    renderBlogList();\n\n    expect(await screen.findByText(\u002Fno blogs\u002Fi)).toBeInTheDocument();\n    expect(screen.queryByRole('article')).not.toBeInTheDocument();\n  });\n\n  it('shows error message when API fails', async () => {\n    server.use(\n      http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json(\n        { success: false, message: 'Server error' },\n        { status: 500 },\n      )),\n    );\n    renderBlogList();\n\n    expect(await screen.findByRole('alert')).toBeInTheDocument();\n    expect(screen.queryByRole('article')).not.toBeInTheDocument();\n  });\n});\n```\n\n### Form Spec Template\n\n```jsx\n\u002F\u002F LoginForm.test.jsx\ndescribe('LoginForm', () => {\n  it('logs in with valid credentials and shows dashboard', async () => {\n    const user = userEvent.setup();\n    render(\u003CMemoryRouter>\u003CLoginForm \u002F>\u003C\u002FMemoryRouter>);\n\n    \u002F\u002F Fill form\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'admin@test.com');\n    await user.type(screen.getByLabelText(\u002Fpassword\u002Fi), 'password123');\n    await user.click(screen.getByRole('button', { name: \u002Fsign in\u002Fi }));\n\n    \u002F\u002F Success: redirected or success message\n    expect(await screen.findByText(\u002Fwelcome\u002Fi)).toBeInTheDocument();\n  });\n\n  it('shows validation errors when submitted empty', async () => {\n    const user = userEvent.setup();\n    render(\u003CMemoryRouter>\u003CLoginForm \u002F>\u003C\u002FMemoryRouter>);\n\n    await user.click(screen.getByRole('button', { name: \u002Fsign in\u002Fi }));\n\n    \u002F\u002F Both fields show errors\n    expect(await screen.findByText(\u002Femail is required\u002Fi)).toBeInTheDocument();\n    expect(screen.getByText(\u002Fpassword is required\u002Fi)).toBeInTheDocument();\n\n    \u002F\u002F Form is still visible (not redirected)\n    expect(screen.getByRole('button', { name: \u002Fsign in\u002Fi })).toBeInTheDocument();\n  });\n\n  it('shows server error when API returns 401', async () => {\n    server.use(\n      http.post('\u002Fapi\u002Fadmin\u002Flogin', () =>\n        HttpResponse.json({ success: false, message: 'Invalid credentials' }, { status: 401 }),\n      ),\n    );\n    const user = userEvent.setup();\n    render(\u003CMemoryRouter>\u003CLoginForm \u002F>\u003C\u002FMemoryRouter>);\n\n    await user.type(screen.getByLabelText(\u002Femail\u002Fi), 'admin@test.com');\n    await user.type(screen.getByLabelText(\u002Fpassword\u002Fi), 'wrongpassword');\n    await user.click(screen.getByRole('button', { name: \u002Fsign in\u002Fi }));\n\n    expect(await screen.findByText(\u002Finvalid credentials\u002Fi)).toBeInTheDocument();\n  });\n});\n```\n\n---\n\n## Import Rules\n\n```js\n\u002F\u002F Test runner — ALWAYS from vitest\nimport { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';\n\n\u002F\u002F RTL — render, screen, waitFor\nimport { render, screen, waitFor, within } from '@testing-library\u002Freact';\n\n\u002F\u002F User interaction — ALWAYS userEvent, NEVER fireEvent\nimport userEvent from '@testing-library\u002Fuser-event';\n\n\u002F\u002F Hook testing\nimport { renderHook, act } from '@testing-library\u002Freact';\n```\n\nNEVER import from `jest`. Use `vi.fn()`, `vi.spyOn()`, `vi.mock()`.\n\n---\n\n## Query Priority\n\nQueries are ordered by how closely they reflect user experience.\n\n### Tier 1 — Accessible (default choice)\n\n| Query | Use For |\n|-------|---------|\n| `getByRole` | Buttons, links, headings, inputs, checkboxes, comboboxes — **always try first** |\n| `getByLabelText` | Form fields with a `\u003Clabel>` |\n| `getByPlaceholderText` | Inputs without a label (prefer adding a label instead) |\n| `getByText` | Static text content — paragraphs, spans, error messages |\n| `getByDisplayValue` | Input with a current value |\n\n### Tier 2 — Semantic\n\n| Query | Use For |\n|-------|---------|\n| `getByAltText` | Images |\n| `getByTitle` | Elements with `title` attribute |\n\n### Tier 3 — Last resort\n\n| Query | Use For |\n|-------|---------|\n| `getByTestId` | Only when no accessible query works; requires `data-testid` |\n\n### Query Variants\n\n| Variant | Returns | Use When |\n|---------|---------|----------|\n| `getBy` | Element or throws | Element **must** be present |\n| `queryBy` | Element or `null` | Asserting element does **not** exist |\n| `findBy` | Promise\\\u003CElement\\> | Element appears **after** an async operation |\n| `*AllBy` | Array variants | Multiple matching elements |\n\n### Role Query Patterns\n\n```\ngetByRole('button', { name: \u002Fsubmit\u002Fi })\ngetByRole('heading', { level: 2 })\ngetByRole('textbox', { name: \u002Femail\u002Fi })\ngetByRole('link', { name: \u002Fread more\u002Fi })\ngetByRole('checkbox', { name: \u002Fagree\u002Fi })\ngetByRole('combobox')              \u002F\u002F \u003Cselect>\ngetByRole('status')                \u002F\u002F role=\"status\"\ngetByRole('alert')                 \u002F\u002F role=\"alert\"\ngetByRole('dialog')                \u002F\u002F \u003Cdialog> or role=\"dialog\"\ngetByRole('navigation')            \u002F\u002F \u003Cnav>\n```\n\n---\n\n## userEvent\n\nAlways call `userEvent.setup()` before rendering. All methods are async.\n\n| Method | Purpose |\n|--------|---------|\n| `user.click(el)` | Click |\n| `user.dblClick(el)` | Double-click |\n| `user.type(el, 'text')` | Type text (appends to existing value) |\n| `user.clear(el)` | Clear input value |\n| `user.selectOptions(el, 'value')` | Select dropdown option |\n| `user.tab()` | Tab to next focusable element |\n| `user.keyboard('{Enter}')` | Press a key |\n| `user.hover(el)` \u002F `user.unhover(el)` | Mouse hover |\n| `user.upload(el, file)` | File upload |\n\nPattern:\n```js\nconst user = userEvent.setup();\nrender(\u003CComponent \u002F>);\nawait user.click(screen.getByRole('button', { name: \u002Fsave\u002Fi }));\n```\n\n---\n\n## Async Testing\n\n### `findBy` — element appears after async work\n\n```js\nrender(\u003CBlogList \u002F>);\nexpect(await screen.findByText('Blog Title')).toBeInTheDocument();\n```\n\n### `waitFor` — multiple assertions, complex conditions\n\n```js\nawait waitFor(() => {\n  expect(screen.getAllByRole('listitem')).toHaveLength(3);\n});\n```\n\n### `waitForElementToBeRemoved` — element disappears\n\n```js\nrender(\u003CBlogList \u002F>);\nawait waitForElementToBeRemoved(() => screen.queryByText('Loading...'));\n```\n\n### Rules\n\n- **Never** use `setTimeout` or fixed delays\n- **Never** use `act()` directly unless testing hooks outside components — RTL wraps it\n- `findBy` is preferred over `waitFor` + `getBy` for single-element waits\n- `waitFor` retries until the callback passes or times out (default 1000ms)\n\n---\n\n## Component Testing Patterns\n\n### Basic render + interaction\n\n```\n1. Arrange — render the component with props\u002Fproviders\n2. Act — simulate user interaction via userEvent\n3. Assert — check what the user would see\n```\n\nCombine all three into a single test when they form one user flow. Don't split Arrange\u002FAct\u002FAssert into separate `it()` blocks.\n\n### Render helper\n\nCreate a local `renderComponent` function when the component needs providers:\n\n```js\nconst renderComponent = (props = {}) =>\n  render(\n    \u003CMemoryRouter>\n      \u003CMyComponent defaultProp=\"value\" {...props} \u002F>\n    \u003C\u002FMemoryRouter>\n  );\n```\n\n### Asserting absence\n\n```js\n\u002F\u002F queryBy returns null — safe with .not\nexpect(screen.queryByText('Error')).not.toBeInTheDocument();\n```\n\n### Scoping queries with `within`\n\n```js\nconst card = screen.getByRole('article');\nexpect(within(card).getByText('Title')).toBeInTheDocument();\n```\n\n---\n\n## Hook Testing\n\nUse `renderHook` for hooks with **complex pure logic** only. If a hook just fetches data or manages simple state, test it through the component that uses it instead.\n\n```js\nimport { renderHook, act } from '@testing-library\u002Freact';\n\nconst { result } = renderHook(() => useCounter());\nact(() => result.current.increment());\nexpect(result.current.count).toBe(1);\n```\n\nFor hooks needing providers, pass a `wrapper`:\n\n```js\nrenderHook(() => useAuth(), {\n  wrapper: ({ children }) => \u003CAuthProvider>{children}\u003C\u002FAuthProvider>,\n});\n```\n\n---\n\n## React Router Wrapping\n\nComponents using `\u003CLink>`, `useNavigate`, `useParams`, or `useLocation` must be wrapped:\n\n```js\n\u002F\u002F Simple\nrender(\u003CMemoryRouter>\u003CMyComponent \u002F>\u003C\u002FMemoryRouter>);\n\n\u002F\u002F With route params\nrender(\n  \u003CMemoryRouter initialEntries={['\u002Fblogs\u002F123']}>\n    \u003CRoutes>\n      \u003CRoute path=\"\u002Fblogs\u002F:id\" element={\u003CBlogDetail \u002F>} \u002F>\n    \u003C\u002FRoutes>\n  \u003C\u002FMemoryRouter>\n);\n```\n\n---\n\n## Mocking Strategies\n\n### MSW (Mock Service Worker) — preferred for all data-fetching components\n\nIntercepts at the network layer. Tests don't couple to HTTP client internals. Most realistic approach.\n\n```js\nimport { setupServer } from 'msw\u002Fnode';\nimport { http, HttpResponse } from 'msw';\n\nconst server = setupServer(\n  \u002F\u002F Default happy-path handlers\n  http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: true, blogs: [...] })),\n  http.post('\u002Fapi\u002Fblogs', async ({ request }) => {\n    const body = await request.json();\n    return HttpResponse.json({ success: true, blog: { _id: '1', ...body } }, { status: 201 });\n  }),\n);\n\nbeforeAll(() => server.listen());\nafterEach(() => server.resetHandlers());\nafterAll(() => server.close());\n\n\u002F\u002F Override for specific tests:\nit('handles error', async () => {\n  server.use(\n    http.get('\u002Fapi\u002Fblogs', () => HttpResponse.json({ success: false }, { status: 500 })),\n  );\n  \u002F\u002F ...\n});\n```\n\n### Module mock (`vi.mock`) — fallback when MSW is overkill\n\n```js\nvi.mock('..\u002F..\u002Fapi\u002FblogApi', () => ({\n  getBlogs: vi.fn(),\n}));\n```\n\n- Mock at the API\u002Fhook level, not at Axios\u002Ffetch level\n- Reset in `beforeEach`: `vi.clearAllMocks()`\n- Use `vi.mocked(fn)` for type-safe access to mock methods\n\n### Context mocking\n\nWrap component in a test provider with controlled values. Don't mock context internals — render with the real provider.\n\n### Timers\n\n```js\nvi.useFakeTimers();\n\u002F\u002F ... render and trigger timer-dependent code\nvi.advanceTimersByTime(3000);\nvi.useRealTimers(); \u002F\u002F restore in afterEach\n```\n\n---\n\n## What to Test \u002F What to Skip\n\n**Test (as user-visible flows):**\n- User journeys: form fill → submit → feedback\n- Data display: loading → loaded → interaction\n- State transitions: empty → filled, logged out → logged in\n- Error boundaries: API failure → error message\n- Conditional UI: different user roles see different things\n\n**Skip:**\n- Internal state (`useState` values)\n- Implementation details (hook calls, private functions)\n- CSS classes or inline styles\n- Third-party library internals\n- Render counts or performance\n- Snapshot tests (unless explicitly requested)\n- Constants or static data\n- Individual assertions that belong inside a longer flow test\n\n---\n\n## jest-dom Matchers Reference\n\n| Matcher | Checks |\n|---------|--------|\n| `toBeInTheDocument()` | Element is in the DOM |\n| `toBeVisible()` | Element is visible to the user |\n| `toBeEnabled()` \u002F `toBeDisabled()` | Enabled\u002Fdisabled state |\n| `toHaveTextContent(\u002Ftext\u002Fi)` | Contains text |\n| `toHaveValue('val')` | Input\u002Fselect current value |\n| `toHaveAttribute('href', '\u002Fpath')` | HTML attribute |\n| `toBeChecked()` | Checkbox\u002Fradio is checked |\n| `toHaveFocus()` | Element has focus |\n| `toBeRequired()` | Input is required |\n| `toHaveClass('cls')` | Has CSS class (use sparingly) |\n| `toHaveAccessibleDescription()` | `aria-describedby` text |\n| `toBeEmptyDOMElement()` | No visible content |\n\n---\n\n## Test File Conventions\n\n- Place tests next to source: `BlogCard.jsx` -> `BlogCard.test.jsx`\n- Use `.test.jsx` extension (not `.spec.jsx`)\n- One `describe` per component\u002Fhook\n- Test names describe user-visible behavior: `\"user fills form and sees success message\"`\n- Use `vi.fn()` for all mock functions\n- Call `userEvent.setup()` before `render()`\n- Always use `screen` — never destructure from `render()`\n- **1-3 tests per component** (user flows), 1-2 per hook, 2-3 per utility\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Fix |\n|-------------|-----|\n| Many tiny tests with one assertion each | Combine into fewer flow tests that walk through a user journey |\n| `fireEvent.click()` | Use `await user.click()` from `userEvent.setup()` |\n| Destructuring from `render()` | Use `screen.getByRole(...)` |\n| `getByTestId` as first choice | Try `getByRole`, `getByLabelText`, `getByText` first |\n| Testing `useState` \u002F hook internals | Test the rendered output instead |\n| `setTimeout` \u002F fixed delays | Use `findBy` or `waitFor` |\n| Snapshot tests replacing behavior tests | Write explicit assertions |\n| `container.querySelector()` | Use RTL queries |\n| Shared mutable state between tests | Reset in `beforeEach` |\n| Importing from `jest` | Import from `vitest` (`vi.fn()`, `vi.mock()`) |\n| Mocking what you're testing | Mock dependencies, not the subject |\n| `act()` wrapping RTL calls | RTL handles `act()` internally |\n| Mocking Axios\u002Ffetch directly | Use MSW for network-level mocking |\n| Testing every prop combination | Test the meaningful user-facing differences only |\n",{"name":5,"description":7},"main","7a21601142d172aa0f972ec0913737c45c37d410","plugins\u002Fengineering-paved-path\u002Fskills\u002Freact-testing-library","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace","https:\u002F\u002Fgithub.com\u002FSyukPublic","2026-07-18 02:16:07",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add SyukPublic\u002Fdev-digest-ai-marketplace --skill react-testing-library",{"tool":36,"command":37},"bunx","bunx skills add SyukPublic\u002Fdev-digest-ai-marketplace --skill react-testing-library",{"tool":39,"command":40},"pnpm","pnpm dlx skills add SyukPublic\u002Fdev-digest-ai-marketplace --skill react-testing-library","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Freact-testing-library\u002FSKILL.md",true,[44],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"README.md","REFERENCE","参考文档",3786,"https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Freact-testing-library\u002FREADME.md",[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M799YJEVQSTVM499YQDKZXYW","sample-skill","Reviews recent changes and reports actionable findings for testing purposes","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fsite\u002Ftest-fixtures\u002Frepo-good\u002Fplugins\u002Ffixture-plugin\u002Fskills\u002Fsample-skill\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M799YDGTK8Q87AKM4XB48ZDN","workflow-retro","Post-run retrospective of the multi-agent SDD pipeline (spec-creator → implementation-planner → implementer \u002F test-writer → architecture-reviewer \u002F plan-verifier, plus nested researcher\u002FExplore agents). Manually invoked after a run to produce TRUE token\u002Ftool\u002Fduration\u002Fparallelism metrics — deep mode parses session + subagent journals from disk because parent-visible usage EXCLUDES subagent tokens — plus insights with concrete optimization actions, a trend row appended to the retro ledger (default docs\u002Fretros\u002Fledger.md), and an audit verdict. Trigger terms: workflow retro, retro, ретро, retrospective, pipeline metrics, agent token usage, cache hit, parallelism, як пройшов конвеєр.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Fworkflow-retro\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M799Y5Q6AFZJ3DDEK7AB2E9T","run-plan","Executes an APPROVED Development Plan through the SDD implementation pipeline: implementer wave(s) → test-writer gap pass → green barrier (tests + typecheck) → architecture-reviewer ∥ plan-verifier → bounded fix loop (max 2 iterations) → final report. HARD GATE: an existing plan file is a required input — no plan, no run. Unlike implementer (ships ONE slice) — this skill orchestrates the WHOLE plan across agents; unlike workflow-retro (measures a PAST run) — this skill performs the run; unlike a pre-publish diff review — this skill implements and verifies, it never publishes. Trigger terms: run-plan, run the plan, execute the plan, run the implementation pipeline, запусти план, запусти конвеєр, виконай план, прожени план через конвеєр.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Frun-plan\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M799Y1CJNCX6TSSPHNT7Z99M","mermaid-diagram","Create Mermaid diagrams in markdown. Use when the user wants to visualize workflows, architectures, API flows, data models, state machines, or system designs. Covers flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, and more.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Fmermaid-diagram\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M799XV3K3B4BAHNNTHP5EHQH","engineering-insights","Capture durable engineering insights into the host project's insights file (default docs\u002Fengineering-insights.md), and prune that log. Use during any session when a non-obvious discovery is confirmed — a gotcha, a fix's root cause, a why-it's-like-this decision, an antipattern, or a tool\u002Flibrary quirk — and at session wrap-up to sweep for learnings. Also use to review, dedup, or declutter the insights file. Trigger terms: insight, learning, gotcha, engineering insights, lesson learned, wrap-up, retrospective, prune insights.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdd-engineering\u002Fskills\u002Fengineering-insights\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M799XQ8GBDYEPFHCEYZD9VJ1","typescript-expert","TypeScript and JavaScript expert with deep knowledge of type-level programming, performance optimization, monorepo management, migration strategies, and modern tooling.","https:\u002F\u002Fgithub.com\u002FSyukPublic\u002Fdev-digest-ai-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fengineering-paved-path\u002Fskills\u002Ftypescript-expert\u002FSKILL.md",[],[]]