一键导入
frontend-implementation
Implementation conventions for frontend React components, hooks, and pages. Loaded by tdd-implementer when the layer is frontend.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implementation conventions for frontend React components, hooks, and pages. Loaded by tdd-implementer when the layer is frontend.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Implementation conventions for backend API routes and lib utilities. Loaded by tdd-implementer when the layer is backend.
Write Cypress end-to-end tests for business processes and cross-cutting infrastructure. Use for testing complete business workflows, authentication flows, and UI state verification.
Write Jest backend tests for Next.js API routes following established patterns. Use for testing API handlers, lib utilities, and backend logic.
Write Jest frontend tests for React components and hooks using React Testing Library. Use for testing pages, components, and custom hooks.
Outside-In TDD starting from E2E tests, drilling down to unit tests. Auto-triggers for new features. Trigger phrases include "implement", "add feature", "build", "create functionality". Does NOT trigger for bug fixes, documentation, or configuration changes.
Instructions for adjusting outside-in-tdd skills and agents
基于 SOC 职业分类
| name | frontend-implementation |
| description | Implementation conventions for frontend React components, hooks, and pages. Loaded by tdd-implementer when the layer is frontend. |
When creating or modifying React components, hooks, and pages, follow these project-specific patterns.
Use standard React patterns for data fetching. For simple cases, useState + useEffect + fetch is fine. As the app grows, extract a custom hook (e.g., useFetchApi) to centralize loading/error state handling.
const [data, setData] = useState<ResponseType | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetch('/api/endpoint')
.then(res => res.json())
.then(setData)
.finally(() => setLoading(false));
}, []);
Add semantic attributes to elements so that E2E tests can select them without CSS selectors. Use this priority:
aria-label — for interactive elements and content sections (buttons, inputs, tables, panels)button, nav, table, select)data-testid — only when no semantic alternative exists (e.g., a decorative icon that conveys state)Specifically:
aria-label to container elements that group related content (e.g., <div aria-label="Todo list">, <section aria-label="Completed items">)aria-label to interactive elements where text content alone is ambiguous (e.g., multiple "Delete" buttons — use aria-label="Delete Buy groceries" vs aria-label="Delete Walk the dog")aria-label to <select>, <input>, and <table> elements<button>, <table>, <nav>) over generic <div> where appropriateThis makes the implementation accessible AND testable. The E2E tests rely on these attributes instead of CSS selectors.