> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mains.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Slash Commands

> Built-in and custom commands for controlling Claude Code sessions

Slash commands are shortcuts that start with `/` and perform specific actions inside a Claude Code session. Mains supports both built-in commands and custom commands you define yourself.

## **Built-in Commands**

| **Command**    | **Description**                                                                  |                       |
| -------------- | -------------------------------------------------------------------------------- | --------------------- |
| `/compact`     | Summarize and compress conversation history to free up context                   |                       |
| `/debug`       | Enable debug logging for this session and help diagnose issues (bundled)         |                       |
| `/config`      | Open configuration settings                                                      |                       |
| `/simplify`    | Review change code for reuse, quality, and efficiency, then fix any issues found |                       |
| `/loop`        | Run a prompt or slash command on a reccuring interval.                           |                       |
| `/context`     | Show current context usage                                                       |                       |
| `/insights`    | Generate a report analyzinf your Claude Code sessions                            |                       |
| `/extra-usage` | Configure extra usage to keep working when limits are hit                        |                       |
| `/review`      | Review a pull request                                                            | Review a pull request |
| `/heapdump`    | Dump the JS heap to /Desktop                                                     |                       |

## **Custom Commands**

Custom commands are Markdown files that define reusable prompts. The filename becomes the command name.

### **Locations**

| **Location**                | **Scope**                                         |
| --------------------------- | ------------------------------------------------- |
| `.{your_project}/commands/` | Project commands — shared via git                 |
| `~/.claude/commands/`       | Personal commands — available across all projects |

### **Creating a Command**

Create a `.md` file in one of the command directories:

`.{your_project}/commands/review.md`:

```text theme={null}
---
description: Review code changes for issues
allowed-tools: Read, Grep, Glob
---

Review the recent code changes. Check for:
- Security vulnerabilities
- Performance issues
- Missing error handling
Provide findings as a numbered list with severity ratings.
```

Then invoke it in a session:

```text theme={null}
/review
```

### **Arguments**

Commands support positional arguments with `$1`, `$2`, etc., and `$ARGUMENTS` for the full argument string:

`.{your_project}/commands/fix-issue.md`:

```text theme={null}
---
argument-hint: [issue-number]
description: Fix a GitHub issue
---
Fix issue #$1. Check the issue description and implement the necessary changes.
```

```text theme={null}
/fix-issue 142
```

### **File References and Shell Output**

Commands can include file contents with `@` and shell output with `!`:

`.{your_project}/commands/commit.md`:

```text theme={null}
---
allowed-tools: Bash(git add:*), Bash(git commit:*)
description: Create a git commit
---
## Context
- Current status: !`git status`
- Current diff: !`git diff HEAD`
## Config
- Package: @package.json
Create a commit with an appropriate message based on the changes.
```

### **Namespacing**

Organize commands in subdirectories:

```text theme={null}
.{your_project}/commands/
├── frontend/
│   ├── component.md      # /component
│   └── style-check.md    # /style-check
├── backend/
│   └── api-test.md       # /api-test
└── review.md             # /review
```

## **Frontmatter Options**

| **Field**       | **Description**                                   |
| --------------- | ------------------------------------------------- |
| `description`   | What the command does (shown in help)             |
| `allowed-tools` | Comma-separated list of tools the command can use |
| `argument-hint` | Usage hint shown when listing commands            |
| `model`         | Override the model for this command               |
