I Stopped Writing Code and You Can Too: 11 AI Code Gen Hints.
2024-8-5 21:50:38 Author: hackernoon.com(查看原文) 阅读量:0 收藏

Hint 1: If you have a creative task such as code architecture, you want to use the 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 writing a good prompt, as if you were 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 the 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 files, 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, and 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.


Thanks for reading my post! 🙂

I write about making startups as a solo founder on my 𝕏 and email newsletter. Follow those if you want to learn how to build SaaS and web apps and market them.


文章来源: https://hackernoon.com/i-stopped-writing-code-and-you-can-too-11-ai-code-gen-hints?source=rss
如有侵权请联系:admin#unsafe.sh