Three months ago, I spent 3 weeks building a SaaS dashboard. Last week, I built a more complex one in 3 hours and 42 minutes — using Claude as my co-pilot.
The difference wasn't just "using AI." It was a specific, repeatable workflow that eliminates the bottlenecks most developers hit when coding with AI.
Here's exactly how I do it — step by step, with real prompts.
The Problem: Most People Use AI Wrong
I see developers making the same mistakes:
- ❌ Pasting entire codebases into Claude and hoping for the best
- ❌ Using vague prompts like "build me a dashboard"
- ❌ Not breaking down the problem before asking AI
- ❌ Copy-pasting AI output without understanding it
- ❌ Not using AI for the things it's actually best at
The secret? AI is a junior developer that never sleeps, never gets bored, and has read every Stack Overflow answer ever written. But like any junior dev, it needs clear direction.
My 4-Hour Framework
I divide every project into 4 phases of ~1 hour each:
| Phase | Time | What AI Does | What I Do |
|---|---|---|---|
| 1. Blueprint | 60 min | Generates architecture, tech choices | Define requirements, review plan |
| 2. Scaffold | 60 min | Generates boilerplate, database schema | Set up repos, configure env |
| 3. Build | 60 min | Writes core feature code | Review, test, iterate |
| 4. Polish | 45 min | CSS, error handling, edge cases | Final review, deploy |
Let me walk through each phase.
Phase 1: Blueprint (60 Minutes)
Before writing a single line of code, I spend an hour planning with Claude. This is the most important phase and the one most people skip.
Step 1: Define the Problem
I start with a clear, structured prompt:
I'm building a SaaS product. Here's what I need:
Product: A subscription analytics dashboard
Users: SaaS founders who want to track MRR, churn, and LTV
Data Source: Stripe API
Tech Stack: Next.js 14 (App Router), TypeScript, Prisma, PostgreSQL, TailwindCSS
Timeline: Need a working prototype today
Give me:
1. A complete database schema with all relationships
2. API route structure (REST endpoints)
3. Component hierarchy (what pages/components I need)
4. The order I should build things in (dependency graph)
5. Potential gotchas I might hit
Why this works: Claude generates a concrete plan. No more "I'll figure it out as I go." You get a roadmap.
Step 2: Generate the Database Schema
Then I drill into each part:
Based on the schema you generated, write:
1. Complete Prisma schema with all models, relations, and indexes
2. Seed data (at least 20 records per model) that looks realistic
3. Migration SQL if needed
Format as a single `schema.prisma` file I can copy directly.
Step 3: API Contract
For each API route, give me:
1. The endpoint path and HTTP method
2. Request body/params type (TypeScript interface)
3. Response type (TypeScript interface)
4. Authentication requirement
5. Brief description of what it does
Format as a TypeScript file with all types exported.
Phase 1 output: You now have a complete spec — database schema, API types, component list, and build order. This would take 2-3 days to produce manually.
Phase 2: Scaffold (60 Minutes)
Now let AI generate all the boring stuff.
Generate Project Structure
Set up a Next.js 14 project with:
- App Router (not Pages Router)
- TypeScript strict mode
- TailwindCSS with these custom colors: [your palette]
- Prisma with PostgreSQL
- NextAuth.js for authentication (GitHub + email)
- shadcn/ui component library
Give me the exact commands to run and the folder structure.
Generate Type Definitions
Create a complete `types/index.ts` file that includes:
- All database model types (from our schema)
- All API request/response types
- All component prop types
- Utility types (pagination, API response wrapper, etc.)
Make it fully typed. No `any` allowed.
Generate Utility Functions
Write these utility functions:
1. `apiResponse<T>(data, status, message)` — standardized API response
2. `validateRequest<T>(schema, body)` — Zod validation wrapper
3. `paginate(query, page, limit)` — cursor-based pagination
4. `formatCurrency(amount, currency)` — i18n currency formatting
5. `calculateMRR(subscriptions)` — Monthly Recurring Revenue calc
6. `calculateChurn(subscriptions, period)` — Churn rate calc
Each function should be production-ready with proper error handling.
Phase 2 output: A complete project skeleton with types, utils, auth, and database — ready to build features on top of.
Phase 3: Build (60 Minutes)
This is where the magic happens. I build features one at a time, using a specific prompt pattern.
The Feature Prompt Pattern
For every feature, I use this template:
Build me the [FEATURE NAME] feature.
Context:
- Tech stack: Next.js 14, TypeScript, Prisma, TailwindCSS, shadcn/ui
- Database schema: [paste relevant models]
- API types: [paste relevant types]
Requirements:
1. [Specific requirement 1]
2. [Specific requirement 2]
3. [Specific requirement 3]
Give me:
1. The API route code (app/api/...)
2. The React component code
3. Any Prisma queries needed
4. Test cases for edge cases
Important rules:
- Use Server Components by default, Client Components only when needed
- Handle loading states and errors
- Use optimistic updates where appropriate
Example: Building the Dashboard Page
Build me the main dashboard page.
It should show:
1. Revenue chart (line chart, last 12 months) — use Recharts
2. Current MRR card with % change from last month
3. Active subscribers count
4. Churn rate card
5. Top 5 plans by revenue (horizontal bar chart)
6. Recent transactions table (last 10, with pagination)
Layout:
- Top row: 3 stat cards
- Middle: 2-column (chart left, table right)
- Bottom: 2-column (bar chart left, recent activity right)
The key insight: one feature, one prompt, complete output. Don't try to build everything at once.
The Review Loop
After each feature, I do a quick review:
Review this code and tell me:
1. Any bugs or edge cases I'm missing
2. Performance issues (N+1 queries, missing indexes, etc.)
3. Security concerns (SQL injection, XSS, auth bypass)
4. Accessibility issues
5. Code that could be simplified
Fix any issues you find.
This catches 80% of problems before they become bugs.
Phase 4: Polish (45 Minutes)
The final phase turns "works on my machine" into "ready for users."
CSS and Animations
Add polish to this page:
1. Loading skeletons for all data-fetching components
2. Smooth transitions between states (loading → loaded → error)
3. Hover effects on interactive elements
4. A subtle entrance animation for the main content
5. Responsive design — mobile-first breakpoints at sm/md/lg/xl
Error Handling
Add comprehensive error handling:
1. Every API route should have try/catch with proper error responses
2. Show friendly error messages to users (never expose stack traces)
3. Add retry logic for failed API calls (with exponential backoff)
4. Handle network errors gracefully
5. Add error boundaries for React components
Edge Cases
What happens in my app when:
1. The user has no data yet (empty state)?
2. The API is slow (>10 seconds)?
3. The user loses internet connection?
4. Data is deleted while they're viewing it?
5. Multiple users edit the same record?
Add handling for all of these.
The Results
Using this framework, here's what I've shipped in the last month:
| Project | Time | Without AI (est.) | Speedup |
|---|---|---|---|
| SaaS Dashboard | 3h 42m | 2-3 weeks | ~30x |
| E-commerce Admin | 4h 15m | 1-2 weeks | ~15x |
| Blog Platform | 2h 30m | 1 week | ~20x |
| Task Management App | 3h 10m | 2 weeks | ~25x |
| API + Docs Site | 2h 55m | 1 week | ~17x |
Average speedup: ~20x faster than traditional development.
Critical Rules I Follow
These rules prevent the most common AI coding pitfalls:
1. Always Review Every Line
AI writes plausible code that may have subtle bugs. Never ship without reading every line.
2. Ask for Tests
Include "write tests" in every prompt. AI is excellent at generating test cases you wouldn't think of.
3. Use Version Control Aggressively
Commit after each feature. If AI goes in a wrong direction, you can revert instantly.
git add . && git commit -m "Add dashboard page"
4. Don't Be Afraid to Reject
If Claude's output doesn't make sense, say so:
This doesn't look right. The data flow is wrong —
subscriptions should come from the API, not props.
Try again with proper data fetching.
5. Keep Context Small
Don't paste your entire codebase. Share only the relevant files for each prompt.
Tools I Use Alongside Claude
- Cursor — AI-first code editor with Claude integration
- Recharts — For dashboards and data viz
- shadcn/ui — Beautiful, accessible components
- Prisma — Type-safe database access
- Vercel — One-click deployment
Final Thoughts
The developers who will thrive in the AI era aren't the ones who avoid AI or blindly trust it. They're the ones who learn to direct AI effectively — giving it clear context, structured requirements, and reviewing its output with a critical eye.
My 4-hour framework is just one way to do it. The principles are universal:
- Plan before you code (with AI as your thinking partner)
- Generate the boring stuff (scaffolding, types, boilerplate)
- Build feature by feature (one prompt, one feature, complete output)
- Polish deliberately (error handling, edge cases, responsive design)
Start with a small project. Try the framework. Adjust it to your style. You'll be amazed at how fast you can ship.
What's your AI coding workflow? I'd love to hear how others are using Claude or similar tools. Drop a comment below! 👇
Top comments (0)