Creating Reusable Prompts in Claude
I’ve been using Claude a lot to refine code, generate checklists, and just generally help me move faster. But I kept finding myself typing the same kinds of instructions over and over again. Eventually I thought, there’s got to be a better way to do this. Turns out, there is. Claude lets you create your own custom slash commands—little reusable snippets you can call up with /whatever. You write the prompt once, save it as a markdown file, and now it’s available whenever you need it. It’s a simple thing, but it’s made my workflow a lot smoother.
A Couple Commands I Use Constantly
I’ve set up a couple of these that I use all the time. One is for cleaning up code after I think the core functionality is done. It’s a prompt I originally saw from Aaron Francis, and it’s become one of my go-tos:
#prompt
Okay, I think all the functionality is correct.
Can you please clean up anything that we might have left over
or simplify anything that is too complicated?
I saved that as a command called /cleanup-code
. Now, instead of retyping it every time, I just run the command and let Claude take it from there.
Another one I use is for turning a rough task list into something more structured. Usually when I’m starting on a feature or project, I’ll dump some thoughts into Claude, then run this prompt:
# prompt
Let's break this down into clear user stories and tasks.
For each user story, write a short, human-readable title, followed by a list of atomic tasks required to build it. Group the tasks under each user story as a checklist.
Format everything in markdown, and write it as if it's going into a build-checklist.md file that a developer will use to stay on track.
I saved that one as /build-checklist
, and now I reach for it every time I need to plan something out in more detail.
How It Works
Claude looks for these custom commands in specific folders on your machine. All you have to do is save a .md
file with your prompt in the right place:
- For global (personal) commands that work across all projects, put them in:
~/.claude/commands/
- For project-specific ones, use:
your_project/.claude/commands/
The filename becomes your command. So a file called cleanup-code.md
becomes accessible via /cleanup-code
.
You could write these markdown files by hand (and I did that at first), but I wanted something quicker. So I made a little meta-command to help me add new commands directly from within Claude.
The meta-command
I called it /add-command
, and it’s basically a shortcut for creating new shortcuts.
Instead of jumping into the terminal and creating a new markdown file every time, I can now just stay inside Claude and run:
/user:add-command Okay, I think all the functionality is correct. Can you please clean up anything that we might have left over or simplify anything that is too complicated?
That automatically creates a file called cleanup-code.md
in ~/.claude/commands/
, with the full prompt as its contents. From then on, /cleanup-code
is ready to go.
Here’s what the prompt behind /user:add-command
looks like:
# Add Custom Command
Create a new personal slash command and save it to ~/.claude/commands.
## Command Content
$ARGUMENTS
## Instructions
Take the provided command content and:
1. Generate a filename
2. Save it in `~/.claude/commands/`
3. It'll be available as /user:filename (drop the .md)
Small thing, but helpful
It’s a small thing, but when I’m deep in a flow, not having to context-switch just to save a prompt is really nice.
If you’re using Claude regularly and you’ve got a few prompts you find yourself typing again and again, this is worth setting up. Takes a few minutes, saves you a lot more.
And if you come up with any particularly useful slash commands of your own, I’d love to hear about them.