Skip to main content
Code Guide
M09 Intermediate Methodology

Slash Commands

Create reusable custom commands

PDF
← All cards

Principle

A slash command is a Markdown file that defines a workflow. Claude executes it as if it had received that text as a prompt, with the ability to pass dynamic arguments.

File locations

.claude/commands/ # Project commands (team)
├── commit.md → /commit
├── review-pr.md → /review-pr
└── tech/
└── deploy.md → /tech:deploy
~/.claude/commands/ # Global commands (personal)
├── release.md → /release
└── sync.md → /sync

Global commands are available in all sessions, regardless of the project.

Invocation and arguments

/commit # No argument
/tech:deploy production # Positional argument
/release minor # Version bump

In the Markdown file, arguments are accessible via variables:

Deploy to environment: $ARGUMENTS[0]
With strategy: $ARGUMENTS[1]
If no argument provided: use "staging" by default.

The $0, $1 syntax is equivalent to $ARGUMENTS[0], $ARGUMENTS[1]. The old dot notation ($ARGUMENTS.0) is deprecated since v2.1.19.

# Command Name
## Objective
What this command does in one sentence.
## Process
1. **Step 1** — detailed instructions
2. **Step 2** — detailed instructions
3. **Step 3** — detailed instructions
## Arguments
- $0: target environment (default: staging)
## Output format
Description of the expected result.

Useful commands to create

CommandUsage
/commitAutomatic conventional commit
/review-prPR review against project criteria
`/release [patchminor
/syncMulti-file consistency check
/security-checkQuick config scan

Command vs Skill vs Agent

MechanismWhen to use
CommandOne-off workflow, procedure to follow
SkillReusable knowledge + embedded resources
AgentRecurring specialist with own memory

A command cannot embed additional reference files — for that, use a skill. A command has no persistent memory — for that, use an agent.

Practical tips

One command, one responsibility. As soon as a command does two distinct things, split it. Name with an action verb first (commit, release, sync) so that the intent is immediately readable in the list of available commands.

Enter your email to read the full card and get the complete PDF bundle.

All content is free and open-source. We just ask for your email.

PDF: