Frontend Engineer
Comprehensive guide for modern React development, emphasizing Suspense-based data fetching, lazy loading, proper file organization, and performance optimization.
When to Use
- Creating new components or pages
- Building new features
- Fetching data with TanStack Query
- Setting up routing with TanStack Router
- Styling components
- Performance optimization
- Organizing frontend code
- TypeScript best practices
Quick Start
New Component Checklist
New Feature Checklist
Core Principles
- Lazy Load Everything Heavy: Routes, DataGrid, charts, editors
- Suspense for Loading: Use SuspenseLoader, not early returns
- useSuspenseQuery: Primary data fetching pattern for new code
- Features are Organized: api/, components/, hooks/, helpers/ subdirs
- Styles Based on Size: <100 inline, >100 separate
- Import Aliases: Use @/, ~types, ~components, ~features
- No Early Returns: Prevents layout shift
- TypeScript First: Strict mode, no
any type
Implementation Workflow
When implementing frontend code:
- Check for existing workflow patterns (spec-first, TDD, etc.) and follow them
- Ensure code passes CI checks (types, tests, lint) before committing
- Group related changes with tests in atomic commits
References
For detailed guidance, see:
references/component-patterns.md - Modern React component patterns
references/data-fetching.md - Suspense-based data fetching
references/file-organization.md - Feature-based organization
references/styling-guide.md - Styling patterns and best practices
references/routing-guide.md - TanStack Router patterns
references/performance.md - Performance optimization
references/typescript-standards.md - TypeScript best practices
1---2name: frontend-engineer3description: Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.4license: MIT5---6
7# Frontend Engineer
8
9Comprehensive guide for modern React development, emphasizing Suspense-based data fetching, lazy loading, proper file organization, and performance optimization.
10
11## When to Use
12
13- Creating new components or pages
14- Building new features
15- Fetching data with TanStack Query
16- Setting up routing with TanStack Router
17- Styling components
18- Performance optimization
19- Organizing frontend code
20- TypeScript best practices
21
22## Quick Start
23
24### New Component Checklist
25
26- [ ] Use `React.FC<Props>` pattern with TypeScript
27- [ ] Lazy load if heavy component: `React.lazy(() => import())`
28- [ ] Wrap in `<SuspenseLoader>` for loading states
29- [ ] Use `useSuspenseQuery` for data fetching
30- [ ] Import aliases: `@/`, `~types`, `~components`, `~features`
31- [ ] Styles: Inline if <100 lines, separate file if >100 lines
32- [ ] Use `useCallback` for event handlers passed to children
33- [ ] Default export at bottom
34- [ ] No early returns with loading spinners
35- [ ] Use notification system for user feedback
36
37### New Feature Checklist
38
39- [ ] Create `features/{feature-name}/` directory
40- [ ] Create subdirectories: `api/`, `components/`, `hooks/`, `helpers/`, `types/`
41- [ ] Create API service file: `api/{feature}Api.ts`
42- [ ] Set up TypeScript types in `types/`
43- [ ] Create route in `routes/{feature-name}/index.tsx`
44- [ ] Lazy load feature components
45- [ ] Use Suspense boundaries
46- [ ] Export public API from feature `index.ts`
47
48## Core Principles
49
501. **Lazy Load Everything Heavy:** Routes, DataGrid, charts, editors
512. **Suspense for Loading:** Use SuspenseLoader, not early returns
523. **useSuspenseQuery:** Primary data fetching pattern for new code
534. **Features are Organized:** api/, components/, hooks/, helpers/ subdirs
545. **Styles Based on Size:** <100 inline, >100 separate
556. **Import Aliases:** Use @/, ~types, ~components, ~features
567. **No Early Returns:** Prevents layout shift
578. **TypeScript First:** Strict mode, no `any` type
58
59## Implementation Workflow
60
61When implementing frontend code:
62- Check for existing workflow patterns (spec-first, TDD, etc.) and follow them
63- Ensure code passes CI checks (types, tests, lint) before committing
64- Group related changes with tests in atomic commits
65
66## References
67
68For detailed guidance, see:
69- `references/component-patterns.md` - Modern React component patterns
70- `references/data-fetching.md` - Suspense-based data fetching
71- `references/file-organization.md` - Feature-based organization
72- `references/styling-guide.md` - Styling patterns and best practices
73- `references/routing-guide.md` - TanStack Router patterns
74- `references/performance.md` - Performance optimization
75- `references/typescript-standards.md` - TypeScript best practices