Custom slash commands and settings.json

Create your own Claude Code slash commands with markdown files, and configure settings.json for permissions, environment and team-wide defaults.

Lesson 3.3โฑ 8 min read๐Ÿš— Daily driverโ“ 3-question quiz
The short answer

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
Tip: commands can include frontmatter (a small block of settings at the top of the file) such as a 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.
Analogy: CLAUDE.md is the staff handbook, custom commands are the standard operating procedures, settings.json is the building's access-card system.

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.