Generating working code.
HOW TO ASK
"Write [what] in [language]. Requirements: [list]. Include error handling. Comment anything non-obvious. Flag anything I should review for security."
That last instruction is worth including always.
WHAT TO SPECIFY
The language and version What it must handle What it must not do Whether it runs once or repeatedly What happens on failure
WHAT GENERATED CODE COMMONLY MISSES
Error handling Input validation
Edge cases: empty input, very large input, unexpected types
Cleanup on failure
FOR SCRIPTS THAT CHANGE THINGS
"Include a dry-run option that shows what it would do without doing it."
Then run the dry run first, always.
WHAT TO NEVER DO
Run generated code against production data without understanding it Run anything against a live site without a backup
FOR DATABASE WORK
Never run a generated UPDATE or DELETE without first running the equivalent SELECT.