Analyze React projects for onboarding...
Provide comprehensive analysis of React projects to help developers understand the frontend codebase quickly. This skill leverages the react-specialist agent to analyze React-specific patterns, Next.js conventions, and modern frontend best practices.
Use this skill when you need to:
project/
āāā app/
ā āāā layout.tsx # Root layout
ā āāā page.tsx # Home page (/)
ā āāā globals.css
ā āāā (auth)/ # Route group
ā ā āāā login/
ā ā ā āāā page.tsx # /login
ā ā āāā register/
ā ā āāā page.tsx # /register
ā āāā dashboard/
ā ā āāā layout.tsx # Nested layout
ā ā āāā page.tsx # /dashboard
ā ā āāā [id]/
ā ā āāā page.tsx # /dashboard/:id
ā āāā api/
ā āāā route.ts # API routes
āāā components/
ā āāā ui/ # Base UI components
ā āāā features/ # Feature-specific components
ā āāā layouts/ # Layout components
āāā hooks/ # Custom hooks
āāā lib/ # Utilities and helpers
āāā stores/ # State management
āāā types/ # TypeScript types
project/
āāā pages/
ā āāā _app.tsx # App wrapper
ā āāā _document.tsx # Document customization
ā āāā index.tsx # Home page (/)
ā āāā api/ # API routes
ā āāā [slug].tsx # Dynamic routes
āāā components/
āāā hooks/
āāā styles/
project/
āāā src/
ā āāā main.tsx # Entry point
ā āāā App.tsx # Root component
ā āāā pages/ # Page components
ā āāā components/
ā āāā hooks/
ā āāā stores/
ā āāā routes/ # Route configuration
āāā index.html
When analyzing a React project:
Identify Framework & Structure
# Check for Next.js
grep -l "next" package.json && ls -la app/ pages/ 2>/dev/null
# Check for Vite
grep -l "vite" package.json && ls -la src/
# Check package.json for clues
cat package.json | grep -E '"(next|vite|react-scripts|gatsby)"'
Count Pages/Screens
# Next.js App Router pages
find app -name "page.tsx" -o -name "page.jsx" | wc -l
# Next.js Pages Router
find pages -name "*.tsx" -o -name "*.jsx" | grep -v "_" | wc -l
# SPA routes (look for route definitions)
grep -r "path:" --include="*.tsx" src/routes/
Map Components
# Find all components
find . -path ./node_modules -prune -o -name "*.tsx" -print | grep -E "(components|ui)/"
# Count components by directory
find components -name "*.tsx" | wc -l
# Find component exports
grep -r "export.*function\|export default" --include="*.tsx" components/
Analyze Custom Hooks
# Find custom hooks
find . -path ./node_modules -prune -o -name "use*.ts" -print
find . -path ./node_modules -prune -o -name "use*.tsx" -print
# List hooks directory
ls -la hooks/ src/hooks/ 2>/dev/null
Identify State Management
# Check for state libraries in package.json
grep -E "(zustand|redux|recoil|jotai|mobx)" package.json
# Find Context providers
grep -r "createContext\|useContext" --include="*.tsx"
# Find Zustand stores
grep -r "create\(" --include="*.ts" stores/
Review UI Library
# Check for UI libraries
grep -E "(@radix-ui|@headlessui|@mui|antd|chakra)" package.json
# Check for Tailwind
ls tailwind.config.* 2>/dev/null
# Check for shadcn/ui
ls components/ui/ 2>/dev/null
components/
āāā atoms/ # Button, Input, Label
āāā molecules/ # FormField, SearchBar
āāā organisms/ # Header, Sidebar, Form
āāā templates/ # PageLayout, DashboardLayout
āāā pages/ # Assembled pages
features/
āāā auth/
ā āāā components/
ā āāā hooks/
ā āāā api/
āāā dashboard/
ā āāā components/
ā āāā hooks/
ā āāā api/
āāā settings/
components/
āāā UserList/
ā āāā UserList.tsx # Presentational
ā āāā UserListContainer.tsx # Container (data fetching)
ā āāā index.ts
| Pattern | Files to Look For | Use Case |
|---|---|---|
| React Context | *Context.tsx, *Provider.tsx |
Simple global state |
| Zustand | stores/*.ts, use*Store.ts |
Medium complexity |
| Redux Toolkit | store/, slices/, *Slice.ts |
Complex state |
| Jotai/Recoil | atoms/, *Atom.ts |
Atomic state |
| React Query | queries/, use*Query.ts |
Server state |
Generate a React project report with:
Project Overview
Page/Screen Inventory
Component Architecture
Hooks Analysis
State Management
UI/Styling
Key Files to Read
graph TD
App --> Layout
Layout --> Header
Layout --> Sidebar
Layout --> MainContent
MainContent --> Dashboard
MainContent --> Settings
Dashboard --> StatCard
Dashboard --> Chart
graph LR
/ --> /dashboard
/ --> /settings
/dashboard --> /dashboard/analytics
/dashboard --> /dashboard/users
/settings --> /settings/profile
/settings --> /settings/security