一键导入
frontend-testing
WHEN testing any front-end UI with DOM Testing Library; behavior-first queries, userEvent flows, async patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
WHEN testing any front-end UI with DOM Testing Library; behavior-first queries, userEvent flows, async patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
WHEN scraping iOS/macOS App Store data (apps, reviews, ratings, search); NOT for installing or testing apps; retrieves structured JSON data using iTunes/App Store APIs with curl and jq formatting
Comprehensive guide for implementing on-device AI models on iOS using Foundation Models and MLX Swift frameworks. Use WHEN building iOS apps with (1) Local LLM inference, (2) Vision Language Models (VLMs), (3) Text embeddings, (4) Image generation, (5) Tool/function calling, (6) Multi-turn conversations, (7) Custom model integration, or (8) Structured generation.
WHEN building ChatGPT apps using the OpenAI Apps SDK and MCP; create conversational, composable experiences with proper UX, UI, state management, and server patterns.
WHEN building SwiftUI views, managing state, setting up shared services, or making architectural decisions; NOT for UIKit or legacy patterns; provides pure SwiftUI data flow without ViewModels using @State, @Binding, @Observable, and @Environment.
WHEN building design systems or component libraries with Tailwind CSS; covers design tokens, CVA patterns and dark mode.
WHEN building React components/pages/apps; enforces scalable architecture, state management, API layer, performance patterns.
| name | frontend-testing |
| description | WHEN testing any front-end UI with DOM Testing Library; behavior-first queries, userEvent flows, async patterns. |
Framework-agnostic DOM Testing Library patterns for behavior-driven testing. For React-specific patterns (renderHook, context, components), load the react-testing skill. For TDD workflow (RED-GREEN-REFACTOR), load the tdd skill.
Test behavior users see, not implementation details.
Testing Library exists to solve a fundamental problem: tests that break when you refactor (false negatives) and tests that pass when bugs exist (false positives).
Your UI components have two users:
Kent C. Dodds principle: "The more your tests resemble the way your software is used, the more confidence they can give you."
False negatives (tests break on refactor):
// ❌ WRONG - Testing implementation (will break on refactor)
it("should update internal state", () => {
const component = new CounterComponent();
component.setState({ count: 5 }); // Coupled to state implementation
expect(component.state.count).toBe(5);
});
Correct approach (behavior-driven):
// ✅ CORRECT - Testing user-visible behavior
it("should submit form when user clicks submit", async () => {
const handleSubmit = vi.fn();
const user = userEvent.setup();
render(`
<form id="login-form">
<label>Email: <input name="email" /></label>
<button type="submit">Submit</button>
</form>
`);
await user.type(screen.getByLabelText(/email/i), "test@example.com");
await user.click(screen.getByRole("button", { name: /submit/i }));
expect(handleSubmit).toHaveBeenCalled();
});
| Topic | Guide |
|---|---|
| Query selection priority and details | queries.md |
| userEvent patterns and interactions | user-events.md |
| Async testing (findBy, waitFor) | async-testing.md |
| MSW for API mocking | msw.md |
| Common mistakes and fixes | anti-patterns.md |
| Accessibility-first testing principles | accessibility-first-testing.md |
Use queries.md when you need:
Use user-events.md when you need:
Use async-testing.md when you need:
Use msw.md when you need:
Use anti-patterns.md when you need:
Use accessibility-first-testing.md when you need:
Before merging UI tests, verify:
getByRole as first choice for queriesuserEvent with setup() (not fireEvent)screen object for all queries (not destructuring from render)findBy* for async elements (loading, API responses)jest-dom matchers (toBeInTheDocument, toBeDisabled, etc.)eslint-plugin-testing-library, eslint-plugin-jest-dom)cleanup() calls (automatic)tdd skill)testing skill)react-testing skill