Next.js + Tailwind Development Guidelines
Tech Stack: Next.js 15, React 19, Tailwind CSS v4, Radix UI, TanStack Query, ThirdWeb SDK v5,
TypeScript 5
This skill provides development guidelines specifically for the Zap Pilot frontend codebase. It
follows a progressive disclosure pattern - start here for the overview, then consult specific
resource files as needed.
Core Principles
- Service-First Architecture: All API operations use service functions (no classes)
- Component Composition: Reusable, well-typed components with clear interfaces
- Type Safety: Comprehensive TypeScript with strict configuration
- Performance: Lazy loading, memoization, and React Query caching
- Accessibility: ARIA labels and keyboard navigation support
Quick Reference
When Working With...
- Components: See
@components.md for Radix UI patterns, composition, and prop interfaces
- Routing: See
@routing.md for Next.js App Router patterns, navigation, and dynamic routes
- Data Fetching: See
@data-fetching.md for TanStack Query patterns and caching strategies
- Styling: See
@styling.md for Tailwind utilities, design tokens, and animations
- Web3: See
@web3-integration.md for ThirdWeb SDK, wallet connectivity, and chain management
Project Structure
frontend/
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── layout.tsx # Root layout with providers
│ │ ├── page.tsx # Home page
│ │ └── bundle/ # Bundle sharing feature
│ ├── components/ # Feature-based component organization
│ │ ├── ui/ # Design system components
│ │ ├── PortfolioAllocation/ # Portfolio management
│ │ ├── SwapPage/ # Trading interface
│ │ ├── Web3/ # Wallet connectivity
│ │ └── shared/ # Cross-feature components
│ ├── hooks/ # Custom hooks for business logic
│ │ ├── queries/ # React Query hooks
│ │ └── *.ts # Domain-specific hooks
│ ├── services/ # API integration (service functions)
│ │ ├── accountService.ts # User & wallet management
│ │ ├── intentService.ts # Transaction execution
│ │ └── analyticsService.ts # Portfolio analytics
│ ├── providers/ # React Context providers
│ ├── lib/ # Utilities and helpers
│ ├── types/ # TypeScript definitions
│ └── config/ # Configuration files
├── tests/ # Vitest unit tests and Playwright E2E
├── public/ # Static assets and PWA configuration
├── package.json
└── next.config.ts
Common Development Tasks
Creating a New Component
- Define types in component file or
src/types/
- Create service functions in appropriate
src/services/ file
- Create custom hooks for business logic in
src/hooks/
- Build UI component with proper TypeScript types
- Add tests in
tests/unit/
- Document with JSDoc comments
Creating a New API Integration
- Add service function in
src/services/[feature]Service.ts
- Create React Query hook in
src/hooks/queries/
- Handle loading, error, and success states
- Add error boundaries where needed
Adding a New Page
- Create route in
src/app/[route]/page.tsx
- Set up layout if needed (
layout.tsx)
- Implement page component with proper meta tags
- Add navigation links
- Test routing and data fetching
Development Workflow
# Type check
npm run type-check
# Run tests
npm run test:unit
# Lint and format
npm run lint
npm run format
# Start dev server
npm run dev
File Naming Conventions
- Components: PascalCase (e.g.,
PortfolioCard.tsx)
- Hooks: camelCase with
use prefix (e.g., usePortfolioData.ts)
- Services: camelCase with
Service suffix (e.g., analyticsService.ts)
- Utils: camelCase (e.g.,
formatCurrency.ts)
- Types: PascalCase (e.g.,
PortfolioData.ts)
- Test files:
*.test.ts or *.spec.ts
Progressive Disclosure Resources
For detailed guidance on specific topics, reference these files:
@components.md - Radix UI patterns, component composition, prop interfaces, design system
@routing.md - Next.js App Router, dynamic routes, navigation, layouts
@data-fetching.md - TanStack Query patterns, caching, mutations, optimistic updates
@styling.md - Tailwind CSS utilities, design tokens, animations, responsive design
@web3-integration.md - ThirdWeb SDK integration, wallet connectivity, transaction handling
@main.md - Additional patterns, error handling, testing standards, security practices
Use @filename.md syntax to include specific resource files when needed for deeper guidance.
1---2name: next-tailwind-dev-guidelines3description: Specialized development guidelines for the Zap Pilot frontend built with Next.js 15, React 19, Tailwind CSS v4, and TypeScript. Covers service-first architecture, component composition patterns, TanStack Query integration, Radix UI components, Web3 wallet integration via ThirdWeb SDK, routing with Next.js App Router, and progressive web app optimization. Use when working with React components, API integration, styling, data fetching, wallet connectivity, or building new features.4---5
6# Next.js + Tailwind Development Guidelines
7
8**Tech Stack**: Next.js 15, React 19, Tailwind CSS v4, Radix UI, TanStack Query, ThirdWeb SDK v5,
9TypeScript 5
10
11This skill provides development guidelines specifically for the Zap Pilot frontend codebase. It
12follows a **progressive disclosure pattern** - start here for the overview, then consult specific
13resource files as needed.
14
15## Core Principles
16
171. **Service-First Architecture**: All API operations use service functions (no classes)
182. **Component Composition**: Reusable, well-typed components with clear interfaces
193. **Type Safety**: Comprehensive TypeScript with strict configuration
204. **Performance**: Lazy loading, memoization, and React Query caching
215. **Accessibility**: ARIA labels and keyboard navigation support
22
23## Quick Reference
24
25### When Working With...
26
27- **Components**: See `@components.md` for Radix UI patterns, composition, and prop interfaces
28- **Routing**: See `@routing.md` for Next.js App Router patterns, navigation, and dynamic routes
29- **Data Fetching**: See `@data-fetching.md` for TanStack Query patterns and caching strategies
30- **Styling**: See `@styling.md` for Tailwind utilities, design tokens, and animations
31- **Web3**: See `@web3-integration.md` for ThirdWeb SDK, wallet connectivity, and chain management
32
33## Project Structure
34
35```
36frontend/
37├── src/
38│ ├── app/ # Next.js App Router pages
39│ │ ├── layout.tsx # Root layout with providers
40│ │ ├── page.tsx # Home page
41│ │ └── bundle/ # Bundle sharing feature
42│ ├── components/ # Feature-based component organization
43│ │ ├── ui/ # Design system components
44│ │ ├── PortfolioAllocation/ # Portfolio management
45│ │ ├── SwapPage/ # Trading interface
46│ │ ├── Web3/ # Wallet connectivity
47│ │ └── shared/ # Cross-feature components
48│ ├── hooks/ # Custom hooks for business logic
49│ │ ├── queries/ # React Query hooks
50│ │ └── *.ts # Domain-specific hooks
51│ ├── services/ # API integration (service functions)
52│ │ ├── accountService.ts # User & wallet management
53│ │ ├── intentService.ts # Transaction execution
54│ │ └── analyticsService.ts # Portfolio analytics
55│ ├── providers/ # React Context providers
56│ ├── lib/ # Utilities and helpers
57│ ├── types/ # TypeScript definitions
58│ └── config/ # Configuration files
59├── tests/ # Vitest unit tests and Playwright E2E
60├── public/ # Static assets and PWA configuration
61├── package.json
62└── next.config.ts
63```
64
65## Common Development Tasks
66
67### Creating a New Component
68
691. Define types in component file or `src/types/`
702. Create service functions in appropriate `src/services/` file
713. Create custom hooks for business logic in `src/hooks/`
724. Build UI component with proper TypeScript types
735. Add tests in `tests/unit/`
746. Document with JSDoc comments
75
76### Creating a New API Integration
77
781. Add service function in `src/services/[feature]Service.ts`
792. Create React Query hook in `src/hooks/queries/`
803. Handle loading, error, and success states
814. Add error boundaries where needed
82
83### Adding a New Page
84
851. Create route in `src/app/[route]/page.tsx`
862. Set up layout if needed (`layout.tsx`)
873. Implement page component with proper meta tags
884. Add navigation links
895. Test routing and data fetching
90
91## Development Workflow
92
93```bash
94# Type check
95npm run type-check
96
97# Run tests
98npm run test:unit
99
100# Lint and format
101npm run lint
102npm run format
103
104# Start dev server
105npm run dev
106```
107
108## File Naming Conventions
109
110- **Components**: PascalCase (e.g., `PortfolioCard.tsx`)
111- **Hooks**: camelCase with `use` prefix (e.g., `usePortfolioData.ts`)
112- **Services**: camelCase with `Service` suffix (e.g., `analyticsService.ts`)
113- **Utils**: camelCase (e.g., `formatCurrency.ts`)
114- **Types**: PascalCase (e.g., `PortfolioData.ts`)
115- **Test files**: `*.test.ts` or `*.spec.ts`
116
117## Progressive Disclosure Resources
118
119For detailed guidance on specific topics, reference these files:
120
121- `@components.md` - Radix UI patterns, component composition, prop interfaces, design system
122- `@routing.md` - Next.js App Router, dynamic routes, navigation, layouts
123- `@data-fetching.md` - TanStack Query patterns, caching, mutations, optimistic updates
124- `@styling.md` - Tailwind CSS utilities, design tokens, animations, responsive design
125- `@web3-integration.md` - ThirdWeb SDK integration, wallet connectivity, transaction handling
126- `@main.md` - Additional patterns, error handling, testing standards, security practices
127
128Use `@filename.md` syntax to include specific resource files when needed for deeper guidance.