Fix this error
I'm using [language/framework + version]. This code: [paste code] throws this error: [paste error] I expected it to [expected behaviour]. Explain the cause in plain words, then show the minimal fix.
Debug errors, understand unfamiliar code, write tests and learn new languages faster. Prompts for beginners and working devs.
13 original prompts · tap “fill in the blanks” to personalise, then copy · updated November 2026
I'm using [language/framework + version]. This code: [paste code] throws this error: [paste error] I expected it to [expected behaviour]. Explain the cause in plain words, then show the minimal fix.
Explain what this [language] code does, line by line, for someone who knows basic programming. Then summarise its purpose in 2 sentences and point out any bugs or risky parts. [paste code]
Write unit tests for this function using [test framework]. Cover normal cases, edge cases (empty input, very large values, invalid types) and errors. [paste function]
Refactor this code for readability without changing its behaviour. Use clear names, smaller functions and remove duplication. Explain each change briefly. [paste code]
Write a regular expression in [language] that matches [describe pattern] but not [counter-examples]. Explain each part and give 5 test strings with expected results.
Using [database, e.g. PostgreSQL], write a query that [what you need]. Tables: [paste table schemas]. Use parameterised placeholders for any user input, and explain the query.
I know [language I know] well. Teach me [new language] by comparing it to what I know: syntax, types, error handling, common libraries and gotchas. End with 3 small exercises.
Review this code like a senior developer. Comment on correctness, security, performance, readability and edge cases, ordered by importance. Suggest concrete fixes. [paste code]
Convert this [source language] code to idiomatic [target language], using standard libraries where possible. Point out any behaviour that differs between the two. [paste code]
I want to build [app idea] using [tech stack]. Break it into milestones, list the main components and data model, and suggest the order to build them in so I have something working after the first day.
I'm stuck in git: [describe the situation and paste `git status` output]. Explain what's going on and give me the safest commands to fix it, warning me before anything that could lose work.
Write clear documentation for this function: a one-line summary, parameters, return value, errors and a usage example, in [docstring style]. [paste function]
Give me a [easy/medium/hard] coding interview problem on [topic, e.g. arrays, graphs]. Wait for my solution in [language], then review its correctness and time/space complexity, and show an optimal approach.
AI coding assistants are most useful when you give them precise context: the language and version, the exact error message, the relevant code and what you expected to happen. The prompts below are structured to make you include that context, which is the single biggest factor in getting a useful answer.
Always read and test what the AI gives you. Generated code can use functions that don't exist, outdated APIs or insecure patterns — especially around authentication, SQL queries and file handling. Run it, write a test and ask the AI to explain any line you don't understand before it goes anywhere near production.
Never paste secrets — API keys, passwords, tokens, customer data — into an AI chat. Replace them with placeholders like YOUR_API_KEY. If you're working on your employer's code, check their policy on AI tools first.
Use responsibly: Use these prompts responsibly: only edit photos of yourself or people who've agreed, label AI-generated images when you share them, don't use AI to impersonate anyone or create fake documents, and check important facts — AI can be wrong.
It can scaffold a lot, but you'll still need to understand, test and fix the code. Build in small steps and test each one.
Treat it like code from a stranger on the internet: review it, test it, and check security-sensitive parts carefully.
Most leading assistants handle these prompts well; dedicated coding tools add features like reading your whole project.