Claude Code custom slash commands
Summary: A slash command is just a saved prompt in a Markdown file — type /name
and Claude Code runs the text inside it. The filename is the command name, and the
file's body is the prompt. Custom commands live in one of two folders depending on
whether you want them everywhere (personal) or only in one repo (project).
What they are
- Built-in commands (
/help,/clear,/config, …) ship with Claude Code — not files. - Custom commands are
.mdfiles you create.extract-learnings.md→/extract-learnings. The whole file body is the prompt that runs; there's no code involved.
Where they're stored — two scopes
| Scope | Folder | Available in | In git? |
|---|---|---|---|
| Personal / global | ~/.claude/commands/ (Windows: C:\Users\<you>\.claude\commands\) | every project on the machine | No — it's your home dir, not a repo |
| Project | <repo>/.claude/commands/ | only when working in that repo | Yes, if committed |
Rule of thumb: personal commands follow you across all repos; project commands travel with the repo (and are meant to be committed so a team — or future-you on another machine — gets them too).
Optional frontmatter
A command file can start with YAML frontmatter to improve the UX:
---
description: One-line summary shown in the command list
argument-hint: "[what to type after the command]"
---
The prompt body goes here. Use $ARGUMENTS to inject whatever the user typed
after the command name.
$ARGUMENTS is replaced with the text you type after /name — handy for passing input.
Managing them
- List available commands: type
/(or/help) — shows yours + built-ins. - Edit: open the
.mdfile and change the text. - Delete: remove the
.mdfile. - Add: drop a new
.mdfile into eithercommands/folder; its name is the command.
Worked example — the learnings pipeline in this setup
Two commands remove copy-paste when moving learnings from the Data Patch Agent repo into this notes repo:
/extract-learnings— personal/global (~/.claude/commands/extract-learnings.md), so it works in any repo. It extracts a session's learnings and writes them to this repo's gitignored_inbox/folder./file-learnings— project (nubbies-upgraded/.claude/commands/file-learnings.md), so it only appears here. It reads_inbox/and files each learning into the knowledge base.
The split mirrors the scoping rule: extracting happens in any repo (→ global), filing only makes sense in the notes repo (→ project).
Why it matters
Repetitive prompts become one keystroke, and project commands are version-controlled and shareable. Reach for personal scope when the command is about how you work anywhere; project scope when it's tied to one repo's structure or conventions.