how to create a custom claude code slash command in 5 minutes
you need one folder and one markdown file. no code. here is the entire process, with a real command you can copy.
step 1: create the folder
in your project, create .claude/commands/. if you want the command available in every project, use ~/.claude/commands/ instead.
step 2: name the file after the command
the filename is the command. voice-check.md becomes /voice-check. pick a name you'd actually type.
step 3: write instructions like you'd brief a person
here's a command i'd hand any founder as their first one. create voice-check.md:
--- description: Check a draft against my writing rules --- Review the draft below against these rules: - no em dashes anywhere - none of the hype words on my banned-word list (the standing rules file carries the full list) - no sentence I wouldn't say out loud - claims need a number or a source Flag every violation with the exact line, then show the rewrite.
step 4: run it
type /voice-check in claude code, paste your draft, done. the rule set you keep forgetting to apply now applies itself.
the three upgrades
arguments. put $ARGUMENTS in the file and pass values when you call it. $0 and $1 grab positional values, so /fix-issue 123 high fills both slots.
live context. !`git status` inside the file runs the command and shows claude the output. @package.json pastes in a file. your command reads reality instead of guessing at it.
tool limits. frontmatter like allowed-tools: Read, Grep, Glob means the command can look but not touch. i put read-only limits on every audit command i own. audits should never edit.
when to graduate to a skill
the same file saved as .claude/skills/voice-check/SKILL.md still runs as /voice-check, and claude can also fire it on its own when it sees a draft that needs checking. that's anthropic's recommended format now, and it's the architecture my entire toolkit is built on.
first command to build: your own context file. who you serve, how you talk, what you never say. every output improves after that, because claude stops guessing who you are. i walk through my full version inside the toolkit, and if you want to see why your current output sounds generic first, run the autopsy on it.
go deeper
- claude code slash commands: the complete guide
- 7 claude code slash commands i run before anything goes live
- 10 claude code slash commands that run my one-person business
source: anthropic's claude code documentation for custom slash commands (folders, frontmatter, arguments, live context); the example command mirrors the writing-rules files running this site. written by elisabeth hitz, certified in anthropic's ai fluency program (framework & foundations, and ai capabilities & limitations), plus claude 101 and claude cowork.