Skip to content
SPEN10
All posts

The AI Coding Prompts I Reuse Every Week

A copy-paste library of AI coding prompts for planning, explaining, reviewing, debugging and cleaning up code. Save them once and reuse them every week.

7 min read

A man in a light blue shirt writing notes in a notebook next to his laptop, against an orange wall
Photo by Startup Stock Photos on StockSnap

After building for a while with AI, you notice you keep typing the same kinds of requests. "Plan this before you code it." "Explain what this does." "Check this before I ship it."

So stop retyping them. Keep a small library of prompts that already work, paste them in when you need them, and fill in the blanks. This post is that library: the AI coding prompts I'd put in a note on day one, grouped by what you're trying to do.

They work with any AI coding assistant. The wording isn't magic. What makes them work is that each one tells the AI what to do, what not to do, and what to give back.

If I had to keep just one, it'd be the planning prompt: "Don't write any code yet. Ask me questions, then give me a short plan." The other habit I never skip is how I start and end each session. I've put both of those at the end of this post.

How to use a prompt library

Keep these somewhere you can grab them in two seconds: a notes app, a text file in your project, or your editor's snippets. Anything in <angle brackets> is a blank for you to fill in.

Many AI coding tools also let you save reusable instructions or custom commands. If yours does, put your favorites there. Either way, the habit is the same: don't start from a blank box.

Plan Explain Review Debug Clean up before code while learning before commit when it breaks once it works one prompt for each stage of a feature
The library follows the life of a feature, from planning it to tidying it up.

1. Plan before any code

The single most useful prompt. It stops the AI from charging off and writing 400 lines based on a guess.

I want to add <feature>. Don't write any code yet.
First, ask me any questions you need answered.
Then give me a short plan: which files you'd change, what you'd add,
and anything that could go wrong. Keep it to steps I can check one at a time.

For bigger features, pair it with a proper brief. I walked through how to write one in how to write a project brief your AI assistant can actually follow.

2. Explain it like I'm smart but new

For when the AI did something and you have no idea what it means.

Explain what <file or function> does, in plain language.
Assume I'm smart but new to programming. Walk through it step by step,
and define any technical terms the first time you use them.
Then tell me the one thing most likely to break here.

That last line is a bonus: it turns an explanation into something you can actually act on.

A close cousin, for learning a concept rather than a file:

I keep seeing "<term>". Explain what it is with a real-world analogy,
then show the smallest example of it in this project.
A laptop showing code on a white desk, with a notebook, pen and phone beside it
Photo by Negative Space on StockSnap

3. Review before you commit

Ask the AI to check its own work, but with fresh eyes and a specific checklist.

Review the changes we just made as if you were a careful senior developer
seeing them for the first time. Look for: bugs, edge cases we didn't handle,
security problems (secrets, missing auth checks, unvalidated input),
and anything that was changed but didn't need to be.
List problems first, most serious first. Don't fix anything yet.

"Don't fix anything yet" matters. You want to see the list and decide, not watch it rewrite half the project. After the review, I commit the good version (the commands are in Git for non-developers).

4. Debug: causes before fixes

When something breaks, paste the full error and use this:

Here's what I did, what I expected, and what happened instead:
<steps> / <expected> / <actual>
Full error:
<paste it>
Don't change any code yet. List the most likely causes, ranked,
and tell me how we could check which one it is.

And for when you've gone round in circles:

We've tried several fixes and none worked. Stop and summarize:
what we know for sure, what we've ruled out, and what we haven't checked.
Then suggest one small experiment to narrow it down.

Both come from the patterns in when AI gets it wrong: debugging with an assistant.

5. Clean up once it works

Working code isn't always tidy code. Once a feature is done and committed, this keeps things from turning into spaghetti:

This works, and I don't want to change what it does.
Suggest small cleanups to make it easier to read and maintain:
duplicated code, confusing names, overly long functions.
One change at a time, smallest first. Explain each before making it.

The key phrase is "I don't want to change what it does." It tells the AI this is tidying, not a rewrite.

Bonus: start and end every session the same way

AI assistants don't remember your last session unless something tells them. So I bookend every session with the same two prompts.

At the start, I ask the AI to catch up before we do anything new:

What did we do last time? Did we have anything else planned
for this session?

That only works if there's something to catch up from, which is what the end-of-session prompt is for.

At the end, I have the AI write everything down in the project's info files (a README, a notes file, or whatever instructions file your AI tool reads at the start of a session), and I add my own plans and comments for next time:

Update the project info files with what we did this session.
Also add these plans and notes for next session:
<anything you want to remember or do next>

Next session, the first prompt picks all of that up. It takes a minute at each end, and it means you never start from scratch.

Make the library yours

These are a starting point. The best prompt library is the one you build from your own projects: every time a prompt gets a great result, save it. Every time one goes sideways, tweak it.

If you want the thinking behind why these work, the prompting guide goes deeper on the patterns. But honestly? Copy, paste, fill in the blanks. That's most of it.

— Spencer

Share this post

Found this useful?

Get the next one in your inbox. No spam, unsubscribe anytime.