Iterate - step 4

Errors and iteration - how to improve your app and handle problems

Iterate Towards Your Final Version

If you're still unsure of what file and folder is doing what, ask AI to break things down for you and explain what file is handling what thing and how they're working together. You could always refer back to your product specification document provided at the beginning to understand this better.

This awareness is needed for you to direct and orchestrate what AI should do and monitor its execution.

Communicate Effectively with AI

Best Practices:

  • Be specific: Don't only mention the edit you want, but tag the file and the path of where the edit should take place
  • Use relative paths: Right-click on the folder's name on the left-hand side and select "copy relative path"
  • Check at each stage: Make sure the app is still running, building and working fine
  • Monitor edits: Pay attention to the file and folders AI is editing to ensure it's not removing needed functionality

💡 Pro Tip:

Ask AI to leave comments within the code and log everything. This will help you identify what part of the code is responsible for what and help AI find the sections it needs to edit faster.

Create Checkpoints with Git

Push your app to your GitHub account at each stage to create yourself checkpoints.

Save your progress:

git add .
git commit -m "updated blah blah"
git push origin main

Mark working version:

git add .
git commit -m "Last Working Version"
git push origin main

When AI Gets Stuck

If AI gets stuck with something for more than a few prompts or feels like it's looping, use these strategies:

Strategy 1 - Learn from attempts:

"Learn from previous attempts and assumptions that have not worked previously and fix the issue."

Strategy 2 - Deep analysis:

"Do not make any assumption that you know where the problem is arising from. Study the entire [tag all related files], understand how these files are working together and carefully pinpoint the problem's origin."

When to Revert:

If the problem keeps persisting, instead of pushing ahead, revert back to where the problem didn't exist and start over from that checkpoint. You can scroll up to the point of conversation within the chat before the problem started and approve reverting the code to that point.

Better Logging & Error Handling

A good practice to use would be to ask AI to leave comments within the code and log everything. This will help you:

  • Identify what part of the code is responsible for what
  • Help AI find the sections it needs to edit faster
  • Communicate with AI when problems arise by passing the logs

❌ Don't Say:

"It doesn't work fix it."

✅ Instead Say:

"we are still having the same issues, please do a deep analysis instead of assuming you know the problem and solution and investigate related files to find the cause [tag related file], here are the logs: [pass the logs] "

You're Ready!

Congratulations! You now have the foundation knowledge to build and iterate on web apps with AI. Next, explore the other sections to learn about:

  • Architecture and file organization
  • Deployment to production
  • Using external APIs and services
  • Storage and authentication
  • Advanced resources and tools