The Four Phases
You MUST complete each phase before proceeding to the next.
Phase 1: Data & Contract Definition
BEFORE writing any UI or Component code:
Define the Data Model
- What does the entity look like in the database?
- What are the required fields?
- What are the relationships (1:1, 1:N, N:M)?
- Draft the TypeScript Interface/Type definitions first.
Establish the Contract (API)
- How does the frontend fetch this data?
- What arguments does the query/mutation require?
- What are the exact failure states (401, 403, 404, 500)?
- Don't guess: Check the Swagger/OpenAPI spec or backend code.
Trace the State Lifecycle
- Where does this data live? (URL URL params? Server State? Client Store? Local Component?)
- Rule: Lift state up only as high as necessary.
- Rule: Prefer Server State (React Query, SWR) over Global Client State (Redux/Context) for server data.
Security & Access Control
- Who is allowed to see this?
- Who is allowed to edit this?
- Does the backend enforce this? (Frontend checks are just UI sugar).
Phase 2: The "Walking Skeleton"
Build the pipeline before the pixel:
Build the Integration Layer First
- Create the API client methods.
- Create the hook/service to fetch the data.
- Verify data flows from Backend → Network Tab → Console Log.
- Do not build UI elements yet.
Verify Error Handling
- Force the network request to fail.
- Does your service catch it?
- Do you have a typed error object?
Hardcode the Happy Path
- Create a bare-bones, unstyled test component.
- Render
JSON.stringify(data) to the screen.
- Verify the "Walking Skeleton" connects end-to-end.
Phase 2.5: Modern Frontend Tooling (2026)
The 2026 frontend landscape:
State Management Evolution
- Server State ≠ Client State (This is the key insight)
- Server State: Use Tanstack Query (React Query), SWR, tRPC
- Auto-caching, refetching, optimistic updates
- Don't put API data in Redux/Context/Zustand
- Client State: Use Zustand, Jotai, or Context (for truly local state)
- UI toggles, form state, theme preference
- React 19 Patterns:
- Server Components for data fetching (Next.js App Router)
use() hook for promises
- Actions for mutations
Build Tools (Vite Era)
- Vite 6: 10x faster HMR than Webpack, native ESM
- Turbopack: Next.js native bundler (Rust-based)
- Biome: Unified linter/formatter (replaces ESLint + Prettier)
- Bun: Ultra-fast package manager (3-10x faster than npm)
- Anti-Pattern: Still using Create React App (deprecated 2023)
TypeScript Best Practices (2026)
Phase 3: Component Architecture
Design the structure:
Identify Boundaries
- Container/Page: Handles data fetching, URL parameters, and layout.
- Presentational/Leaf: Receives data via props. Pure functions. No side effects.
- Rule: If a component is > 150 lines, it probably does too much.
Separation of Concerns
- Logic goes in Custom Hooks or Utility functions.
- Markup (JSX/HTML) stays clean and readable.
- Styles (CSS/Tailwind) should be consistent.
Accessibility (a11y) Planning
- Semantic HTML elements (
<button> not <div>).
- Keyboard navigation (Tab index).
- Aria labels for non-text interactions.
Phase 4: Implementation & Polish
Iterative construction:
Implement Core Functionality
- Build the inputs and display logic.
- Connect the "Walking Skeleton" data to real inputs.
- Use
superpowers:test-driven-development for complex logic.
Handle Loading & Empty States
- What does the user see while fetching? (Skeleton/Spinner)
- What if the list is empty? (Empty state illustration)
- What if it errors? (Retry button/Toast)
Defensive Coding
- Handle null/undefined values safely (Optional Chaining
?.).
- Validate form inputs (Zod/Yup).
- Prevent double-submissions on buttons.
Final Polish
- Transitions/Animations.
- Responsive behavior (Mobile/Tablet).
- Dark mode compliance.
Phase 4.5: Performance Profiling
Make it fast:
React Performance Tools
Core Web Vitals (Google Ranking Factors)
- LCP (Largest Contentful Paint): <2.5s
- Fix: Preload hero images, remove render-blocking scripts
- FID/INP (Interaction): <100ms
- Fix: Code splitting, lazy load heavy components
- CLS (Cumulative Layout Shift): <0.1
- Fix: Set width/height on images, reserve space for dynamic content
- Tool: Lighthouse CI (automated performance regression tests)
Bundle Analysis
- webpack-bundle-analyzer / vite-plugin-visualizer
Red Flags - STOP and Follow Process
If you catch yourself thinking:
- "I'll just put the
fetch call inside the useEffect for now."
- "I'll fix the TypeScript
any types later."
- "I'll handle errors globally, I don't need a
try/catch here."
- "Just copy-paste that other component and tweak it."
- "I'll add the loading state after I get it working."
- "Why is this re-rendering 50 times? Whatever, it works."
- "I'm not sure where this prop comes from, just drill it down."
- Writing CSS/Styles before data is successfully logging to console.
ALL of these mean: STOP. Return to Phase 1.
Your Human Partner's Signals You're Doing It Wrong
Watch for these redirections:
- "Where is the data coming from?" - You skipped Phase 1.
- "Is this accessible?" - You ignored semantic HTML in Phase 3.
- "This feels slow/janky." - You botched the State Lifecycle or re-renders.
- "What happens if the API is down?" - You missed Phase 2 (Error Handling).
- "Why are we passing props down 5 levels?" - Bad Component Architecture.
When you see these: STOP. Return to Phase 3.
Common Rationalizations
| Excuse |
Reality |
| "I'll add types later" |
You never will. 'Any' breeds runtime errors. |
| "It's just a prototype" |
Prototypes become production code. Build it right. |
| "Styling is easier to do as I go" |
Distracts from logic flaws. Data first, pixels second. |
| "I don't need a custom hook for this" |
Mixing UI and Data logic makes code untestable. |
| "The backend handles validation" |
Frontend validation saves roundtrips and UX frustration. |
| "A11y takes too long" |
Fixing a lawsuit or rewriting for a11y later takes longer. |
Quick Reference
| Phase |
Key Activities |
Success Criteria |
| 1. Data & Contract |
Define Interface, API check, State plan |
Typed interfaces, clear data source |
| 2. Walking Skeleton |
API Client, Logs, Error handling |
Data logs to console, Errors caught |
| 3. Architecture |
Container vs Presentational, Semantic HTML |
Clean component tree, readable JSX |
| 4. Implementation |
UI Logic, Loading States, Polish |
Fully interactive, handled edge cases |
When Process Reveals "Backend Blockers"
If systematic investigation reveals the Backend API is missing or broken:
- Mock it immediately.
- Define the expected JSON structure (Phase 1).
- Create a mock function that returns that JSON after a delay.
- Continue development (Phase 2-4) using the mock.
- Swap the mock for the real API endpoint when ready.
Do not stop development waiting for backend.
Supporting Techniques
superpowers:test-driven-development - For complex validation or state logic.
superpowers:clean-code - For keeping components small and readable.
- Feature Flagging - For merging code safely before it's 100% ready.
Real-World Impact
From development cycles:
- Data-First approach: Features land with 90% fewer integration bugs.
- UI-First approach: constant "rewrites" when data shape changes.
- Mocking: Allows frontend/backend to work in parallel without blocking.
The above content shows the entire, complete file contents of the requested file.
🛠️ Recommended Frontend Stack (2026)
Core Framework
- React 19: Server Components, Actions, use() hook
- Next.js 15: App Router (React Server Components)
- TypeScript 5.6: Essential for scale
State Management
- Server State: Tanstack Query, tRPC (type-safe)
- Client State: Zustand (simple), Jotai (atomic)
- Forms: React Hook Form + Zod validation
Styling
- Tailwind CSS 4: Utility-first, fast
- shadcn/ui: Copy-paste components (not npm package)
- CSS Modules: For component-scoped styles
Build Tools
- Vite 6: Dev server (fast HMR)
- Turbopack: Production bundler (Next.js)
- Biome: Linter + Formatter (Rust-based)
- Bun: Package manager (faster than npm/pnpm)
Testing
- Vitest: Unit tests (Vite-native)
- Playwright: E2E tests (cross-browser)
- Testing Library: Component tests
Avoid
- Create React App: Deprecated, use Vite
- Redux: Overkill for most apps, use Tanstack Query + Zustand
- Moment.js: Huge bundle, use date-fns or Temporal API
📚 Learning Resources
Books
- Designing Data-Intensive Applications (Kleppmann) - Understand backend data flows
- Refactoring UI (Wathan) - Visual design for developers
Documentation
- React 19 Docs (react.dev) - Official React documentation
- MDN Web Docs - Web platform reference
- TypeScript Handbook - Type system deep dive
Communities
- Reactiflux Discord: 200k+ React developers
- Frontend Masters: High-quality video courses
- This Week In React: Newsletter (Sébastien Lorber)
1---2name: code-developer3description: Code Developer Skill.4---5## The Four Phases67You MUST complete each phase before proceeding to the next.89### Phase 1: Data & Contract Definition1011**BEFORE writing any UI or Component code:**12131. **Define the Data Model**14 - What does the entity look like in the database?15 - What are the required fields?16 - What are the relationships (1:1, 1:N, N:M)?17 - **Draft the TypeScript Interface/Type definitions first.**18192. **Establish the Contract (API)**20 - How does the frontend fetch this data?21 - What arguments does the query/mutation require?22 - What are the exact failure states (401, 403, 404, 500)?23 - **Don't guess:** Check the Swagger/OpenAPI spec or backend code.24253. **Trace the State Lifecycle**26 - Where does this data live? (URL URL params? Server State? Client Store? Local Component?)27 - **Rule:** Lift state up only as high as necessary.28 - **Rule:** Prefer Server State (React Query, SWR) over Global Client State (Redux/Context) for server data.29304. **Security & Access Control**31 - Who is allowed to see this?32 - Who is allowed to edit this?33 - Does the backend enforce this? (Frontend checks are just UI sugar).3435### Phase 2: The "Walking Skeleton"3637**Build the pipeline before the pixel:**38391. **Build the Integration Layer First**40 - Create the API client methods.41 - Create the hook/service to fetch the data.42 - Verify data flows from Backend → Network Tab → Console Log.43 - **Do not build UI elements yet.**44452. **Verify Error Handling**46 - Force the network request to fail.47 - Does your service catch it?48 - Do you have a typed error object?49503. **Hardcode the Happy Path**51 - Create a bare-bones, unstyled test component.52 - Render `JSON.stringify(data)` to the screen.53 - Verify the "Walking Skeleton" connects end-to-end.5455### Phase 2.5: Modern Frontend Tooling (2026)5657**The 2026 frontend landscape:**58591. **State Management Evolution**60 - **Server State ≠ Client State** (This is the key insight)61 - **Server State:** Use Tanstack Query (React Query), SWR, tRPC62 - Auto-caching, refetching, optimistic updates63 - Don't put API data in Redux/Context/Zustand64 - **Client State:** Use Zustand, Jotai, or Context (for truly local state)65 - UI toggles, form state, theme preference66 - **React 19 Patterns:**67 - Server Components for data fetching (Next.js App Router)68 - `use()` hook for promises69 - Actions for mutations70712. **Build Tools (Vite Era)**72 - **Vite 6:** 10x faster HMR than Webpack, native ESM73 - **Turbopack:** Next.js native bundler (Rust-based)74 - **Biome:** Unified linter/formatter (replaces ESLint + Prettier)75 - **Bun:** Ultra-fast package manager (3-10x faster than npm)76 - **Anti-Pattern:** Still using Create React App (deprecated 2023)77783. **TypeScript Best Practices (2026)**79 - **Zod for Runtime Validation:** Type safety at boundaries80 ```typescript81 const UserSchema = z.object({ id: z.number(), email: z.string().email() });82 type User = z.infer<typeof UserSchema>; // DRY83 ```84 - **Type Utilities:** Leverage built-ins (Partial, Pick, Omit, Awaited)85 - **Strict Mode:** Enable `strict: true` in tsconfig86 - **Rule:** No `any` types (use `unknown` if truly dynamic)8788### Phase 3: Component Architecture8990**Design the structure:**91921. **Identify Boundaries**93 - **Container/Page:** Handles data fetching, URL parameters, and layout.94 - **Presentational/Leaf:** Receives data via props. Pure functions. No side effects.95 - **Rule:** If a component is > 150 lines, it probably does too much.96972. **Separation of Concerns**98 - Logic goes in Custom Hooks or Utility functions.99 - Markup (JSX/HTML) stays clean and readable.100 - Styles (CSS/Tailwind) should be consistent.1011023. **Accessibility (a11y) Planning**103 - Semantic HTML elements (`<button>` not `<div>`).104 - Keyboard navigation (Tab index).105 - Aria labels for non-text interactions.106107### Phase 4: Implementation & Polish108109**Iterative construction:**1101111. **Implement Core Functionality**112 - Build the inputs and display logic.113 - Connect the "Walking Skeleton" data to real inputs.114 - **Use `superpowers:test-driven-development`** for complex logic.1151162. **Handle Loading & Empty States**117 - What does the user see while fetching? (Skeleton/Spinner)118 - What if the list is empty? (Empty state illustration)119 - What if it errors? (Retry button/Toast)1201213. **Defensive Coding**122 - Handle null/undefined values safely (Optional Chaining `?.`).123 - Validate form inputs (Zod/Yup).124 - Prevent double-submissions on buttons.1251264. **Final Polish**127 - Transitions/Animations.128 - Responsive behavior (Mobile/Tablet).129 - Dark mode compliance.130131### Phase 4.5: Performance Profiling132133**Make it fast:**1341351. **React Performance Tools**136 - **React DevTools Profiler:** Record renders, find expensive components137 - **Why Did You Render:** Debug unnecessary re-renders138 ```bash139 npm i @welldone-software/why-did-you-render140 ```141 - **Million.js:** Auto-optimize React (virtual DOM replacement)1421432. **Core Web Vitals (Google Ranking Factors)**144 - **LCP (Largest Contentful Paint):** <2.5s145 - Fix: Preload hero images, remove render-blocking scripts146 - **FID/INP (Interaction):** <100ms147 - Fix: Code splitting, lazy load heavy components148 - **CLS (Cumulative Layout Shift):** <0.1149 - Fix: Set width/height on images, reserve space for dynamic content150 - **Tool:** Lighthouse CI (automated performance regression tests)1511523. **Bundle Analysis**153 - **webpack-bundle-analyzer / vite-plugin-visualizer**154 ```bash155156157## Red Flags - STOP and Follow Process158159If you catch yourself thinking:160- "I'll just put the `fetch` call inside the `useEffect` for now."161- "I'll fix the TypeScript `any` types later."162- "I'll handle errors globally, I don't need a `try/catch` here."163- "Just copy-paste that other component and tweak it."164- "I'll add the loading state after I get it working."165- "Why is this re-rendering 50 times? Whatever, it works."166- "I'm not sure where this prop comes from, just drill it down."167- **Writing CSS/Styles before data is successfully logging to console.**168169**ALL of these mean: STOP. Return to Phase 1.**170171## Your Human Partner's Signals You're Doing It Wrong172173**Watch for these redirections:**174- "Where is the data coming from?" - You skipped Phase 1.175- "Is this accessible?" - You ignored semantic HTML in Phase 3.176- "This feels slow/janky." - You botched the State Lifecycle or re-renders.177- "What happens if the API is down?" - You missed Phase 2 (Error Handling).178- "Why are we passing props down 5 levels?" - Bad Component Architecture.179180**When you see these:** STOP. Return to Phase 3.181182## Common Rationalizations183184| Excuse | Reality |185|--------|---------|186| "I'll add types later" | You never will. 'Any' breeds runtime errors. |187| "It's just a prototype" | Prototypes become production code. Build it right. |188| "Styling is easier to do as I go" | Distracts from logic flaws. Data first, pixels second. |189| "I don't need a custom hook for this" | Mixing UI and Data logic makes code untestable. |190| "The backend handles validation" | Frontend validation saves roundtrips and UX frustration. |191| "A11y takes too long" | Fixing a lawsuit or rewriting for a11y later takes longer. |192193## Quick Reference194195| Phase | Key Activities | Success Criteria |196|-------|---------------|------------------|197| **1. Data & Contract** | Define Interface, API check, State plan | Typed interfaces, clear data source |198| **2. Walking Skeleton** | API Client, Logs, Error handling | Data logs to console, Errors caught |199| **3. Architecture** | Container vs Presentational, Semantic HTML | Clean component tree, readable JSX |200| **4. Implementation** | UI Logic, Loading States, Polish | Fully interactive, handled edge cases |201202## When Process Reveals "Backend Blockers"203204If systematic investigation reveals the Backend API is missing or broken:2052061. **Mock it immediately.**2072. Define the expected JSON structure (Phase 1).2083. Create a mock function that returns that JSON after a delay.2094. Continue development (Phase 2-4) using the mock.2105. Swap the mock for the real API endpoint when ready.211212**Do not stop development waiting for backend.**213214## Supporting Techniques215216- **`superpowers:test-driven-development`** - For complex validation or state logic.217- **`superpowers:clean-code`** - For keeping components small and readable.218- **Feature Flagging** - For merging code safely before it's 100% ready.219220## Real-World Impact221222From development cycles:223- **Data-First approach:** Features land with 90% fewer integration bugs.224- **UI-First approach:** constant "rewrites" when data shape changes.225- **Mocking:** Allows frontend/backend to work in parallel without blocking.226The above content shows the entire, complete file contents of the requested file.227228## 🛠️ Recommended Frontend Stack (2026)229230### Core Framework231- **React 19:** Server Components, Actions, use() hook232- **Next.js 15:** App Router (React Server Components)233- **TypeScript 5.6:** Essential for scale234235### State Management236- **Server State:** Tanstack Query, tRPC (type-safe)237- **Client State:** Zustand (simple), Jotai (atomic)238- **Forms:** React Hook Form + Zod validation239240### Styling241- **Tailwind CSS 4:** Utility-first, fast242- **shadcn/ui:** Copy-paste components (not npm package)243- **CSS Modules:** For component-scoped styles244245### Build Tools246- **Vite 6:** Dev server (fast HMR)247- **Turbopack:** Production bundler (Next.js)248- **Biome:** Linter + Formatter (Rust-based)249- **Bun:** Package manager (faster than npm/pnpm)250251### Testing252- **Vitest:** Unit tests (Vite-native)253- **Playwright:** E2E tests (cross-browser)254- **Testing Library:** Component tests255256### Avoid257- **Create React App:** Deprecated, use Vite258- **Redux:** Overkill for most apps, use Tanstack Query + Zustand259- **Moment.js:** Huge bundle, use date-fns or Temporal API260261## 📚 Learning Resources262263### Books264- *Designing Data-Intensive Applications* (Kleppmann) - Understand backend data flows265- *Refactoring UI* (Wathan) - Visual design for developers266267### Documentation268- React 19 Docs (react.dev) - Official React documentation269- MDN Web Docs - Web platform reference270- TypeScript Handbook - Type system deep dive271272### Communities273- **Reactiflux Discord:** 200k+ React developers274- **Frontend Masters:** High-quality video courses275- **This Week In React:** Newsletter (Sébastien Lorber)