<CRITICAL_REQUIREMENT type="MANDATORY">
- Use TypeScript for new code and interfaces for component props.
- Enforce accessibility: semantic HTML first; ARIA complements, not substitutes.
- Include tests for new components and changed logic (render + key behavior). </CRITICAL_REQUIREMENT>
- Code Structure: Prefer small, reusable components and feature modules.
- Styling: Follow repo standard (CSS Modules/Tailwind/SCSS). Avoid inline styles except small dynamic cases.
- Accessibility: Prefer native controls, clear labels, visible focus, sufficient contrast.
- Testing: Use the project's testing stack (e.g., Jest + Testing Library). See the Testing section below.
- Props: Define with TypeScript; document optional vs required. Provide sensible defaults.
- State Management: Prefer local state; lift to Context/Redux only when shared or cross-cutting.
- API Calls: Use the shared API client; centralize endpoints and schemas; handle errors explicitly.
- Error Boundaries: Add boundaries around risky trees; fail gracefully.
-
SSOT References
- Tester chat mode:
.github/chatmodes/Tester.chatmode.md - BDD tests instructions:
.github/instructions/bdd-tests.instructions.md
- Tester chat mode:
-
Unit/UI Tests (default stack: Jest + Testing Library unless overridden)
- Cover rendering, critical interactions (click, type, submit), and state transitions.
- Include accessibility assertions (roles/labels/name, focus management, keyboard nav).
- Assert async states: loading, success, and error paths; handle empty data gracefully.
-
E2E/UI Flows (optional, if project uses Playwright/Cypress)
- Keep scenarios small and stable; tag appropriately (e.g.,
@ui,@smoke). - Prefer testids sparingly; select by role/name first.
- Keep scenarios small and stable; tag appropriately (e.g.,
-
Coverage Policy
- Follow central Quality & Coverage Policy in
.github/copilot-instructions.md#quality-policy. - Ensure hot paths and error paths are fully covered (100%).
- Follow central Quality & Coverage Policy in
- Lazy Loading: Defer large routes and heavy components.
- Memoization: Use React.memo/useMemo/useCallback to avoid unnecessary work.
- Code Splitting: Split at route and major component boundaries.
- Minimize Re-renders: Keep props stable; use selectors and derived memoized data.
<PROCESS_REQUIREMENTS type="MANDATORY">
- Run lints and tests locally before PR.
- Include accessibility checks (labels, keyboard nav, focus order) in reviews.
- Avoid
any; if unavoidable, annotate with a TODO and reason. </PROCESS_REQUIREMENTS>