Story

Ask HN: Prompt engineering for LLMs to generate beginner friendly code

mguerville Tuesday, October 29, 2024

I have spent some time over the past few years learning how to code a bit, simply out of curiosity and as a hobby. In the past two years LLMs have allowed me to start actually producing code (usually python or bash scripts) to do useful tasks for work (strategy type role) or personal use but whenever I try to push a bit more towards a fuller solution I inevitably end up with code I struggle to understand (and rarely works as I iterate with the LLM to add or modify various aspects of it).

Are there things HN would recommend i add to my prompts to produce code that’s more easily readable and modifiable by a beginner tinkerer? I usually ask for heavy commenting, docstrings, and to write in a way a beginner could read the code; but are there other/better snippets to insert in my prompts to tailor the output to my needs.

4 3
Read on Hacker News Comments 3