# How to Speed Up Your Claude Code Experience with Slash Commands



I was wasting time. Every commit message, every branch name, every PR description. I typed the same things over and over.
Then I discovered Slash Commands in Claude Code. Now I type `/commit` and it writes the message for me. `/branch "add dark mode"` and it creates `feat/add-dark-mode`. `/pr` and it generates a full PR description from my commits.
This post shows you how to build the same workflow. I'll cover how Slash Commands work, then we'll build a complete system that automates your entire git lifecycle.

<Aside type="tip" title="Related Reading">
Slash Commands are just one piece of the Claude Code puzzle. For the full picture—including MCP, hooks, subagents, and skills—see my <InternalLink slug="understanding-claude-code-full-stack">comprehensive guide to Claude Code's feature stack</InternalLink>.
</Aside>

<Alert type="important" title="Prerequisites">
You need Git and the GitHub CLI (`gh`). Install `gh` with `brew install gh` on macOS or check [cli.github.com](https://cli.github.com). Run `gh auth login` to authenticate.

Without `gh`, commands like `/pr` and `/fix-pipeline` will not work.
</Alert>

## Two things you need to know

Before we build the workflow, you need to understand two features.

### Bash command execution

Write `!git status` inside a command file. Claude runs the command first, captures the output, and injects it into the prompt. The AI sees the result before it starts thinking.

This is how `/commit` knows what you changed. It runs `!git diff` automatically. See the [official documentation](https://docs.anthropic.com/en/docs/claude-code/slash-commands#bash-command-execution) for more details.

### Model selection

You don't need a powerful model to fix a missing semicolon.
Claude Code lets you pick the model in the frontmatter:

- `sonnet` — for complex reasoning (default)
- `haiku` — fast and cheap

Add `model: haiku` and commands run almost instantly.

## Command structure

Slash commands are Markdown files stored in `.claude/commands/` (project-level) or `~/.claude/commands/` (personal). The filename becomes the command name: `commit.md` becomes `/commit`.

<FileTree
  tree={[
    {
      name: "my-project",
      open: true,
      children: [
        {
          name: ".claude",
          open: true,
          children: [
            { name: "settings.json", comment: "project settings" },
            {
              name: "commands",
              open: true,
              children: [
                { name: "branch.md", comment: "/branch" },
                { name: "commit.md", comment: "/commit" },
                { name: "pr.md", comment: "/pr" },
                { name: "lint.md", comment: "/lint" },
              ],
            },
          ],
        },
        { name: "src" },
        { name: "package.json" },
      ],
    },
  ]}
/>

Here is a complete example:

```markdown
---
description: Create a git commit with a conventional message
allowed-tools: Bash(git add:*), Bash(git commit:*)
argument-hint: [message]
model: haiku
---