The Build Process
4.1: The Context Pyramid
AI needs massive context before writing code, unlike a human developer who already has context in their head. Your effectiveness depends on how well you build this context layer by layer.
/\ 1. USER RULES
/ \ (identity + guardrails)
/ \
/------\ 2. CODEBASE STRUCTURE
/ \ (architecture context)
/----------\
/ \ 3. SPECIFIC FILES
/ \ (implementation details)
/----------------\
/ \ 4. RESEARCH + DOCS
/ \ (external knowledge)
/--------------------\
/ \ 5-7. WRITE, TEST, FIX
/________________________\ (implementation loop)Each layer builds on the one above. You can't effectively write code (5) without research (4), and you can't research effectively without understanding the codebase (2-3).
4.2: The 7 Steps
Your .cursorrules file sets AI's identity and guardrails. This is the foundation. Start every session with: "Read and understand user rules."
Let AI understand your project's architecture before diving in. "Read the project structure. Understand the folder organization, key dependencies, and overall architecture."
Point AI to the exact files relevant to your task. "Read src/services/AuthService.ts and src/utils/validation.ts. Understand how authentication currently works."
Before writing code, have AI research documentation. "Research the NextAuth.js docs for credential providers. Look up best practices for password hashing."
Now -- and only now -- write implementation code alongside tests. Never write code without tests. Never write tests without code.
Execute tests and compile to validate. npm run test && npm run build && npm run lint
When tests fail, paste the error log back to AI. Fix. Re-run. Repeat until green, then commit.
4.3: The Session Initialization Prompt
This single prompt sets up an entire development session properly:
Read and understand user rules, research each for complete understanding.
Ask me any clarifying questions before starting.
Make todos of all tasks, use high IQ strategy for safety and
correctness as you create and order each. Add todos for testing
all code changes. Research documentation and best practices online.
Don't start coding yet.This prompt forces AI to understand context, ask questions to prevent hallucination, and create a plan -- all before writing a single line of code. It mirrors the planning discipline from Module 2.
4.4: The Execution Prompt
Once the plan is ready:
Continue todos, do each comprehensively.
Build, test, and write AND run test scripts, then fix and repeat
until all tests pass.
Short commit message once individual todos are complete.This separates planning from execution. Two distinct phases, just like the overall vibecoding approach.
4.5: The Development Loop
Steps 5-7 form a tight loop that repeats for each task:
Write code + tests
|
v
Run tests + build
|
Pass? --yes--> Commit & next task
|
no
|
v
Read error logs
|
v
Fix (or Oneshot restart -- Module 6)
|
v
Run tests + build (again)When this loop gets stuck -- when the same error keeps appearing or you've been going in circles -- that's when you reach for the tools in Modules 6 and 7.