Where to Store Slash Commands in Claude Code (Project vs Global)

You’ve created a slash command and now you’re staring at a decision: should this file go inside your current project, or somewhere else so you can use it everywhere?

It’s a small decision that has real consequences for how your commands work. This article explains both storage locations, how they behave differently, and how to choose the right one for each command you build.

📋 TL;DR
– Project-level commands live inside .claude/commands/ inside your project folder — only available in that project
– Global commands live inside ~/.claude/commands/ on your machine — available in every project
– Use project-level for team-specific or codebase-specific commands; use global for personal workflow shortcuts
– Both locations can coexist — you can use commands from both in the same session
– If both locations have a command with the same name, the project-level command wins

This is part of our complete Claude Code Slash Commands & Skills — Full Guide. If you haven’t built a command yet, How to Create Your First Custom Slash Command walks through the full process.


The Two Storage Locations Explained

Claude Code looks for custom slash commands in exactly two places:

Location 1 — Project-level:


your-project/
└── .claude/
    └── commands/
        └── your-command.md

Location 2 — Global:


~/.claude/
└── commands/
    └── your-command.md

The tilde (~) in the global path means your home directory — the root folder for your user account on your computer. On a Mac, that’s /Users/yourname/. On Linux, it’s /home/yourname/.

Everything else about how commands work — the file format, the naming rules, how you call them — is identical. The only difference is where the file lives.


Project-Level Commands

A project-level command is stored inside the .claude/commands/ folder that lives inside a specific project.


my-app/
├── .claude/
│   └── commands/
│       ├── review.md       ← only available when you're in my-app/
│       └── deploy-check.md ← only available when you're in my-app/
├── src/
└── package.json

What “project-level” means in practice

When you’re working inside my-app/ and type /review, Claude Code finds and runs my-app/.claude/commands/review.md. If you switch to a different project and type /review, Claude Code won’t find it — because that other project doesn’t have a review.md file.

Project-level commands are scoped. They only exist for the project they’re stored in.

When to use project-level storage

Use project-level commands for anything tied to a specific codebase or team:

  • Team conventions** — “Review code using our Python style guide, which requires snake_case and docstrings on all public functions”
  • Project-specific workflows** — “Check that all API routes follow our RESTful naming conventions”
  • Framework-specific instructions** — “When writing tests, use pytest fixtures and follow our test file naming pattern”
  • Commands you want teammates to share** — if you commit .claude/commands/ to your git repository, everyone on the team gets the same commands

💡 Pro Tip: Commit your .claude/commands/ folder to git. This is one of the highest-leverage things you can do for team consistency — every developer gets the same Claude Code commands automatically when they clone the repo.

A git repository file tree showing .claude/commands/ folder with several .md files included in the tracked files


Global Commands

A global command is stored in ~/.claude/commands/ — a folder in your home directory, not inside any specific project.


~/.claude/
└── commands/
    ├── commit.md    ← available in every project on this machine
    ├── standup.md   ← available in every project on this machine
    └── explain.md   ← available in every project on this machine

What “global” means in practice

Global commands are available no matter which project you’re in. If you type /commit from my-app/, /commit from client-project/, or /commit from any other folder, Claude Code finds and runs ~/.claude/commands/commit.md.

Global commands follow you across all projects on your machine.

When to use global storage

Use global commands for personal workflow shortcuts that apply everywhere:

  • General-purpose commands** — commit message writing, code explanation, documentation generation
  • Personal preferences** — “Always format code examples with the style I prefer”
  • Language-agnostic utilities** — “Explain this code to me like I’m a junior developer”
  • Commands only you use** — anything that reflects your personal workflow rather than team conventions

# How to create the global commands folder if it doesn't exist
mkdir -p ~/.claude/commands

# How to create a global commit command
touch ~/.claude/commands/commit.md

Setting Up Both Locations

Here’s how to set up both locations at once, if you’re starting fresh:


# Creates both the global and project-level commands folders
mkdir -p ~/.claude/commands
mkdir -p .claude/commands

Run the first line once. Run the second line inside each new project you want project-level commands in.


When Both Locations Have the Same Command Name

If ~/.claude/commands/review.md exists globally and .claude/commands/review.md also exists in your current project, which one runs when you type /review?

The project-level command always wins.

This is intentional. It means your team can override a global command with a project-specific version when needed. Your personal global /review gets replaced by the team’s /review the moment you’re inside a project that has its own version.

⚠️ Warning: If you’re getting unexpected behavior from a command, check whether both locations have a file with the same name. A project-level command silently overrides a global one, which can be confusing if you forget you set up both.


Should You Commit .claude/commands/ to Git?

Yes, in almost every case.

Committing .claude/commands/ means:

  • Every teammate gets the same commands when they clone or pull
  • Commands are versioned alongside the code they’re designed for
  • New developers onboard with ready-made shortcuts from day one

The only reason not to commit it is if your commands contain sensitive information — API endpoints, internal system names, proprietary process details you don’t want in version control. In that case, keep those commands global (not committed) and put only safe, shareable commands in the project folder.

Add this to your .gitignore if you want to exclude the commands folder:


# Excludes the Claude Code commands folder from git tracking
.claude/commands/

Or just don’t add it to .gitignore and let it be committed — which is the better default for most teams.


Quick Decision Guide

Use this to decide where each command goes:

Command type Where to store it
Uses project-specific conventions or frameworks Project-level
Shared with your team Project-level (committed to git)
General-purpose — works on any code Global
Personal workflow preference Global
Contains sensitive info Global (not committed)

Common Mistakes

Storing team commands globally instead of in the project

If a command reflects how your team works — its code standards, review checklist, naming conventions — it belongs in the project and should be committed to git. Storing it globally means your teammates don’t get it.

Not creating the global folder

The ~/.claude/commands/ folder doesn’t exist until you create it. If your global commands aren’t working, run mkdir -p ~/.claude/commands and check that your file is inside it.

Forgetting that project commands override global ones

This trips people up. You update your global /review and wonder why it’s not working in one project — then remember that project has its own review.md that’s taking priority.

Using absolute paths in command file content

If your command file references a path like /Users/yourname/project/..., it’ll break on any other machine. Keep paths relative or remove them from shared command files.


Key Takeaways

  • Project-level commands live in .claude/commands/ inside your project — scoped to that project
  • Global commands live in ~/.claude/commands/ — available everywhere on your machine
  • Project-level commands take priority when there’s a name conflict with a global command
  • Commit .claude/commands/ to git for team-shared commands
  • Use global storage for personal shortcuts; use project storage for team conventions

Next Steps

Return to Claude Code Slash Commands & Skills — Full Guide for the full picture.