Every developer I know has had this experience: you open ChatGPT or Claude, type "write me a function to parse dates", and get back something so generic it's almost useless.
The problem isn't the AI — it's the prompt. Vague input, vague output.
After months of daily use, I've settled on a set of prompts that consistently get great results. Here are 10 of them, ready to copy and paste. Just swap the [brackets] for your specifics.
1. Write a clean function
Write a [language] function that [does X].
Use type hints, handle edge cases, and add a docstring.
The magic words here are "handle edge cases" and "add a docstring". Without them you get a happy-path-only snippet with no docs.
2. Generate boilerplate fast
Generate a [framework] REST endpoint for [resource].
Include: input validation, error handling, and a usage example.
Works great for FastAPI, Express, Rails, Laravel. The "usage example" forces the AI to write something actually runnable.
3. Explain a bug (not just fix it)
Here is my code and the error I am seeing. Explain:
what is wrong, why it happens, and show the fix:
[paste code + error message]
Asking why it happens means you learn something instead of just copy-pasting a fix you don't understand.
4. Security review
Review this code for security vulnerabilities.
List each issue with severity (High/Med/Low) and remediation:
[paste code]
I run this on every piece of code that touches user input or auth. Catches things I'd miss at 2am.
5. Write a unit test suite
Write a complete unit test suite for the function below.
Cover: happy path, edge cases, and error cases. Use [Jest/pytest/RSpec]:
[paste function]
Specifying all three coverage types triples the quality vs just asking for "unit tests".
6. Generate a README
Write a README.md for [project name]. Sections:
overview, prerequisites, installation, usage examples, contributing.
Takes 30 seconds and produces a README better than 80% of what's on GitHub.
7. Refactor plan (without rewriting yet)
This code works but feels messy. Suggest a refactor plan:
what patterns to apply, what to extract, and why -- without rewriting it yet:
[paste code]
The "without rewriting yet" constraint is crucial — you want a plan first, not a wall of code to review blindly.
8. Conventional commit message
Write a conventional commit message for this diff.
Format: type(scope): description -- then a short body:
[paste diff]
Paste your git diff --staged output and get a perfect commit message in 2 seconds.
9. Regex with explanation
Write a regex that matches [pattern description].
Show: the regex, a token-by-token breakdown, 3 positive + 2 negative test cases.
The breakdown and test cases mean you actually understand what you're deploying.
10. CLI one-liner
Write a bash one-liner that [task description].
Annotate each part so I understand what it does.
Essential for those "I know bash can do this in one line but I can't remember how" moments.
The pattern behind all of these
Every prompt has specificity about format, specificity about what to include, and a constraint that forces quality (explain why, include edge cases, don't rewrite yet). Vague prompts get vague answers.
I compiled these plus 40 more into a 2-page cheat sheet you can keep open while you code — covering code generation, debugging, testing, docs, system design, git, and more.
Grab the full 50-prompt cheat sheet for $1: https://abrahamyan3.gumroad.com/l/eqgrme
Top comments (0)