Save reusable prompts as markdown files in .claude/commands/ (shared with your team) or ~/.claude/commands/ (personal) to create your own slash commands. Use settings.json files to pre-approve safe commands, block risky ones and share configuration.
Turn repeat prompts into commands
If you type the same instructions over and over, make it a command. Create a markdown file:
.claude/commands/review-diff.md
Review the current git diff for:
- bugs and edge cases
- security issues
- unclear naming
Give a prioritised list. Be concise.
Now type /review-diff in any session in that project. ๐ (Avoid plain /review: it is a built-in shortcut for /code-review, so your file would never run.)
.claude/commands/: project commands, committed to git, shared with the team.~/.claude/commands/: personal commands, available in all your projects.
Passing arguments
Use $ARGUMENTS as a placeholder for whatever you type after the command:
# .claude/commands/blog.md
Write an 800-word SEO blog post about: $ARGUMENTS
Use British English, H2 subheadings and a short FAQ.
/blog how Irish businesses can automate invoicing with AI
description shown in autocomplete. Newer Claude Code versions fold commands into skills, which add more power (see Level 4).settings.json: where configuration lives
~/.claude/settings.json: your personal settings everywhere..claude/settings.json: project settings, committed and shared..claude/settings.local.json: your personal overrides for this project (not committed).
A simple permissions example:
{
"permissions": {
"allow": ["Bash(npm run test:*)", "Bash(npm run lint)"],
"deny": ["Read(./.env)", "Bash(rm -rf:*)"]
}
}
This pre-approves running tests and lint, and blocks reading your secrets file.
Team configuration done right
- Commit shared commands, settings and CLAUDE.md so every teammate gets the same experience.
- Keep secrets out of committed files; use environment variables instead.
- Prefer deny rules for anything destructive or sensitive.
Check yourself
Three quick questions to check it stuck.
Ask the tutor
Stuck on something in this lesson? Ask the AI tutor. It answers from this lesson and points you to others that help. Answers are written by AI and can be wrong. Do not include personal details, passwords or company secrets.
Frequently asked
How do I create a custom slash command in Claude Code?
Create a markdown file in .claude/commands/ (project) or ~/.claude/commands/ (personal). The file name becomes the command name, and the content is the prompt.
Where is the Claude Code settings.json file?
User settings live in ~/.claude/settings.json, shared project settings in .claude/settings.json and personal project overrides in .claude/settings.local.json.
How do I pass arguments to a custom Claude Code command?
Use the $ARGUMENTS placeholder in the command file. Whatever you type after the command name replaces it.