What Makes a Good Prompt?
If you’ve spent any time with ChatGPT, Claude, or another LLM, you’ve probably noticed that how you ask matters as much as what you ask. A vague prompt gets a vague answer. A specific, well-structured prompt gets something you can actually use.
This isn’t magic – it’s just communication. The same way you’d give a colleague clear instructions instead of saying “fix the thing,” you need to give an AI model enough context to do its job well.
The Anatomy of an Effective Prompt
Every good prompt has four components, whether you spell them out explicitly or not:
Role. Tell the model who it should be. “You are a senior backend engineer” produces different output than “You are a technical writer.” The role sets the tone, vocabulary, and depth of the response.
Context. Give the model the background it needs. What language are you using? What framework? What’s the codebase like? What have you already tried? The more relevant context you provide, the less the model has to guess.
Task. Be specific about what you want. “Review this code” is okay. “Review this code for SQL injection vulnerabilities, focusing on user input handling” is much better. Clear tasks produce focused answers.
Format. Tell the model how you want the output structured. “Return a markdown table,” “Give me a bulleted list of issues sorted by severity,” “Write the response as a Git commit message.” Format instructions prevent you from having to reformat the output yourself.
You don’t always need all four explicitly. For simple questions, context and task are enough. But when you’re getting mediocre results, adding role and format constraints almost always helps.
Why Templates Save Time
Most developer interactions with AI follow predictable patterns. You’re reviewing code, debugging an error, writing tests, or drafting documentation. The structure of these prompts doesn’t change – only the specific code, error message, or feature description does.
That’s where templates come in. Instead of writing a prompt from scratch every time, you grab a template, swap in your specifics, and go. It’s faster, and it’s more consistent. You won’t forget to ask for edge cases in your test prompt because the template already includes that instruction.
The templates on this page use {{placeholders}} to mark where you should insert your own content. Replace the placeholder (including the curly braces) with your actual code, error message, or description.
Tips for Getting Better Results
Be specific about what you don’t want. “Don’t include explanations, just give me the code” or “Skip the boilerplate, I only need the core logic.” Exclusions are surprisingly effective at tightening up responses.
Include examples when possible. If you want output in a specific format, show the model an example. One concrete example beats a paragraph of description.
Iterate, don’t restart. If the first response isn’t quite right, refine your prompt in the same conversation. “That’s close, but make the error messages more specific” is faster than rewriting the whole prompt.
Set constraints. “Keep it under 50 lines,” “Use only standard library functions,” “Target Python 3.10+.” Constraints force the model to make practical tradeoffs instead of giving you the kitchen sink.
Use the right model for the job. Complex architecture decisions and nuanced code review benefit from larger models. Simple formatting tasks and boilerplate generation work fine with smaller, cheaper ones. Don’t burn tokens on tasks that don’t need them.
Common Prompt Mistakes
Being too vague. “Write me a function” tells the model almost nothing. What language? What inputs? What should it return? What edge cases matter?
Dumping too much context. There’s a sweet spot. Pasting your entire 2000-line file when the bug is in one function just dilutes the model’s attention. Extract the relevant section and mention the broader context briefly.
Not specifying the output format. If you don’t say what format you want, you’ll get whatever the model defaults to – which might be a 500-word essay when you wanted a three-line code snippet.
Ignoring the system prompt. If you’re using the API, the system prompt is your most powerful tool. It persists across the conversation and sets baseline behavior. Use it for role, style, and constraints that apply to every message.
Asking multiple unrelated questions at once. “Review this code, also explain how OAuth works, and write me a Dockerfile” is three separate tasks. Split them up for better results on each one.
How to Use This Library
Browse prompts by category using the filter buttons, or type a keyword in the search box. Click any prompt card to expand it and see the full template. Hit the Copy button to grab it, then paste it into your AI tool of choice and replace the {{placeholders}} with your actual content.
Every prompt here has been tested across multiple models and refined based on the quality of output it produces. They’re starting points – feel free to modify them to fit your workflow.