Back to Skills

slash-commands

verified

How to create, use, and manage custom slash commands in Claude Code. Use when user asks about creating custom commands, command arguments, command organization, or slash command features.

View on GitHub

Marketplace

claude-plugins

reggiechan74/claude-plugins

Plugin

claude-code-metaskill

Repository

reggiechan74/claude-plugins

plugins/claude-code-metaskill/skills/slash-commands/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/reggiechan74/claude-plugins/blob/main/plugins/claude-code-metaskill/skills/slash-commands/SKILL.md -a claude-code --skill slash-commands

Installation paths:

Claude
.claude/skills/slash-commands/
Powered by add-skill CLI

Instructions

# Slash Commands

## Overview

Slash commands control Claude's behavior during interactive sessions. They're organized into built-in commands, custom commands defined by users, plugin commands, and MCP-exposed prompts.

## Built-in Commands

Key built-in commands include:

- `/help` - Get usage help
- `/clear` - Clear conversation history
- `/model` - Select or change the AI model
- `/cost` - Show token usage statistics
- `/memory` - Edit CLAUDE.md memory files
- `/sandbox` - Enable sandboxed bash execution
- `/rewind` - Rewind conversation and/or code
- `/mcp` - Manage MCP server connections

## Custom Slash Commands

### File Organization

Custom commands are Markdown files stored in two locations:

- **Project commands**: `.claude/commands/` (shared with team via git)
- **Personal commands**: `~/.claude/commands/` (user-level only)

### Basic Syntax

```
/<command-name> [arguments]
```

### Arguments

Commands support two argument styles:

**Capture all arguments:**
```markdown
Fix issue #$ARGUMENTS following coding standards
```

**Individual positional arguments:**
```markdown
Review PR #$1 with priority $2 and assign to $3
```

### Features

**Namespacing**: Organize commands in subdirectories. A file at `.claude/commands/frontend/component.md` creates `/component` with description "(project:frontend)".

**Bash execution**: Prefix commands with `!` to execute bash and include output:
```markdown
---
allowed-tools: Bash(git status:*), Bash(git add:*)
---
Current git status: ![git status]
```

Note: Replace `[git status]` with the actual command in backticks when creating your slash command.

**File references**: Use `@` prefix to include file contents in commands:
```markdown
Review the implementation in @src/utils/helpers.js
```

**Frontmatter metadata**:
```markdown
---
description: Brief command description
allowed-tools: Tool specifications
argument-hint: [expected-args]
model: specific-model-id
---
```

## Plugin Commands

Plugins distribute custom slash c

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3454 chars