The Complete Guide to
Claude's Slash Commands
& Shortcuts
๐
April 2026
โฑ 18 min read
๐ท Claude Code ยท Productivity ยท Developer Tools
SCROLL
Claude is not just a chat interface โ it's a programmable AI operating system. And like any powerful system, it has a command layer. Slash commands are the keyboard shortcuts of the AI era: they collapse multi-step workflows into a single keystroke, make your sessions smarter, and let teams share automation like version-controlled code.
Whether you're using Claude.ai in the browser, running Claude Code in your terminal, or integrating Claude through the Agent SDK, this guide gives you the complete picture โ every built-in command, the keyboard shortcuts, and how to build your own.
20+ Built-in Commands โ Custom Commands 3 Platforms 01 โ Web InterfaceClaude.ai โ Web & App Commands
The claude.ai web and mobile interface keeps its command palette minimal by design. The intelligence is conversational, not command-driven. Here's everything that's available natively:
Slash Commands /new Starts a fresh conversation, clearing context. /search Opens conversation search to find past chats. /help Opens help documentation and tips. KEYBOARD SHORTCUTS Send message Ctrl Enter New line (no send) Shift Enter Command palette / search Ctrl K New conversation Ctrl Shift ; Show shortcut help Ctrl / Edit last message โ Stop generation / close EscMac users: Replace Ctrl with Cmd for all shortcuts above.
02 โ Claude Code CLIClaude Code โ Built-in Slash Commands
Claude Code is where the real command power lives. These built-in commands are available the moment you launch claude in your terminal โ no setup needed. Type /help at any time to see them all.
/exit. Same behaviour.
Context & Memory
/init
Scans your project and creates a CLAUDE.md file โ Claude's persistent memory for this project. Includes key commands, architecture notes, and preferences.
/memory
Opens your CLAUDE.md memory files for editing. Changes take effect immediately in the session.
/cost
Shows token usage and estimated API cost for the current session โ essential for tracking spend.
/pr_comments
Pulls in open PR comments from connected GitHub so Claude can address them directly.
Model & Mode Control
/model
Switch between Claude models mid-session. Options include Sonnet 4.6, Opus 4.6, and Haiku 4.5. Opus for complex planning; Haiku to save tokens.
/fast
NEW 2026 Activates Fast Mode, running Opus 4.6 at 2.5ร speed โ ideal for rapid iteration.
/vim
Toggles vim keybindings for the input field. For those who can't escape :q! instincts.
/keybindings
NEW 2026 Opens or creates ~/.claude/keybindings.json to customise keyboard bindings. Changes apply instantly.
Review & Quality
/review
Triggers a comprehensive code review of recent changes โ checks quality, security, performance, and test coverage.
/security-review
Focuses the review specifically on security vulnerabilities: SQL injection, XSS, exposed credentials, and insecure configs.
Account & System
/login
Authenticates or switches Anthropic accounts. Supports OAuth and passwordless flows.
/logout
Signs out of the current Anthropic account.
/status
Displays current account info, model, session stats, and system health.
/doctor
NEW 2026 Runs environment diagnostics โ checks installation, dependencies, API key, and connectivity. Start here when something's broken.
/permissions
View and update which tools Claude can use in the current session without asking for approval first.
/config
Opens configuration settings โ model defaults, behaviour flags, and session preferences.
/terminal-setup
Installs shell integration for Shift+Enter newlines and other terminal-level features.
/release-notes
Shows the latest Claude Code release notes and changelog.
/help
Lists all available commands โ built-in, custom, MCP-connected, and skills. Your always-on reference.
/copy
NEW 2026 Select and copy code blocks directly โ SSH-friendly for remote workflows.
MCP & Integrations
/mcp
Manage Model Context Protocol (MCP) server connections โ add, remove, list, and debug connected tools like GitHub, Figma, HubSpot, Google Drive, and more.
/ide
Connect Claude Code to a running IDE (VS Code, JetBrains, etc.) for real-time file sync and context sharing.
/install-github-app
Sets up the Claude GitHub App for automatic PR review. Claude reviews every PR you open โ great for catching logic errors humans miss.
/rc
NEW 2026 Remote Control mode โ operate Claude Code from a mobile device.
Bundle Commands (v2.1.63+)
/simplify
Bundles a multi-agent review pass โ runs several specialist subagents in sequence and consolidates their feedback.
/batch
Executes parallel changes across multiple files or modules using multi-agent coordination. Dramatically speeds up large refactors.
/debug
Bundled skill โ runs a structured debugging playbook: reproduces the error, isolates the cause, proposes fixes, verifies.
/loop
Bundled skill โ continuously runs a task until a condition is met. Useful for iterative test-fix cycles.
03 โ Terminal Shortcuts
Claude Code โ Keyboard Shortcuts
These work during any interactive Claude Code session in your terminal. Mastering them is the difference between a slow AI user and a fast one.
Basic Operations Send message Enter New line in input Shift Enter Interrupt / stop generation Ctrl C Exit session Ctrl D Previous command in history โ Clear screen Ctrl L Mode Switching Cycle: Normal โ Auto-accept โ Plan Shift Tab Toggle vim mode /vim File & Image Operations Reference a file @filename Run shell command inline !commandPro tip: Use ! prefix (e.g. !git status) to run shell commands directly, bypassing Claude's conversational mode. Faster and uses fewer tokens.
How to Make Custom Commands โ The Complete Guide
Custom commands are where Claude stops being a chat tool and becomes a programmable team member. There is no limit to how many you can create. Every repeated prompt, every workflow, every checklist โ turned into a single /command that anyone on your team can run identically, every time.
As of 2026, Anthropic unified the older "commands" system with the newer "Skills" format. Both work. Skills are recommended because they support more features โ but the underlying idea is identical: a Markdown file becomes a slash command.
STEP 1 โ UNDERSTAND THE TWO FORMATSCommands vs Skills โ What's the difference?
Legacy โ Commands .claude/commands/code-review.md
commit.md
security-scan.md Single flat .md file. Still works. No auto-invocation. Recommended โ Skills .claude/skills/
code-review/
SKILL.md
checklist.md
template.md Folder-based. Supports supporting files + auto-invocation. STEP 2 โ CHOOSE WHERE IT LIVES
Location determines scope โ who can see and use the command.
.claude/skills/ Project-scoped, team-shared. Lives inside your repo. Committed to Git. Everyone who clones the repo gets the command automatically. Best for workflow standards, code review checklists, project-specific scaffolds. ~/.claude/skills/ Personal-global. Lives in your home directory. Works across every project you open. Best for personal productivity flows โ your daily standup, your writing style, your research process. .claude/commands/ Legacy project commands. Still works identically โ just a flat .md file per command. Fine to keep using. New commands should use the skills folder structure instead. ~/.claude/commands/ Legacy personal commands. Global but the old format. Commands here work fine indefinitely โ migrate to skills when you want supporting files or auto-invocation.Precedence rule: Project-level skills override global ones if they share the same name. This lets you set a global /review default but override it per-project with stricter or looser rules โ without touching your global setup.
Minimal working example โ 3 lines to a custom command
# Terminal mkdir -p .claude/skills/commit cat > .claude/skills/commit/SKILL.md << 'EOF' --- name: commit description: Generate a conventional commit message from staged changes --- Look at the staged changes and write a conventional commit message. Format: <type>(<scope>): <short description> Types: feat, fix, docs, style, refactor, test, chore Keep the subject line under 72 characters. Staged diff: !`git diff --cached` EOF
Now type /commit in Claude Code. That's all it takes.
Every SKILL.md has two parts separated by ---: a YAML frontmatter block that configures behaviour, and a Markdown body that is the actual instruction Claude follows.
Full annotated SKILL.md โ every option shown
--- # REQUIRED โ becomes the /slash-command name name : code-review # REQUIRED โ drives auto-discovery. Front-load the key use case. # Claude reads this to decide when to invoke automatically. # Capped at 1,536 chars. Be specific, not vague. description : Comprehensive code review for security, quality, and performance. Use when reviewing PRs, checking recent changes, or auditing a file. # Pre-approve tools โ Claude won't ask permission for these allowed-tools : Read, Grep, Glob, Bash(git diff:*), Bash(git log:*) # Override the model for this specific command # Use Haiku for speed/cost, Opus for complex multi-step reasoning model : claude-opus-4-6 # Shown in autocomplete โ tells user what args to pass argument-hint : [file-or-PR-number] # Run in isolated subagent โ keeps your main context window clean # Great for research-heavy or long-running tasks context : fork # Which subagent persona to use (Explore, Plan, or custom) agent : Explore # Hide from /help menu โ Claude invokes automatically, you don't type it # Good for background context skills, not user-facing commands user-invocable : false # Prevent Claude from auto-triggering โ ONLY manual /command invocation # Use for anything with side effects: deploys, sends, publishes disable-model-invocation : true # Restrict auto-invocation to specific file paths paths : - src/**/*.ts - src/**/*.tsx --- ## Everything below this line is the instruction Claude follows Review the following changes for: 1. Code quality and readability 2. Security vulnerabilities (SQL injection, XSS, exposed secrets) 3. Performance โ unnecessary re-renders, N+1 queries, memory leaks 4. Test coverage โ are edge cases handled? 5. Documentation โ are public APIs documented? Target: $ARGUMENTS Current diff: !`git diff HEAD~1` Output your review as: - **Summary** (2 sentences max) - **Critical issues** (must fix before merge) - **Suggestions** (nice to have) - **Verdict**: APPROVE / REQUEST CHANGESSTEP 5 โ PASS ARGUMENTS
Commands become dynamic when they accept input. Three argument patterns cover almost every use case:
Argument patterns
# Pattern 1: Single argument โ $ARGUMENTS gets everything after the command # Usage: /fix-issue 247 Fix GitHub issue $ARGUMENTS following our coding standards. Commit message: "fix: resolve #$ARGUMENTS" # Pattern 2: Positional args โ $1, $2, $3... # Usage: /migrate-component Button Modal Migrate the $1 component to use the $2 pattern. Read the existing $1 implementation first, then rewrite. # Pattern 3: Named args via $ARGUMENTS[key] (advanced) # Usage: /deploy --env staging --version 2.1.4 Deploy to environment: $ARGUMENTS[env] Version: $ARGUMENTS[version]STEP 6 โ INJECT LIVE CONTEXT
The !`command` syntax runs a shell command at invocation time and injects its output into the prompt. Claude always has live, accurate data โ never stale context.
Useful shell injections
# Git context Current branch: !`git branch --show-current` Recent commits: !`git log --oneline -10` Staged changes: !`git diff --cached` Changed files: !`git diff --name-only HEAD~1` Open PRs: !`gh pr list --state open` # Project context Package version: !`cat package.json | grep '"version"'` Test results: !`npm test -- --passWithNoTests 2>&1 | tail -20` Build errors: !`npm run build 2>&1 | grep -i error | head -20` Env vars: !`cat .env.example` # System / date context Today: !`date +%Y-%m-%d` Directory tree: !`find src -name "*.ts" | head -30` # Live docs fetch โ always current, never stale Docs: !`curl -s https://api.example.com/docs/llms.txt`STEP 7 โ ADD SUPPORTING FILES
One of the key advantages of the Skills format over flat commands: your skill folder can contain templates, examples, scripts, and reference docs that Claude loads on demand.
Example skill folder with supporting files
.claude/skills/new-feature/ โโโ SKILL.md โ main instructions โโโ template.md โ Claude fills this in โโโ examples/ โ โโโ good.ts โ show Claude what "good" looks like โ โโโ bad.ts โ show what to avoid โโโ checklist.md โ pre-launch checklist โโโ conventions.md โ your team's coding style guide
# In SKILL.md โ reference your supporting files --- name: new-feature description: Scaffold a new feature following team conventions --- Read our conventions first: @conventions.md Use this template: @template.md Match the style of: @examples/good.ts Avoid the patterns in: @examples/bad.ts Now implement: $ARGUMENTSSTEP 8 โ FULL FRONTMATTER REFERENCE Every frontmatter option explained name: The slash command name. Use kebab-case.
name: code-review โ /code-review. Must be unique within scope.
description:
Claude's decision engine for auto-invocation. Write it like a search query. Front-load the most important use case. Capped at 1,536 characters โ be concise and keyword-rich.
allowed-tools:
Comma-separated list of tools pre-approved for this command. Supports wildcards: Bash(git *) allows all git subcommands. Options: Read, Write, Edit, Grep, Glob, Bash(cmd), WebFetch, Task.
model:
Force a specific model for this command regardless of session default. claude-haiku-4-5 for speed, claude-opus-4-6 for depth. Great for cost control.
argument-hint:
Shown in the autocomplete dropdown when you type the command. Tells your team what to pass. E.g. [issue-number] or [component] [target-pattern].
context: fork
Runs the command inside an isolated subagent with its own context window. The results are returned to your main session. Use for research tasks, doc fetching, or anything that would bloat your main conversation.
agent:
Which subagent persona runs the command. Built-ins: Explore (read-only investigator), Plan (no code execution). Or reference any custom subagent you've defined in .claude/agents/.
user-invocable: false
Hides the command from /help and the autocomplete menu. Claude still loads and uses it automatically when the context matches. Use for background architecture docs, legacy context, team conventions.
disable-model-invocation: true
Prevents Claude from triggering the command automatically โ it only runs when you explicitly type /command-name. Essential for anything with side effects: deployments, API calls, message sending.
paths:
Restrict auto-invocation to specific file patterns. A skill with paths: [src/**/*.test.ts] only auto-triggers when Claude is working on test files. Accepts glob patterns.
STEP 9 โ WRITE INSTRUCTIONS THAT ACTUALLY WORK
The instruction body of your SKILL.md is a prompt. The same prompt engineering principles apply โ but in a persistent, reusable form. A few rules that separate good commands from great ones:
Be directive, not conversational Write "Review the code for security issues" not "Could you maybe look at this code?". Imperative verbs. Commands, not requests. Specify the output format Tell Claude exactly how to structure the response โ bullet points, tables, code blocks, headers. Consistent output = parseable, copyable, shareable results. Include examples of good output Show Claude what the ideal response looks like. Put it in a supportingexample.md file and reference it. Claude follows examples very closely.
Add escape hatches
Tell Claude when to stop and ask rather than guess. "If you're uncertain about the deployment target, stop and ask before proceeding." Prevents costly mistakes.
One command, one job
A /do-everything command is just a worse version of no command. Three focused commands beat one sprawling one. Compose them in sequence instead.
Keep it under 500 lines
Long skills eat into your context window. If your instructions exceed 500 lines, split the content into supporting files and reference them selectively rather than loading everything at once.
STEP 10 โ SHARE WITH YOUR TEAM
This is the compounding value. Once a command is in your repo, every team member runs the same workflow. When someone improves it, everyone benefits on next git pull.
Team setup pattern
# Commit your skills directory git add .claude/skills/ git commit -m "feat: add team Claude Code skills" git push # Add a README so teammates know what's available cat > .claude/skills/README.md << 'EOF' ## Team Claude Skills | Command | What it does | |---------------------|-------------------------------------------| | /code-review | Full review: quality, security, perf | | /commit | Conventional commit from staged diff | | /test-gen | Generate tests for a file or function | | /security-scan | OWASP Top 10 scan across codebase | | /api-scaffold | REST endpoint scaffold with RBAC | | /docs | Generate JSDoc / docstrings | | /release-notes | Changelog from git log since last tag | Add new skills here and document them in this table. EOF # Reference in CLAUDE.md so Claude knows about them echo "## Available Skills\nSee .claude/skills/README.md" >> CLAUDE.md
Hot reload: As of January 2026, skills you create or modify activate immediately in a running Claude Code session โ no restart needed. Edit a SKILL.md, save it, and the updated command is live in seconds.
REAL EXAMPLES โ COPY & USE TODAY15 Ready-to-Use Commands
Below are production-ready SKILL.md bodies. Create the folder, paste the content, and start using them immediately.
/commit โ Smart conventional commit
--- name: commit description: Generate a conventional commit message from staged git changes allowed-tools: Bash(git diff:*), Bash(git status:*) model: claude-haiku-4-5 --- Staged changes: !`git diff --cached` Write a conventional commit message: - Format: <type>(<scope>): <description> - Types: feat, fix, docs, style, refactor, test, chore, perf - Subject line: max 72 chars, imperative mood, no period - Add a body if the change is non-obvious (what + why, not how) - Reference issue numbers if relevant Output ONLY the commit message, nothing else.
/security-scan โ OWASP vulnerability check
--- name: security-scan description: Security vulnerability scan. Use before merging PRs or deploying. allowed-tools: Read, Grep, Glob model: claude-opus-4-6 context: fork --- Scan the codebase for security vulnerabilities. Check for: **Injection** - SQL injection (string concatenation in queries) - Command injection (user input in shell commands) - XSS (unescaped output in HTML) **Secrets & Auth** - Hardcoded credentials, API keys, tokens - Weak password hashing (MD5, SHA1, no salt) - Insecure session management **Data Exposure** - Sensitive data in logs - Unencrypted PII in transit or at rest - Verbose error messages in production **Dependencies** - Known vulnerable packages (check package.json) Target: $ARGUMENTS (or entire codebase if no argument given) Output as: CRITICAL / HIGH / MEDIUM / LOW findings with file:line references.
/test-gen โ Comprehensive test generation
--- name: test-gen description: Generate comprehensive tests for a function, file, or module allowed-tools: Read, Grep, Glob, Bash(npm test:*), Bash(npx:*) argument-hint: [file-or-function] --- Generate tests for: $ARGUMENTS Before writing any tests: 1. Read the target file to understand function signatures and types 2. Find the existing test directory โ read 1-2 tests to match their pattern exactly 3. Identify the testing framework (Jest, Vitest, pytest, etc.) Generate tests covering: - **Happy path** โ expected inputs produce expected outputs - **Edge cases** โ empty, null, zero, max values, empty arrays - **Error cases** โ invalid inputs should throw or return errors - **Async behaviour** โ if async, test both success and failure - **Boundary conditions** โ off-by-one, overflow, type coercion Match the exact import style, describe block naming, and assertion patterns from existing tests. Run the tests after writing: report pass/fail and fix any failures.
/standup โ Daily standup from git history
--- name: standup description: Generate a standup update from yesterday's git activity allowed-tools: Bash(git log:*), Bash(git diff:*), Bash(gh pr:*) model: claude-haiku-4-5 --- Today: !`date +"%A, %B %d"` Yesterday's commits: !`git log --since="yesterday 00:00" --until="today 00:00" --oneline --author="$(git config user.name)"` Open PRs: !`gh pr list --author @me --state open 2>/dev/null || echo "gh CLI not configured"` Write a standup update in this format: **Yesterday:** (what was completed โ be specific, reference PR/issue numbers) **Today:** (what's planned โ infer from open PRs and recent work) **Blockers:** (none unless you ask me) Keep it concise โ 3-5 bullet points max across all sections. Use plain language, not technical jargon.
/release-notes โ Changelog from git log
--- name: release-notes description: Generate release notes and changelog from git history since last tag allowed-tools: Bash(git log:*), Bash(git tag:*), Read argument-hint: [version-number] --- New version: $ARGUMENTS Last tag: !`git describe --tags --abbrev=0 2>/dev/null || echo "no previous tag"` Changes since last tag: !`git log $(git describe --tags --abbrev=0 2>/dev/null)..HEAD --oneline` Generate release notes in this format: ## v $ARGUMENTS โ !`date +"%B %d, %Y"` ### โจ New Features (group feat: commits) ### ๐ Bug Fixes (group fix: commits) ### โก Performance (group perf: commits) ### ๐ง Maintenance (chore, refactor, docs commits) ### ๐ฅ Breaking Changes (anything with BREAKING CHANGE in commit body) Write in plain English โ not commit messages. What does each change mean for users?
/docs โ Generate documentation
--- name: docs description: Generate or update documentation for a file, function, or module allowed-tools: Read, Edit, Glob argument-hint: [file-path] --- Generate documentation for: $ARGUMENTS 1. Read the target file completely 2. Detect the language and its doc convention (JSDoc, TSDoc, docstrings, etc.) 3. Read 1-2 neighbouring files to understand the doc style in use Generate: - Function/method docs: params, return types, throws, examples - Class/interface docs: purpose, usage pattern, example instantiation - Module-level docs: what does this module do, when to use it - Inline comments for non-obvious logic only (not noise comments) Rules: - Don't document what the code obviously does - DO document WHY, not what - Include at least one usage example per public API - Update existing docs in place rather than duplicating
/fix-issue โ Fix a GitHub issue by number
--- name: fix-issue description: Fix a GitHub issue. Pass the issue number as argument. allowed-tools: Read, Edit, Bash(gh issue:*), Bash(git:*) argument-hint: [issue-number] disable-model-invocation: true --- Issue: $ARGUMENTS Issue details: !`gh issue view $ARGUMENTS 2>/dev/null || echo "Run: gh auth login"` 1. Read the issue description and comments carefully 2. Search the codebase for relevant files 3. Understand the root cause before writing any code 4. Implement the fix โ minimal, targeted change 5. Write or update tests for the fix 6. Create a commit: "fix: resolve #$ARGUMENTS โ <short description>" If you're unsure about the expected behaviour, stop and ask before writing code.
/competitive-research โ Structured competitor analysis
--- name: competitive-research description: Structured competitive research and analysis for a product or company allowed-tools: WebFetch argument-hint: [company-or-product-name] context: fork model: claude-opus-4-6 --- Research target: $ARGUMENTS Conduct a structured competitive analysis. Research: 1. **Product** โ core features, positioning, unique differentiators 2. **Pricing** โ model, tiers, free vs paid limits 3. **Target customer** โ who they're built for, job titles, company size 4. **Go-to-market** โ how they acquire customers, key channels 5. **Strengths** โ what they do genuinely well 6. **Weaknesses** โ gaps, complaints, limitations (check reviews, Reddit, G2) 7. **Recent moves** โ new features, funding, partnerships, hiring signals Output as a structured markdown report. End with: "How we should respond" โ 3 specific tactical recommendations.TROUBLESHOOTING Common problems & fixes Command not appearing in /help Check: (1) file is saved as
SKILL.md exactly, (2) folder is in .claude/skills/ or ~/.claude/skills/, (3) frontmatter has valid name: field, (4) user-invocable is not set to false.
Claude not auto-triggering the skill
Description keywords must match how you phrase requests. Front-load the most important use case. Check disable-model-invocation isn't set to true. Ask Claude: "What skills are available?" to confirm it's loaded.
Skill triggering when you don't want it
Narrow the description to be more specific. Add a paths: restriction to specific file types. Or set disable-model-invocation: true to require manual invocation only.
Too many skills โ descriptions being truncated
The description budget is 1% of context window (~8,000 chars total). Set SLASH_COMMAND_TOOL_CHAR_BUDGET env variable to raise it, or trim descriptions to under 200 chars each and front-load the key use case.
Shell injection (!`) not working
Check the command works in your terminal first. Ensure Bash is in your allowed-tools. The tool needs permission to run shell commands. Some commands need specific Bash sub-permissions like Bash(git *).
Project skills not visible to teammates
Make sure .claude/ is not in your .gitignore. Run git add .claude/skills/ explicitly and commit. Teammates need to pull and restart Claude Code (or just save any skill file to trigger hot reload).
MORE IDEAS
Command Ideas by Team Role
/pr-review Engineering. Full PR review with checklist โ quality, security, performance, test coverage, and a LGTM/REQUEST CHANGES verdict. /migration $1 $2 Engineering. Migrate a component or pattern from one approach to another. E.g./migration Redux Zustand.
/env-check
DevOps. Compares .env against .env.example and flags missing or undocumented variables.
/deploy-check
DevOps. Pre-deployment checklist โ tests passing, env vars set, secrets not exposed, changelog updated, version bumped.
/new-post $ARGUMENTS
Content. Scaffolds a blog post file with frontmatter, slug, date, and outline based on the title passed as argument.
/seo $ARGUMENTS
Content/Marketing. Reviews a page or post for SEO โ title, meta, headings, keyword density, internal links, alt text.
/brief $ARGUMENTS
Product. Generates a structured product brief from a feature idea โ problem, users, success metrics, non-goals, open questions.
/user-story $ARGUMENTS
Product. Converts a feature idea into properly formatted user stories with acceptance criteria in Gherkin format.
/outreach $ARGUMENTS
Partnerships/Sales. Drafts a personalised cold outreach message for a company or person. Pass the target name as argument.
/proposal $ARGUMENTS
Partnerships/Sales. Structures a partnership or commercial proposal from a brief description of the opportunity.
/retro
Team. Pulls sprint commits and PRs, then structures a retrospective with: what went well, what didn't, action items.
/check-links
Universal. Reads any file and verifies every URL is still live. Flags 404s and redirects. Prevents broken link embarrassment.
05 โ For Builders
Slash Commands in the Agent SDK
If you're building on Claude via the Agent SDK, slash commands are available programmatically. The SDK exposes them on session init, and you send them as prompt strings.
// Discover available commands at session start
import { query } from "@anthropic-ai/claude-agent-sdk" ;
for await ( const message of query({
prompt: "Hello" ,
options: { maxTurns: 1 }
})) {
if (message.type === "system" && message.subtype === "init" ) {
console.log( "Commands:" , message.slash_commands);
// ["/compact", "/clear", "/help", "/refactor"]
}
}
// Send a slash command
for await ( const msg of query({
prompt: "/compact" ,
options: { maxTurns: 1 }
})) {
if (msg.type === "system" && msg.subtype === "compact_boundary" ) {
console.log( "Compacted. Pre-tokens:" , msg.compact_metadata.pre_tokens);
}
}
Garage Labs note: If you're building AI-powered products on top of Claude, custom commands checked into your project repo are the cleanest way to standardise your Claude behaviour across your entire team. Everyone's running the same prompts, version-controlled and improvable.
06 โ Extend via MCPMCP Server Commands
Connected MCP (Model Context Protocol) servers expose their own prompts as slash commands โ automatically surfaced in /help. This means integrations like GitHub, Figma, HubSpot, Google Drive, and others each bring their own command vocabulary.
# Add an MCP server
claude mcp add github npx @anthropic-ai/mcp-server-github
# Or reference it in your SDK call
mcp_servers: [
{
type: "url" ,
url: "https://mcp.github.com/sse" ,
name: "github-mcp"
}
]
Once connected, MCP tools appear as commands in session. Common integrations used by teams at Garage Labs include Figma (design context), HubSpot (CRM actions), Google Drive (doc reading), Gmail (email drafting), and n8n (workflow triggers).
07 โ The Big PictureWhy This Matters
The shift from "chatting with AI" to "commanding AI" is significant. Slash commands turn Claude from a conversational assistant into a programmable workflow engine. Your best prompts stop living in your head and start living in version-controlled Markdown files that your whole team can use, improve, and ship with.
At Garage Labs, we see teams unlock serious leverage when they treat their Claude command library the same way they treat their codebase โ with ownership, iteration, and craft. Start with the built-ins. Add one custom command for your most-repeated task. Build from there.
Start here: Run /init in your project today. Claude will read your codebase, understand its structure, and create a CLAUDE.md that makes every future session smarter from the first prompt.
garagelabstech.com ยท AI-powered products for ambitious teams Website Claude Docs Claude Code