Slash Commands
Reusable, parameterized prompts you trigger with /command.
Slash commands are shortcuts you type in the Claude Code prompt to trigger built-in actions or your own reusable workflows — one short command instead of re-explaining the same thing every session.
How commands work
Type a forward slash at the start of any message to open the command menu. You can keep typing to filter the list. Whatever text you add after the command name is passed to it as arguments. Commands are only recognized at the very start of a message — mid-sentence slashes are treated as plain text.
/help
/clear
/compact focus on the auth changes only
/model opusBuilt-in commands worth knowing
Claude Code ships with dozens of built-in commands. These are the ones you will reach for most often as you get started:
- /help — list every available command with a short description
- /clear — wipe the conversation and start fresh (your CLAUDE.md memory is kept)
- /compact — summarize the conversation to free up context window space; pass optional focus instructions
- /config — open the settings panel to change theme, model, and other preferences
- /mcp — manage connected MCP server connections
- /agents — configure subagents Claude can delegate tasks to
- /init — generate a starter CLAUDE.md for a new project
- /memory — edit your CLAUDE.md memory files
- /model — switch the AI model mid-session
- /skills — list all loaded skills and their token costs
Creating your own command
Custom commands are just Markdown files saved in a special directory. Create a file and Claude Code immediately registers it as a slash command — no restart needed. There are two file layouts that both work:
- ~/.claude/skills/<command-name>/SKILL.md — personal, available in every project
- .claude/skills/<command-name>/SKILL.md — project-scoped, committed with the repo
- .claude/commands/<name>.md — legacy path, still fully supported
The directory name (or file name for the legacy path) becomes the command you type. A file at .claude/skills/summarize-pr/SKILL.md is invoked with /summarize-pr.
Anatomy of a skill file
Every skill file has two parts: optional YAML frontmatter between --- markers that configures behavior, and plain Markdown content with the instructions Claude follows. Here is a minimal example that accepts an argument:
# .claude/skills/open-issue/SKILL.md
---
description: Open a GitHub issue for a bug. Use when the user wants to file a bug report.
argument-hint: <issue title>
---
Create a GitHub issue with the title: $ARGUMENTS
Before creating:
1. Check if a similar issue already exists with `gh issue list --search "$ARGUMENTS"`
2. Write a short description summarizing the bug and reproduction steps
3. Run: gh issue create --title "$ARGUMENTS" --body "<description>"You can now type /open-issue login page throws 500 on empty password and Claude will run the full workflow. The $ARGUMENTS placeholder expands to everything you typed after the command name.
Controlling who invokes a skill
By default, Claude can invoke a skill automatically when it judges the skill is relevant. Add disable-model-invocation: true to the frontmatter to make a skill manual-only — useful for destructive or deployment workflows you only want to trigger yourself. Pair it with user-invocable: false to hide a skill from the / menu entirely, making it background knowledge Claude loads quietly.
---
description: Deploy the application to production
disable-model-invocation: true
---
1. Run the test suite: npm test
2. Build: npm run build
3. Push: git push origin main