Trick

Comment-driven code generation

coding · works with Any model · via dair-ai/Prompt-Engineering-Guide

The prompt

/*
Ask the user for their name and say "Hello"
*/

Expected result

A working code snippet that prompts for a name and prints a greeting — generated purely from a comment describing the intent.

Why it works

Demonstrates comment-driven code generation: a plain comment describing intent is often enough on its own, without an explicit "write code that does X" instruction — useful as an inline pattern inside an actual codebase or IDE autocomplete.

Open in PrompVite to copy, rate, and discuss this prompt →