Skip to Content

Planning for AI: The Blueprint

“In Vibe Coding, documentation isn’t just a record of what you built. It is the source code for the AI that builds it.”

This guide integrates advanced prompting techniques, critical gaps, and tool-specific workflows into a complete blueprint for AI-assisted development.

The Core Insight: Docs Are Your Source Code

In Vibe Coding, the relationship between code and documentation is inverted.

Traditional DevelopmentVibe Coding
Code → DocsDocs → Code
”Write docs later""Docs are the input”
Human interprets requirementsAI interprets requirements
Ambiguity resolved by chatAmbiguity resolved by strict specs
⚠️

The Reality: Your AI agent has no watercooler conversations, no Slack context, and no institutional knowledge. Your planning documents are the only reality it knows.


1. The Planning Loop

The process follows a strict cycle to minimize hallucinations and rework.

  1. Plan: Define what to build (PRD, User Stories).
  2. Discuss: Validate with AI before coding.
  3. Implement: AI generates code from the context.
  4. Verify: Tests and reviews confirm intent.
💡

Critical Step: The “Discuss” phase is often skipped. Before implementing, always prompt:

“Here’s my PRD. What edge cases am I missing? What’s underspecified? What questions would a developer ask? Are there security concerns?“


2. The Golden PRD Template

🚀

See it in action: Check out Project 1: Link-in-Bio to see how we used this exact template to build a real app.

This is a Project Requirements Document optimized for Large Language Models. Code blocks are ready to copy-paste.

Bootstrap for Non-Coders: Don’t know how to write the Data Model or Tech Stack? Ask the AI to do it for you first! “Act as my CTO. I want to build a [Idea]. Generate a strict Tech Stack and TypeScript Data Model for me to put in my PRD.”

Copy-Paste Template

planning_template.md
# [Project Name] - Product Requirements Document ## Role You are a senior [React/Python] engineer building a production application. You write clean, maintainable code with proper error handling and strict types. ## Objective [One clear sentence. What does this do?] *Example: "Build a budgeting dashboard that visualizes monthly spending by category and allows users to track transactions."* ## Tech Stack (Strict Constraints) - **Frontend:** [React 18, TypeScript, Tailwind CSS] - **Backend:** [Supabase, PostgreSQL] - **State Management:** [Zustand] - **Auth:** [Supabase Auth] - **Testing:** [Vitest, React Testing Library] ⚠️ CRITICAL: Do NOT suggest alternatives. Use exactly these technologies. ## User Stories ### Primary Flow 1. As a [user], I want to [action] so that [outcome]. 2. As a [user], I want to [action] so that [outcome]. ### Secondary Flows 1. As a [user], I want to [action] so that [outcome]. ## Data Model \`\`\`typescript interface User { id: string; email: string; created_at: Date; } interface Transaction { id: string; user_id: string; amount: number; category: string; date: Date; } \`\`\` ## UI Requirements ### Pages 1. **Dashboard (/dashboard)** - Monthly spending chart - Recent transactions list (last 10) - Quick-add button 2. **Transactions (/transactions)** - Filterable table (search, category, date) - Bulk delete capability 3. **Settings (/settings)** - Edit profile - Export data as CSV ## Non-Functional Requirements - **Mobile-responsive:** Breakpoints: 640px, 768px, 1024px. - **Performance:** Lighthouse >90, LCP <2.5s. - **Accessibility:** WCAG 2.1 AA (Contrast, Keyboard nav). ## Success Criteria - [ ] User can add transaction in < 10s. - [ ] Dashboard loads in < 2s. - [ ] Zero console errors. - [ ] TypeScript strict mode: zero `any` types.

3. Essential Strategies (Often Missed)

Validating these areas upfront saves hours of debugging later.

Error Handling Strategy

Don’t just say “handle errors.” Define the behavior.

  • API Errors: 401 → Redirect to login. 500 → Show support contact.
  • UI Errors: Form validation → Inline red text. Data fetch fail → Retry button.
  • Messages: “Email already registered. Try logging in.” (Not “Error 409”).

State Management

  • Global (Zustand): User auth, Theme.
  • Server (React Query): Transactions (cache 5 mins), Profile (cache 10 mins).
  • Local (useState): Form inputs, Modal open/close.

Testing Requirements

  • Unit (Vitest): Utilities, Hooks.
  • Integration (RTL): Form submissions, critical flows.
  • E2E (Playwright): Happy path user journey.

4. Advanced Prompting Techniques (2025)

These research-backed techniques separate working code from hallucinations.

1. Decomposition

Break big problems into steps.

Good: “Let’s build step-by-step: 1. Schema. 2. API. 3. UI. Confirm step 1 before moving to step 2.”

2. Constraint Anchoring

Negative constraints prevent weird library choices.

Good: “Do NOT use external CSS libraries. Use ONLY Tailwind utility classes. Do NOT use inline styles.”

3. Self-Criticism & Reflection

Force the AI to audit itself.

Good: “Before finalizing, check for: 1. Accessibility issues. 2. TypeScript safety. 3. Performance bottlenecks.”

4. Few-Shot Learning

Show, don’t just tell.

Good: “Format errors exactly like this example: { type: 'error', code: 'INVALID_EMAIL' }

5. Role Specification

Be specific about the “Persona”.

Good: “Act as a code reviewer. Criteria: 1. Strict Typing. 2. Error Handling. 3. Accessibility.”


5. The Context File (.cursorrules)

Stop repeating yourself. Every AI IDE supports a persistent context file.

  • Cursor: .cursorrules
  • Windsurf: .windsurfrules
  • Generic: .PROJECT_CONTEXT.md

Template for Context File

.cursorrules
# Project Context ## Tech Stack - Frontend: React 18 + TypeScript + Tailwind CSS - Backend: Supabase (Postgres + Auth) - Query: React Query v5 - State: Zustand ## Strict Rules 1. NEVER use `any` type - use `unknown` if truly unknown. 2. ALWAYS handle loading and error states. 3. ALWAYS use environment variables for secrets (`process.env.NEXT_PUBLIC_...`). 4. NEVER commit `.env.local`. 5. ALWAYS use `cn()` for conditional classNames. ## Common Patterns - **Fetching:** Use `useQuery` with `staleTime`. - **Forms:** Use `react-hook-form` + `zod`.

6. Tools for AI-Optimized Planning

Use tools that “speak” the language of AI (Markdown, JSON, Code).

ToolWhy for AI
ExcalidrawExports JSON/PNG for multimodal AI.
Mermaid.jsText-based diagrams; paste code directly into prompts.
dbdiagram.ioGenerates SQL/Prisma schemas instantly.
ObsidianLocal Markdown files; keeps context available.
tldrawCollaborative whiteboard that exports cleanly.
NotionExports structured Markdown.

7. Planning Checklist

Before you start coding, do you have:

  • Objective: One clear sentence?
  • Tech Stack: Explicit constraints (No “modern tools”, list specific libraries)?
  • Data Model: TypeScript interfaces or SQL schema?
  • User Stories: Primary flows defined?
  • Visuals: Wireframe directly (Excalidraw) or Mermaid diagram?
  • Discuss Phase: Did you ask the AI to critique your plan first?

8. Common Mistakes

MistakeCorrection
”Build a nice dashboard""Build a monthly spending dashboard with bar charts and transaction lists."
"Use modern practices""Use Next.js 14 App Router, Functional Components, and Zod validation.”
Skipping critique”Critique this PRD for security flaws before we write code.”

The Philosophy

Planning IS the product. 30 minutes of planning saves 2+ hours of debugging. Explicit constraints = fewer hallucinations. Data models upfront = no structural surprises.

Your AI agent is only as good as the information you give it.

Last updated on
← Return to Site0x007 Documentation