Debugging is the most frustrating part of AI coding. But it can be...

@cjzafir
CJ Zafir@cjzafir
47 views Apr 09, 2025 ~3 min read
Advertisement
1
Debugging is the most frustrating part of AI coding.

But it can be solved if you build a strong "wall of context" around AI models.

Here's how you can fix debugging in Cursor/Windsurf: ↓
Media image
2
If you say "build me a spotify like app" and you expect AI to code the entire frontend and backend in 1 prompt. That's not possible.

AI models can output limited code in 1 request.

Also, AI models are not perfect they have 2 limitations:
1. AI hallucinations
2. Context window
3
So, first you need to provide deep context about your idea in the form of a context boundary around AI models.

To build this boundary, you need to turn your plain english idea into a set of coding docs:

1. Project Requirement Document (PRD)
2. App Flow Doc.
3. Tech Stack Doc.
4. Frontend Guidelines
5. Backend Structure

These 5 docs are your core docs. Let's expand them:
Media image
4
1. Project Requirement Document

Don't let AI assume anything. Provide all the information yourself.

PRD is a core blueprint for AI models, It provides:
- Overview
- Target Audience
- User flow
- Tech Stack
- Core Features
- Scope of Work

Let's now add more specific docs to guide AI on each step.
0:22
5
2. App Flow Document

Think of it like you're explaining your project to a friend.

"when user will sign up, it lands on dashboard. On dashboard it has 4 sections. Left sidebar, Analytics section, etc"

This doc provides a complete end-to-end rundown of your app.

TIP: Ask AI to DO NOT use bullet points in this doc.

This Document is very important as it creates a graph for AI to plan its execution for each page.
0:12
6
3. Tech Stack Document

Now let's provide technical context to AI.

Is your project using python? or Nextjs? or what are you using for backend: Supabase? or Firebase?

This doc will explain every single detail about the stack AI need to use to build your app.

Make sure you only use popular tech stacks, because LLMs like Claude, GPT or gemini are trained on vastly adapted frameworks.
0:17
7
4. Frontend Guidelines

To make sure AI follows a consistent styling. This document is important.

It should mention
- Frontend stack
- what UI libraries to install.
- Color palette
- Fonts

Plus it should also instruct AI about loading speed, performance optimization.
0:23
8
5. Backend Structure

A document that explains your schema, tables and policies.

It contains all database tables that you need to create, storage buckets and user information tables (auth)

I use Supabase beacause AI can create SQL queries that you can run in Supabase in seconds.

And this way I can create my database in an hour and attach it to my frontend.
0:27
9
After you attach the coding docs.

Now you need AI to provide an implementation plan so AI can code your app end to end.

If you let AI plan its own steps. It can start hallucination than starts a disaster.

AI can enter the vicious error cycle later on.

Where it can create duplicate files, save files in wrong place, or even delete finished code.

Write a detailed 50-step implementation plan to fix this.
0:38
10
I use @CodeGuidedev to generate all my coding docs.

Now it also creates a security document to make my app secure by default.

Write your idea in plain english and in 5 steps you can download a set of coding documents that you can use with any AI coding tool.
0:09
11
TL;DR

AI models will hallucinate if you don't provide deep context about your project.

Use @CodeGuidedev to generate coding docs:
1. Project Requirement Document (PRD)
2. App Flow Doc.
3. Tech Stack Doc.
4. Frontend Guidelines
5. Backend Structure
6. Implementation plan
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • LinkedIn & Instagram Carousel Maker
Create Free Account

Includes 7-day Premium trial

Advertisement