DEV Community

Alexander Isora 🦄
Alexander Isora 🦄

Posted on

My 10 hints for AI coding

I stopped writing code entirely in 2024.

I only copy-paste code generated by AI ✌️🤓 Here are my 10 hints (based on real AI coding experience).

Hint 1: if you have a creative task such as code architecture, you want to use so called chain of thoughts. You add "Think step-by-step" to your prompt and enjoy a detailed analysis of the problem.

Hint 2: create a Project in Claude or a custom GPT and add a basic explanation of your code base there: the dependencies, deployment, and file structure. It will save you much time explaining the same thing and make AI's replies more precise.

Hint 3: if AI in not aware of the latest version of your framework of a plugin, simply copy-paste the entire doc file into it and ask to generate code according to the latest spec.

Hint 4: One task per session. Do not pollute the context with previous code generations and discussions. Once a problem is solved, initiate a new session. It will improve quality and allow you to abuse "give full code" so you do not need to edit the code.

Hint 5: Use clear and specific prompts. The more precise and detailed your request, the better the AI can understand and generate the code you need. Include details about the desired functionality: input/output type, error handling, UI behaviour etc. Spend time on writing a good prompt like if you were spending time explaining your task to a human.

Hint 6: Break complex tasks into smaller components. Instead of asking for an entire complex system at once, break it down into smaller, manageable pieces. This approach teaches you to keep your code (and mind!) organized 👍

Hint 7: Ask AI to include detailed comments explaining the logic of the generated code. This can help you and the AI understand the code better and make future modifications easier.

Hint 8: Give AI code review prompts. After generating code, ask the AI to review it for potential improvements. This can help refine the code quality. I just do the laziest possible "r u sure?" to force it to check its work 😁

Hint 9: Get docs. Beyond just inline comments, ask the AI to create documentation for your code. Some README file, API docs, and maybe even user guides. This will make your life WAY easier later when you decide to sell your startup or hire a dev.

Hint 10: Always use AI for generating database queries and schemas. These things are easy to mess up. So let the AI do the dull work. it is pretty great at composing things like DB schemas, SQL queries, regexes.

Hint 11: Understand the code you paste. YOU are responsible for your app, not the AI. So you have to know what is happening under your startup's hood. if AI gives you a piece of code you do not understand, make sure you read the docs or talk to AI to know how it works.


Based on my viral tweet: https://x.com/alexanderisorax/status/1819671375759487270

Top comments (0)