⌨️ Key Prompts

In the previous edition of the AI Coding Club newsletter, I introduced a few examples of the prompts you can use to generate a Flask web app boilerplate.

AI-assisted coding



This week, I’ll share 5 key prompts and tactics you’ll leverage in every AI-assisted coding session.

1° “Please give me the fully adapted unredacted code, not missing a single line.”


😩The AI assistant can get lazy.

Sometimes, when requesting a refactor of a specific code section, the AI might exclude or comment out sections to save space in its response.

This can result in frustrating challenges, especially in lengthy JavaScript functions, where omitted parts might lead to syntax errors due to mismatched parentheses or braces.

2° “Use the Flask route below as a reference to create a new route…” / “Use the function below as a reference to create a new function…”

The AI assistant excels at repurposing a function or a route for another use case.

It’s a good practice to give it a reference. It helps the assistant stay consistent, for instance when it comes to connecting to the DB.

3° To fix an error, highlight the code causing the bug

The best way to solve an error reported by your Python server logs or the JS console is to give as much context as possible to the AI assistant.

Highlight the parts of your code causing the error when submitting the report to GitHub Copilot.

The more context you give the faster you’ll reach a relevant solution.

4° To generate a JS function calling the server, provide the code of the Flask route to your assistant

In order to get the best results when you’re asking the AI assistant to generate a JS function to call your server (GET or POST), share the Flask route you’d like to call.

If the purpose of the function is to show some result in the frontend, ask the AI to modify the route if needed to make sure that it returns the expected response.

If you want to pass specific arguments between the frontend and the server, be as specific as possible to ensure that the AI doesn’t omit any elements.

5° When the AI gets stuck, start a new conversation (with another agent)

If you find yourself in a cycle where the AI seems to fix one bug only to introduce another, consider starting a new conversation with a different agent.

This cycle can be frustrating, resembling a never-ending loop where the AI alternates between resolving and creating issues.

Just as you might seek a second opinion from another human, switch to a different AI assistant if you're not making progress.

For instance, if GitHub Copilot isn't resolving your issue effectively, try discussing it with ChatGPT.

If ChatGPT also reaches an impasse, initiating a new conversation can help eliminate any lingering biases from previous interactions, potentially leading to a fresh perspective and solution.

I hope those suggestions will help you optimize your AI-assisted coding sessions.

If you have any specific questions or need some coaching to dive into AI-assisted coding, don’t hesitate to reply to this email.

👨‍💻🤖Have fun coding with your AI assistant!

Frédérick

If you’d like to get a private introduction to the art of AI-assisted coding and more broadly a detailed overview of today’s Gen AI capabilities, I’m offering one-on-one 2-hour mentoring sessions “How To Talk To An AI Agent”.

Here’s the link for bookings.

Sessions are tailored to your specific business needs.

I can also assist you in the development of your own micro SaaS project.