How to drive Claude from the keyboard — the four command types, the four mechanics that make them powerful, and how to build your own.
A shortcut you type as /name during a session. Behind it sits a plain Markdown file with a little frontmatter. No special language, no code to learn — just instructions in English that Claude follows when you invoke it.
Anything you do more than twice becomes a one-word command. Your best prompts move out of your head and into the repo — versioned, repeatable, and shareable with the whole team.
Ship with Claude Code — /help, /clear, /model, /compact. 60+ of them, nothing to install.
Custom commands you write as a SKILL.md file — /commit, /optimize. This is where your real leverage lives.
Bundled inside an installed plugin — /pr-review:review. A whole set distributed together.
Exposed by a connected MCP server — /mcp__github__list_prs. Live data from external tools.
| /clear | Wipe the conversation, keep your CLAUDE.md context |
| /compact | Summarize and continue when the context window fills up |
| /context | Visualize what's eating your context window |
| /model | Switch model and effort level mid-session |
| /rewind | Undo code and/or conversation back to a checkpoint |
| /init | Generate a CLAUDE.md memory file for the project |
.claude/commands/optimize.md
A single Markdown file. Nothing breaks; existing commands keep running exactly as before.
.claude/skills/optimize/SKILL.md
A folder that can bundle scripts and templates, auto-trigger when relevant, and run in its own isolated context.
--- name: fix-issue description: Fix a GitHub issue by number. Use when given an issue ref. argument-hint: [issue-number] allowed-tools: Bash(git *), Read --- # What Claude should do 1. Read the issue details 2. Implement the fix for issue #$ARGUMENTS 3. Run the tests and report the result
Pass input. /fix-issue 123 lands "123" in $ARGUMENTS. Use $0, $1 for separate args.
Run a shell command first and inject its output, so Claude sees real state — your actual git diff, not a guess.
Pull a file's contents straight into the prompt — @src/app.js. Compare two with @old.js @new.js.
Scope what runs without asking — Bash(git *). Fewer permission prompts, tighter safety.
The same five beats behind every skill — locate, inject live context, substitute your input, then act.
--- allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(git diff:*) argument-hint: [message] description: Create a git commit with context --- ## Context - Status: !`git status` - Diff: !`git diff HEAD` - Branch: !`git branch --show-current` ## Task Write one conventional commit. If $ARGUMENTS is set, use it.
It stages, commits, and pushes — but never blindly. Before it touches the remote it:
| /optimize | Find performance bottlenecks, memory leaks, and caching wins |
| /pr | Lint, test, and prepare a pull request with a summary |
| /commit | Write a conventional commit from your live git diff |
| /push-all | Safe stage-commit-push with a secret and artifact scan |
| /generate-api-docs | Build API documentation straight from source code |
| /doc-refactor | Restructure project documentation for clarity |
| /setup-ci-cd | Wire up pre-commit hooks and GitHub Actions |
| /unit-test-expand | Target untested branches and edge cases |
Drop the file in the right folder and type the command — that's it.
# As a skill (recommended) mkdir -p .claude/skills/commit cp commit.md .claude/skills/commit/SKILL.md # As a legacy command, shared with the whole team cp *.md .claude/commands/
A slash command is a Markdown file Claude reads. Four types — built-in, skills, plugin, MCP — and you'll mostly write skills. Four mechanics give them power: $ARGUMENTS for input, !`command` for live context, @file for file contents, and allowed-tools for safe scope. Skills are the future; your old .claude/commands/ files still work.