Good developers do not memorise everything – they know how to ask. Whether you are reviewing a pull request at 5pm on a Friday, chasing a Heisenbug through a legacy codebase, or writing documentation you have been postponing for three sprints, the right prompt turns an AI assistant into a tireless pair programmer.
Below are 30 ready-to-copy AI prompts for developers, grouped into six sections: code review, debugging, documentation, refactoring, testing and SQL. Each one is written to be pasted straight into ChatGPT, Claude or your IDE’s AI assistant – just replace the bracketed placeholders with your own code and context. They are language-agnostic, but the examples lean towards the stacks most European teams use daily: TypeScript, Python, Java, PHP and Go.
How to get the best results from these prompts
- Paste real context. Include the relevant code, the error message, the framework version and what you have already tried. Vague input produces vague output.
- Set the role. Prompts that begin “Act as a senior [language] developer…” consistently produce sharper answers.
- Iterate. Treat the first answer as a draft. Follow up with “Now consider thread-safety” or “Simplify this for a junior to maintain”.
- Never paste secrets. Strip API keys, credentials and personal data before sending code to any cloud AI tool – a must under GDPR if customer data is involved.
Code review prompts
1. The thorough reviewer
“Act as a senior TypeScript developer doing a code review. Review the following pull request diff for bugs, security vulnerabilities, performance issues and maintainability. Rate each finding as critical, major or minor, and suggest a concrete fix with code for each. Here is the diff: [paste diff]”
Use before requesting human review – it catches the embarrassing issues first.
2. The security sweep
“Audit this [language] code specifically for security flaws: injection attacks, authentication and authorisation gaps, insecure data handling, and dependency risks. Reference the OWASP Top 10 where relevant: [paste code]”
Essential for anything touching payments, health data or personal information.
3. The readability check
“Review this code as if the maintainer will be a junior developer joining the team next month. Flag unclear naming, missing error handling, magic numbers and overly clever constructs. Rewrite the worst section for clarity: [paste code]”
Great for teams in scale-ups where onboarding speed matters.
4. The performance audit
“Analyse this function for performance bottlenecks. Identify the time complexity, unnecessary allocations, N+1 query patterns and blocking calls. Propose an optimised version and estimate the improvement: [paste code]”
Run it on endpoints your monitoring flags as slow.
5. The API design critique
“Critique this REST API design for consistency, naming, versioning, error responses and idempotency. Compare it against widely accepted REST conventions and suggest improvements: [paste OpenAPI spec or endpoints]”
Useful before publishing an API that partners – or German enterprise clients – will integrate with.
Debugging prompts
6. The structured debugger
“I have a bug: [describe expected vs actual behaviour]. The error is: [paste full error and stack trace]. The relevant code: [paste code]. I have already tried: [list attempts]. Walk me through your diagnosis step by step, then propose the most likely fix.”
The structure forces you to organise your thoughts – half the time you spot the bug while writing it.
7. The minimal reproducer
“Help me create a minimal reproducible example for this bug. Here is the failing scenario: [describe]. Strip away everything unrelated and give me the smallest script that still triggers it: [paste code]”
Perfect before filing an issue on GitHub or asking on Stack Overflow.
8. The log whisperer
“Analyse these application logs and identify the root cause of the failure. Correlate timestamps across the entries, highlight the first anomaly, and distinguish the root cause from cascading symptoms: [paste logs]”
A lifesaver during on-call incidents at 2am.
9. The race-condition hunter
“This concurrent [language] code behaves non-deterministically under load. Examine it for race conditions, deadlocks, shared mutable state and incorrect synchronisation. Explain the exact interleaving that causes the failure: [paste code]”
Concurrency bugs are where AI’s patience for tracing interleavings really shines.
10. The regression detective
“This feature worked in release 2.4 but broke in 2.5. Here is the relevant code from both versions: [paste before/after]. Identify which change introduced the regression and explain the mechanism.”
Pair with your git history for fastest results.
Documentation prompts
11. The README generator
“Write a professional README for this project: overview, features, prerequisites, installation steps, configuration, usage examples, API reference summary, testing instructions and contributing guidelines. Target audience: developers evaluating the project on GitHub. Project details: [describe, paste key files]”
12. The docstring writer
“Add comprehensive docstrings to every public function and class in this [language] file, following [Google/NumPy/JSDoc] conventions. Document parameters, return values, raised exceptions and include a short usage example for the main entry points: [paste code]”
13. The onboarding guide
“Write a developer onboarding guide for this repository: architecture overview, how the main components interact, how to run it locally, how to run tests, the branching and release workflow, and where to find things. Assume the reader is experienced but new to this codebase: [paste structure/readme]”
New hires in your Berlin or Amsterdam office will thank you.
14. The changelog summariser
“Turn these commit messages from the last sprint into a clear, user-facing changelog grouped by Added, Changed, Fixed and Deprecated. Write for non-technical stakeholders: [paste commits]”
15. The architecture explainer
“Explain the architecture of this system in plain language for a product manager: what each service does, how data flows between them, and where the main failure points are. Then give me a Mermaid diagram of it: [paste overview or key files]”
Refactoring prompts
16. The legacy moderniser
“Refactor this legacy [language] code to modern idioms and standards ([version]). Preserve exact behaviour, improve readability, remove deprecated patterns, and list every behavioural assumption you made: [paste code]”
Always run your test suite after – AI confidence is not a substitute for green tests.
17. The function splitter
“This function is [X] lines long and does too many things. Break it into small, well-named functions with single responsibilities. Show me the refactored code and explain your decomposition decisions: [paste function]”
18. The duplication eliminator
“Find duplicated logic across these files and extract it into shared, well-named abstractions. Show the before and after, and flag any duplication that is coincidental rather than genuine: [paste files]”
19. The framework migrator
“We are migrating from [old framework/version] to [new framework/version]. Convert this code, flag APIs that no longer exist or changed semantics, and note anything that needs manual attention: [paste code]”
20. The naming improver
“Rename the variables, functions and classes in this code to be intention-revealing, following [language] naming conventions. Keep the public API unchanged. Return the full renamed file: [paste code]”
Small prompt, surprisingly large impact on maintainability.
Testing prompts
21. The test generator
“Write thorough unit tests for this [language] code using [pytest/JUnit/Jest]. Cover happy paths, edge cases (empty inputs, nulls, boundary values), and error conditions. Aim for meaningful assertions, not just coverage theatre: [paste code]”
22. The edge-case brainstorm
“List every edge case and failure mode you can think of for this function: unusual inputs, concurrency issues, timezone and locale traps, integer overflows, and resource exhaustion. For each, say whether the current code handles it: [paste code]”
European developers: explicitly ask about locale traps – comma decimals, DD/MM/YYYY dates and UTF-8 names like “François Müller” break more code than you’d think.
23. The integration test planner
“Design an integration test plan for this feature: test scenarios in priority order, required test data and fixtures, what to mock vs what to run for real (database, message queue, third-party APIs), and how to keep the suite fast: [describe feature]”
24. The flaky test investigator
“This test passes inconsistently. Analyse it for timing dependencies, shared state, test-ordering assumptions, randomness and external dependencies. Propose a deterministic rewrite: [paste test]”
25. The coverage critic
“Here is my test suite and the code it covers: [paste both]. Identify untested branches, weak assertions that would pass with wrong behaviour, and tests that duplicate each other. Suggest the five highest-value tests to add.”
SQL and database prompts
26. The query optimiser
“Optimise this SQL query for PostgreSQL. Analyse the execution plan implications, suggest indexes (with CREATE INDEX statements), rewrite inefficient joins and subqueries, and estimate the performance gain: [paste query and table sizes]”
27. The schema reviewer
“Review this database schema for normalisation issues, missing indexes, poor data type choices, absent constraints and scalability concerns. Suggest concrete improvements with migration SQL: [paste DDL]”
28. The query explainer
“Explain what this SQL query does in plain English, step by step, including what each join and subquery contributes. Then tell me what business question it answers: [paste query]”
Invaluable when inheriting someone else’s 200-line reporting query.
29. The migration planner
“Plan a zero-downtime migration for this schema change on a table with [X] million rows: the migration steps in order, how to backfill data safely, how to verify consistency, and the rollback plan if something goes wrong: [describe change]”
30. The ORM translator
“Convert this raw SQL into idiomatic [Django ORM / SQLAlchemy / Prisma / Eloquent] code, and separately convert this ORM query back into the SQL it generates so I can check its efficiency: [paste query]”
5 habits that make AI prompts work harder
- One job per prompt. “Review, fix, document and test this” produces mediocrity in all four. Chain focused prompts instead.
- Demand reasoning. Add “explain your reasoning before giving the answer” for anything subtle – it measurably improves accuracy.
- Constrain the output. “Answer in under 200 words with code only” beats wading through essays.
- Provide counter-examples. “Here is a fix I rejected and why: […]” steers the model away from dead ends.
- Verify against reality. AI-generated code gets compiled, tested and reviewed like any other code – no exceptions, however plausible it looks.
Conclusion
These 30 prompts cover the unglamorous majority of a developer’s week: the reviews, the debugging sessions, the documentation and the tests. Save the ones that fit your workflow, adapt the placeholders to your stack, and you will feel the difference within days. And if you want to compare the assistants you will be pasting these into, read our comparison of the best AI coding assistants. For a lighter read, our prompt pack for HR and recruiters shows how the same prompting principles work outside engineering.