glunty

AI prompt library / Coding and debugging prompts

Coding and debugging prompts

Prompts that make AI a better pair programmer: understand code, find bugs, and write tests, without pasting your whole codebase. Fill in the brackets and paste into any AI tool.

Understand

Explain this code

Explain what this code does, step by step, and point out anything surprising or risky: [paste code].

Why it works: Faster than reading unfamiliar code line by line yourself.

Explain an error

I got this error: [paste]. Explain in plain English what it means, the likely cause, and 2 things to check first.

Why it works: Turns a wall of stack trace into a short list of next steps.

Fix and improve

Targeted debug

This code is not doing [expected]. Here is the code and what happens: [paste]. Do not rewrite everything; find the smallest likely cause and suggest a targeted fix.

Why it works: The "smallest cause" instruction stops the AI from rewriting your whole file.

Code review

Review this function for bugs, edge cases, and readability. List issues by severity, most important first: [paste].

Why it works: A ranked list tells you what to fix first, not just a pile of nitpicks.

Write

Unit tests

Write unit tests for this function, including edge cases and one failure case. Use [test framework]: [paste].

Why it works: Edge cases and a failure case are the tests people forget to write.

Regex with an explanation

Write a regex that matches [describe]. Explain each part, and give 2 examples it matches and 2 it does not.

Why it works: The examples let you verify the regex without trusting it blindly.

More prompt packs

New to prompting? Read the setup guide for ChatGPT, Claude, and Gemini.

Embedded tool from glunty.com