AI Prompt Library
AI Programming Prompts
8 original prompts for the coding tasks developers do daily — review, debugging, documentation, refactoring, testing. Copy, fill in the brackets, and use in ChatGPT, Claude or Gemini.
Code Review Checklist
Review this code: [paste code]. Check for: logic errors, edge cases not handled, naming clarity, unnecessary complexity, and potential security issues. List findings by severity (critical / minor / style), and explain why each one matters, not just what to change.
Tip: Paste the surrounding function/class for context — reviewing an isolated snippet without context produces less useful feedback.
Bug Diagnosis Assistant
I am seeing this error/behavior: [describe the bug]. Here is the relevant code: [paste code]. List the 3 most likely causes ranked by probability, and for each one, tell me exactly what to check or log to confirm or rule it out.
Tip: Include the actual error message and stack trace verbatim — paraphrasing errors loses diagnostic detail.
Function Documentation Writer
Write documentation for this function: [paste function]. Include: a one-line summary, parameter descriptions with types, return value description, and one edge case worth noting. Match the docstring style of [language, e.g. Python/JSDoc/PHPDoc].
Tip: Specify the exact docstring format (JSDoc, PHPDoc, Google-style Python, etc.) so it matches your codebase conventions.
Refactor for Readability
Refactor this code for readability without changing its behavior: [paste code]. Explain each change and why it improves readability. Do not introduce new dependencies or change the function signature unless necessary — flag if you think a signature change would genuinely help.
Tip: Always run existing tests after refactoring — "readability improvements" can silently introduce behavior changes.
Unit Test Generator
Write unit tests for this function: [paste function] using [testing framework, e.g. Jest/PHPUnit/pytest]. Cover: the normal/happy path, at least 2 edge cases, and one invalid-input case. Explain what each test verifies in a one-line comment.
Tip: Ask it to list edge cases it considered but did NOT write tests for — sometimes the gaps are more useful than the tests themselves.
SQL Query Explainer
Explain what this SQL query does in plain English, step by step: [paste query]. Then flag any parts that look inefficient (missing indexes, unnecessary subqueries, N+1 patterns) or potentially risky (missing WHERE clause on UPDATE/DELETE).
Tip: Always double-check flagged risky patterns manually before running any suggested fix against production data.
API Error Handling Reviewer
Review this API integration code: [paste code]. Check whether it handles: network failures, timeout, non-200 responses, malformed response bodies, and rate limiting. For anything missing, suggest the specific handling code needed.
Tip: Pay special attention to what happens on partial failure (e.g. request succeeds but response is malformed) — this is the most commonly missed case.
Code-to-Plain-English Explainer
Explain what this code does in plain English, as if explaining to a product manager with no coding background: [paste code]. Avoid technical jargon where possible, and describe the business logic/outcome, not the implementation mechanics.
Tip: Ask for a second version aimed at a technical audience if you also need the implementation-level explanation.
FAQs
Frequently asked questions
Should I trust AI-generated code review/bug diagnosis completely?
No — treat it as a fast first pass. Always verify suggestions against your actual codebase and test before merging or deploying.
Which AI model is best for these prompts?
Most current-generation models (Claude, GPT-4-class, Gemini) handle these well. Model choice matters less than giving enough code context in your prompt.
Can you build custom AI developer tools for our engineering team?
Yes — we build AI coding assistants, automated code review tools and internal developer platforms. Get in touch to discuss your stack.
Keep Exploring
Related Resources
Need a Custom AI Solution?
If your team could use AI-assisted code review, automated testing, or internal developer tools, we build those systems.