Hey everyone! I've been getting some feedback about my coding projects, both in school and at work, that I'm not providing enough detailed comments and documentation. I want to improve in this area. While I know I can ask for input from those reviewing my work or check out style guides, I feel like there's a lot of variability based on personal preferences and industry standards.
So, I had this idea: what if I run my existing code through an AI tool? I could provide context on who the documentation is for and see how the AI generates comments and documentation files. I've noticed that different models produce varying lengths and styles of comments (like DeepSeek being concise while OpenAI gives more detailed responses). I'm curious to know which AI tools you think work best for this purpose. Thanks beforehand for your insights!
6 Answers
AI-generated comments often merely explain the code's lower-level functions, which is useful for teaching, but in the real world, effective documentation dives into why the code is implemented a certain way. For instance, instead of 'strip special characters', a meaningful comment provides context: 'I need to strip characters because the input from the UI sometimes includes unwanted symbols.'
I get your intention, but I really think you should just focus on commenting manually. Comments are meant for you and other developers to understand your logic. AI tools might generate overly simplistic comments that could miss the nuances needed for real-world coding. For example, they might just say something generic like 'Set variable to array' instead of what you actually need to convey about why that code exists in the first place.
Honestly, none of the AI models will give you what you really want. Trust your own instincts and learn to write meaningful comments. Use your brain to develop your understanding of what the code is actually doing rather than relying on AI.
Honestly, relying too much on AI might not be the best path. You could be skipping valuable learning opportunities. The skill of writing good comments and documentation comes with practice, and doing it yourself will make you more proficient in the long run.
Using an AI isn't the best method to learn. Take the time to find a well-documented codebase and study it. You can see how to articulate why certain decisions were made rather than just what the code does at face value.
The effectiveness of AI tools for comments really hinges on how you instruct them. If you give them vague instructions, you won't get great results. You could ask an AI to help you frame your prompts around your specific needs, referencing examples of good and bad comments, or even better, ask it to teach you how to improve your own commenting skills.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically