AI Coding Development Tips
🧠 1. Think Strategically About Code
- Coding is a series of choices. Be deliberate in what you choose and why.
- For a given feature, generally understand the different ways of implementing the feature and the tradeoffs between the different implementations.
- Get as much familiarity as needed with the help of LLMs to figure out the best decision. It may take some trial and error (and restoring code).
- Understand what each part of the code is doing at a high level.
- This is fundamental in being able to
- Understand key concepts—like routing, middleware, cookies, client vs. server-side, etc.
- Be clear on whether your features should be implemented — client vs. server — it saves a ton of time.
- Don’t underestimate existing documentation! When this exists, read and understand it!! It will save you a lot of time.
- Avoid blindly asking Cursor to do or fix things. Treat Cursor more as a collaborator/sounding board instead of just as a tool that does things.
🛠 2. Use AI Tools as a Learning Partner
- Treat tools like Cursor or ChatGPT as learning assistants, not just code generators.
- Prompt it repeatedly until you understand what’s happening, then start fresh and implement it cleanly.
- Use chatbots to brainstorm, teach, and explain before diving in.
- For debugging errors, ask Cursor to ‘investigate thoroughly, explain clearly, and propose multiple solutions’ instead of ‘fix this error’.
🧪 3. Prompt Thoughtfully, Implement Carefully
- Do one thing at a time. Be specific in your prompts — limit scope. If you ask for a feature, specify only that, not extras.
- As soon as a feature is implemented, find a way to test it carefully.
- Provide Cursor with detailed context. Giving Cursor more information about the datatables, structures, and API outputs it is working with will significantly reduce the errors you will have to fix.
- Sample inputs/outputs
- Relevant code snippets
- Schema and table structure if using Supabase
- Validate results:
- Don’t blindly trust AI-written files — check that functions do what you expect.
- Avoid overwriting critical code.
💾 4. Be Intentional About Saving & Versioning
- Use GitHub to save good checkpoints — AI “restore” doesn’t always work.
- Commit often, especially before big changes or prompts.
⚙️ 5. Workflow for Feature Changes
These are recommended steps for implementing a new feature to your application.
STEP 1: Commit code (clean repo).
STEP 2: Define the feature.
STEP 3: Understand feature implementation (with llm support):
- What are choices for implementation? Which is best choice?
- Conceptually, what is user flow/interaction with this feature?
- If there is documentation to help with implementation, read and understand it!!
- What parts of stack involved (back-end, front-end, etc.)
- Which external APIs, libraries, tools
- Client vs. server-side?
STEP 4: Prompt Cursor to implement the feature
- If complex, break down feature implementation into smaller, testable steps.
- Include as much context as possible (schema, inputs, outputs, documentation links, files, folders).
STEP 5: Validate Cursor’s output.
- Review Cursor’s summary to confirm it implemented what you asked.
- Review files changed (and make sure they align with your expectations).
- Skim code changes and sanity check logic.
STEP 6: Test the implementation.
- UI: buttons, forms, flows
- If back-end: are Supabase tables updated as expected
STEP 7: Debug as needed.
STEP 8: Commit working changes.
STEP 9: Repeat with next feature.
🐛 6. Tips for Debugging
- Sometimes your best bet at fixing a bug is to read documentation, Stack Overflow, or Google Search! Cursor can’t fix all bugs.
- When you encounter a bug or error (especially for more complex ones where you don’t totally understand the underlying code), ask Cursor to ‘investigate thoroughly, explain what is going on, and what the choices for fixing the issue are’.
- Prompt Cursor to ‘add debugging print statements in areas where it will help understand the unerlying error’.
- Make sure Cursor doesn’t touch code that is not related to the bug you are fixing!
- If Cursor seems to get stuck, sometimes it’s helpful to really dive into high-level understanding of the code (instead of continuously trying to get it to fix the problem).
- Sometimes it helps to just restore your original code, step away for a little bit, come back with a prompt that synthesizes what you learned from the trial and error, and try again.