frontend-standards
React patterns and frontend best practices for this project. Use when implementing React components, hooks, routes, styling, or client-side logic in packages/client.
When & Why to Use This Skill
This Claude skill serves as a comprehensive guide for enforcing modern React frontend standards and architectural best practices. It streamlines the development of scalable client-side applications by promoting React 18 features, TanStack Query, and Tailwind CSS, while strictly discouraging common anti-patterns like excessive useEffect usage. By integrating these standards, developers can ensure code consistency, improve performance through Suspense-driven data fetching, and maintain a clean, professional codebase.
Use Cases
- Standardizing React Component Development: Implementing new UI components and hooks that strictly follow project-specific patterns, such as centralized icon management and Tailwind CSS styling.
- Refactoring and Optimization: Modernizing legacy React code by replacing manual state management and side effects with TanStack Query, useSyncExternalStore, and React Suspense boundaries.
- Architectural Governance: Conducting automated code reviews to ensure client-side logic adheres to the 'server as source of truth' principle and avoids conflicting local states.
- Routing and State Management: Designing complex client-side navigation and global state subscriptions using TanStack Router and optimized external store patterns.
| name | frontend-standards |
|---|---|
| description | React patterns and frontend best practices for this project. Use when implementing React components, hooks, routes, styling, or client-side logic in packages/client. |
Frontend Standards
Key Principles
- Avoid useEffect - Use TanStack Query, useSyncExternalStore, or event handlers instead
- Prefer Suspense - For loading states and async boundaries
- useSyncExternalStore - For external state subscriptions (WebSocket, global stores)
- Server is the source of truth - Don't maintain conflicting client state
Tech Stack
- React 18, TanStack Router, TanStack Query, Tailwind CSS, xterm.js, Valibot
React Best Practices
- Suspense Usage - Prefer Suspense for async operations over manual isLoading flags
- useEffect Discipline - Challenge every useEffect: could it be derived value, event handler, or useMemo?
- Icon Components - SVG icons belong in
Icons.tsx, not inline in View components - External State - Use
useSyncExternalStorefor singleton/global state, not useEffect subscriptions - Query Key Management - Use consistent key factories, ensure complete invalidation
Detailed Documentation
- react-patterns.md - React patterns (useEffect alternatives, Suspense, state management)
- frontend-standards.md - Directory structure, TanStack Router/Query, React best practices, styling