Claude Code Slash Commands for Reusable Prompts
What it is: Slash commands are a built-in Claude Code feature that turn a Markdown file into a reusable, named prompt — type /your-command and Claude Code expands it into the file's contents as the next instruction, optionally with arguments you pass along. It's the difference between re-typing (or re-pasting) the same multi-paragraph instruction every week and typing four characters.
Quick answer: Drop a Markdown file in .claude/commands/ — commands/check-migrations.md becomes /check-migrations. Use slash commands for prompts you run often and want your whole team to have access to, not for one-off instructions you'll only type once.
Why it matters for data work
Data teams re-run the same kinds of requests constantly — "review this migration for backward compatibility," "summarize what changed in this dbt model and who it affects," "check this query for a missing partition filter." A slash command turns each of those from a paragraph you retype into a one-line invocation, and because it's a file in the repo, the whole team gets the same well-worded prompt instead of everyone writing their own slightly different version.
Install & configure
Create a Markdown file under .claude/commands/ in your project — the filename (minus .md) becomes the command name, so commands/audit-schema.md becomes /audit-schema (a subfolder like commands/frontend/component.md becomes /frontend:component). The file's contents are the prompt template Claude receives; reference $ARGUMENTS in the body to accept text typed after the command name. Commands placed under ~/.claude/commands/ instead are personal and available across every project rather than committed to a specific repo. Existing commands keep working, but Anthropic's docs now point new work toward Skills (a SKILL.md file with its own folder) for anything that needs supporting files or more control over who can invoke it — commands remain the simpler option for a short, single-file prompt template.
Slash command or a CLAUDE.md snippet?
Put standing context and conventions — your schema layout, naming conventions, house style — in CLAUDE.md, where it's always loaded automatically. Make something a slash command when it's an action you invoke on demand for a specific piece of work, not background knowledge Claude should always have. If you find yourself asking "should this always apply, or only when I ask for it?" — always-on context belongs in CLAUDE.md; on-demand instructions belong in a command.
Limits and gotchas
A slash command is a static prompt template — it doesn't branch or validate input beyond what you write into the prompt itself, so anything that needs real conditional logic or a guaranteed side effect belongs in a hook instead. Command names collide silently between project and personal scopes if you're not careful, so a personal command can shadow (or be shadowed by) a project one with the same name. And because the file is just Markdown read at invocation time, a command referencing project specifics (file paths, table names) will quietly go stale as the project changes unless someone maintains it.
Troubleshooting
Most issues are about discovery — Claude Code not finding the command where you expect.
- Command doesn't show up when typing "/": confirm the file lives directly under
.claude/commands/(or a documented subfolder) at the project root Claude Code was launched from. - Arguments aren't being substituted: check that the file actually references
$ARGUMENTSin the body — without it, anything typed after the command name is simply ignored. - Command works for you but not a teammate: project commands need to be committed to the repo; a personal command under
~/.claude/commands/stays local to your machine. - Two commands with the same name conflict: a personal command and a project command sharing a filename will shadow each other — rename one.
Author & links
Author: Anthropic
Docs: docs.claude.com/en/docs/claude-code/slash-commands
License: Proprietary — bundled with Claude Code
Related skills
Pair a slash command with a hook when the action needs a guaranteed side effect, or with a subagent when it should run as isolated, delegated work. See also output styles for shaping how responses read rather than what task runs.
← Back to Claude Code Skills