Best AI Prompts for Developers
Prompts for the work around writing code: specifying, reviewing, debugging, testing and documenting decisions.
Most of a developer's day is not typing new code. It is reading someone else's, working out why something broke, deciding how a feature should be shaped and proving that a change is safe. These prompts are chosen for that work.
Each one asks for the inputs a careful colleague would ask for — the diff, the error, the constraints, the definition of done — and tells the model what it is not allowed to assume. Start with the code review and debugging prompts if you want to see the difference structure makes; move to the specification and schema prompts when the problem is still on a whiteboard.
All of them work in a chat assistant. The ones marked for Cursor are also written to be used inside a repository, where the model can read the surrounding files.
The prompts
Pull Request Code Review Prompt
Start here. Reviews a diff for correctness, security and maintainability, and separates blocking issues from preferences.
Bug Diagnosis Prompt
Works from the error, the code and what you have already tried, and asks for ranked hypotheses before any fix.
Technical Specification Prompt
Turns a feature idea into a specification with scope, interfaces, risks and open questions before code is written.
Unit Test Writing Prompt
Generates tests from behaviour and edge cases rather than mirroring the implementation line by line.
Behavior-Preserving Refactoring Prompt
Restructures code in small steps while holding behaviour constant, and states how to verify each step.
Relational Database Schema Prompt
Designs tables, keys and constraints from the entities and queries you describe, with trade-offs called out.
REST API Design Prompt
Shapes REST resources, status codes and error formats so the contract is settled before implementation.
React Component Prompt
Builds a React component or feature against explicit state, accessibility and styling requirements.
Next.js App Router Feature Prompt
Plans a Next.js App Router feature: what renders where, how data is fetched and what gets cached.
Python Script and Module Prompt
Writes a Python script or module to a stated specification, with input handling and failure cases covered.
JavaScript and TypeScript Function Prompt
Writes a JavaScript or TypeScript function to a specification, including types and edge-case behaviour.
Core Web Vitals Diagnosis Prompt
Diagnoses Core Web Vitals problems from the measurements you supply instead of listing generic tips.