Install
$ agentstack add mcp-jmutai-claude-code-cheat-sheet Open-source listing — not yet scanned by AgentStack. Follow the source repository for install instructions.
Security review
⚠ Flagged1 finding(s); flagged for manual review. · v0.1.0 How review works →
- • Prompt-injection patterns
- • Secret / credential exfiltration
- • Dangerous shell & filesystem operations
- • Untrusted network calls
- • Known-malicious package signatures
- high Pipes remote content directly into a shell (remote code execution).
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Claude Code Cheat Sheet - Commands, Shortcuts, Tips & Workflow Patterns
[](https://docs.anthropic.com/en/docs/claude-code/overview) [](#) [](LICENSE)
The complete reference for Claude Code, Anthropic's agentic coding CLI. Every command, keyboard shortcut, CLI flag, configuration option, and workflow pattern in one place. Tested and verified on Claude Code's latest release.
> Full article with screenshots and extended examples: computingforgeeks.com/claude-code-cheat-sheet
Table of Contents
- [Installation](#installation)
- [Keyboard Shortcuts](#keyboard-shortcuts)
- [Slash Commands](#slash-commands)
- [CLI Flags](#cli-flags)
- [CLAUDE.md - Project Instructions](#claudemd--project-instructions)
- [Permission Modes](#permission-modes)
- [Models and Effort Levels](#models-and-effort-levels)
- [MCP Servers](#mcp-servers--extend-claude-code)
- [Custom Skills](#custom-skills--your-own-slash-commands)
- [Custom Subagents](#custom-subagents)
- [Hooks - Automation Triggers](#hooks--automation-triggers)
- [Context Window Management](#context-window-management)
- [Git Worktrees](#git-worktrees--parallel-work)
- [Settings File Reference](#settings-file-reference)
- [Environment Variables](#environment-variables)
- [File Structure Reference](#file-structure-reference)
- [Practical Workflow Tips](#practical-workflow-tips)
- [Prompting Tips](#prompting-tips--get-better-results)
- [Token Saving Strategies](#token-saving-strategies)
- [Diagnostics](#diagnostics)
- [IDE Integrations](#ide-integrations)
- [Auto Mode](#auto-mode)
- [Automation Scripts](#automation-scripts)
- [Quick Reference Card](#quick-reference-card)
- [Subcommands Reference](#subcommands-reference)
Installation
Install Claude Code on macOS, Linux, or Windows (WSL):
curl -fsSL https://claude.ai/install.sh | bash
On macOS via Homebrew:
brew install --cask claude-code
On Windows (PowerShell):
irm https://claude.ai/install.ps1 | iex
Verify and authenticate:
claude --version
claude auth login
Keyboard Shortcuts
These work inside the interactive Claude Code terminal.
Essential Shortcuts
| Shortcut | Action | |----------|--------| | Ctrl+C | Cancel current generation or input | | Ctrl+D | Exit Claude Code | | Ctrl+L | Clear terminal screen | | Ctrl+R | Reverse search command history | | Esc + Esc | Rewind to previous checkpoint (undo) | | Shift+Tab | Cycle permission modes (default/plan/auto) | | Ctrl+G | Open input in external editor (vim, etc.) | | Ctrl+O | Toggle verbose output | | Ctrl+T | Toggle task list | | Ctrl+F | Kill all background agents (press twice) |
Input and Editing
| Shortcut | Action | |----------|--------| | \ + Enter | New line (multiline input) - works on macOS, Linux, and Windows | | Option+Enter (Mac) / Alt+Enter (Linux/Win) | New line (platform default) | | Shift+Enter | New line (iTerm2, WezTerm, Ghostty, Kitty, Windows Terminal) | | Ctrl+K | Delete to end of line | | Ctrl+U | Delete entire line | | Ctrl+Y | Paste deleted text | | Alt+B / Alt+F | Move cursor back/forward one word | | Cmd+V (Mac) / Ctrl+V (Linux/Win) | Paste image from clipboard | | Up/Down | Navigate command history |
Model and Mode Switching
| Shortcut | Action | |----------|--------| | Option+P (Mac) / Alt+P (Linux/Win) | Switch model (Sonnet/Opus/Haiku) | | Option+T (Mac) / Alt+T (Linux/Win) | Toggle extended thinking | | Shift+Tab / Alt+M | Cycle permission mode | | ? | Show all available shortcuts |
Quick Prefixes
| Prefix | Action | |--------|--------| | / | Open slash command menu | | ! | Run bash command directly | | @ | Autocomplete file path mention |
Slash Commands
Session and Context Management
| Command | What It Does | |---------|-------------| | /clear | Wipe conversation history and free context window | | /compact [focus] | Summarize conversation to free context, optionally focus on specific topic | | /cost | Show token usage and API cost for current session | | /context | Visualize what is consuming your context window | | /resume | Pick and resume a previous session | | /rename [name] | Name current session for easy resuming later | | /rewind | Rewind to a previous checkpoint | | /diff | View interactive diff of all changes made | | /copy | Copy last response to clipboard | | /export [file] | Export conversation as text file |
Configuration and Model
| Command | What It Does | |---------|-------------| | /model [name] | Switch model (sonnet, opus, haiku) | | /effort [level] | Set reasoning effort (low, medium, high, max) | | /config | Open settings interface | | /permissions | View and manage tool permissions | | /mcp | Manage MCP server connections | | /terminal-setup | Configure terminal keybindings for your shell | | /theme | Change color theme | | /vim | Toggle vim keybinding mode |
Project and Code Tools
| Command | What It Does | |---------|-------------| | /init | Initialize project, generates CLAUDE.md with project context | | /memory | View and edit CLAUDE.md files and auto-memory | | /security-review | Scan pending changes for security vulnerabilities | | /simplify | Review changed code for quality issues and suggest improvements | | /pr-comments [PR] | Fetch and address GitHub PR review comments | | /add-dir [path] | Add another directory to the working context | | /plan | Enter plan mode, read-only exploration before making changes | | /batch [task] | Run large-scale changes across 5-30 parallel git worktrees | | /debug [description] | Troubleshoot problems in the current session |
System and Account
| Command | What It Does | |---------|-------------| | /help | Show all available commands | | /doctor | Diagnose installation, settings, auth, and MCP issues | | /insights | Generate session analysis report | | /status | Show version, model, and account info | | /login / /logout | Sign in or out | | /bug | Submit a bug report with session logs | | /stats | View usage patterns, daily streaks, and session history | | /usage | Show plan usage and rate limits | | /release-notes | View changelog for current version | | /loop [interval] [prompt] | Run a prompt or command on a recurring schedule | | /voice | Toggle push-to-talk voice dictation (hold Space) | | /schedule | Create, update, list, or run scheduled remote agents (cron tasks) | | /fast | Toggle fast mode (same model, faster output) | | /hooks | View and manage configured hooks | | /desktop | Hand off current session to the Desktop app | | /teleport | Pull a web/iOS session into your terminal |
CLI Flags
Starting Sessions
# Start interactive session
claude
# Start with initial prompt
claude "refactor the auth module"
# Continue most recent session
claude -c
# Resume specific session by name
claude -r "auth-refactor"
# Name a session for later
claude -n "feature-payments"
# Run in isolated git worktree
claude -w feature-branch
# Run in worktree with tmux panes
claude -w feature-branch --tmux
# Resume session linked to a GitHub PR
claude --from-pr 42
# Fork a session (new ID, keeps context)
claude -c --fork-session
# Enable auto mode (AI decides permissions)
claude --permission-mode auto
# Bare mode (skip hooks, plugins, auto-memory)
claude --bare
Print Mode (Non-Interactive / Piping)
The -p flag runs Claude Code non-interactively. It processes the prompt and exits. This is the key to integrating Claude Code into scripts, CI/CD pipelines, and Unix pipes:
# Simple query
claude -p "explain this error in server.log"
# Pipe input
cat error.log | claude -p "what caused this crash?"
# Git diff review
git diff main | claude -p "review for security issues"
# JSON output for scripting
claude -p "list all TODO comments" --output-format json
# Structured output with schema validation
claude -p "extract function names from auth.py" \
--output-format json \
--json-schema '{"type":"object","properties":{"functions":{"type":"array","items":{"type":"string"}}}}'
# Auto-approve tools (careful with this)
claude -p "run tests and fix failures" --allowedTools "Bash,Read,Edit"
# Set spending limit
claude -p "refactor the API layer" --max-budget-usd 5.00
# Limit turns
claude -p "fix the bug" --max-turns 3
# Fallback model when primary is overloaded
claude -p "review this code" --fallback-model haiku
# Restrict available tools
claude -p "analyze this" --tools "Read,Grep,Glob"
# Block specific tools (deny list)
claude -p "refactor auth module" --disallowedTools "Bash(rm:*),Bash(sudo:*)"
# Override system prompt entirely
claude -p "review this code" --system-prompt "You are a security auditor. Focus only on vulnerabilities."
# Append to default system prompt
claude -p "explain this function" --append-system-prompt "Always include time complexity analysis."
# Load MCP servers from external config file
claude -p "check open issues" --mcp-config ./ci-mcp.json
# Disable session persistence (ephemeral, for CI/CD)
claude -p "run lint check" --no-session-persistence
# Debug mode (logs API calls, tool usage, timings)
claude -p "fix the build" --debug
# Debug with category filter
claude -p "fix the build" --debug "api,hooks"
# Write debug output to a file
claude -p "fix the build" --debug-file /tmp/claude-debug.log
# Select a specific agent
claude -p "review auth.py" --agent code-reviewer
# Enable Chrome debugging integration
claude --chrome
Model and Effort Flags
# Use specific model
claude --model opus
claude --model sonnet
claude --model haiku
# Set reasoning effort
claude --effort high # More thorough (costs more)
claude --effort low # Faster, cheaper
# Custom system prompt
claude --append-system-prompt "Always use TypeScript. Never use any."
# Load system prompt from file
claude --append-system-prompt-file ./coding-rules.txt
CLAUDE.md - Project Instructions
CLAUDE.md is the single most important file for customizing Claude Code behavior on a per-project basis. It loads automatically at the start of every session.
File Locations and Scope
| Location | Scope | Shared with Team? | |----------|-------|--------------------| | ./CLAUDE.md | This project only | Yes (commit to git) | | ./.claude/CLAUDE.md | This project only | Yes (commit to git) | | ~/.claude/CLAUDE.md | All your projects | No (personal) | | .claude/rules/*.md | Path-specific rules | Yes (commit to git) |
Example CLAUDE.md
# My Project
## Build and Test
- Run tests: `npm test`
- Build: `npm run build`
- Lint: `npm run lint`
## Code Style
- Use TypeScript strict mode
- Prefer functional components in React
- All API responses must include error handling
- Never commit .env files
## Architecture
- Backend: Express.js + PostgreSQL
- Frontend: React + TailwindCSS
- Auth: JWT tokens stored in httpOnly cookies
See @README.md for project overview.
See @package.json for available scripts.
The @filename syntax imports content from other files. Claude reads them automatically.
Path-Specific Rules
Rules that only apply to certain files. Create .claude/rules/api.md:
---
paths:
- "src/api/**/*.ts"
---
# API Rules
- All endpoints must validate input with Zod
- Return proper HTTP status codes
- Include rate limiting on public endpoints
Generate a CLAUDE.md automatically for any project with /init.
Permission Modes
Claude Code asks permission before running commands or editing files. Toggle between modes with Shift+Tab:
| Mode | Behavior | Use Case | |------|----------|----------| | default | Prompts on first use of each tool | Normal interactive work | | plan | Read-only, no edits, no commands | Safe exploration and planning | | acceptEdits | Auto-approves file edits, prompts for commands | Trusted editing sessions | | dontAsk | Auto-denies unless pre-approved | Strict control | | auto | AI classifier decides allow/deny per tool call | Trusted projects with clear CLAUDE.md rules | | bypassPermissions | Skips all prompts (dangerous) | Containers/sandboxes only |
Pre-Approve Specific Tools
Via the CLI:
# Allow git commands and file reads without prompting
claude --allowedTools "Read,Bash(git *)"
# Block dangerous tools explicitly
claude --disallowedTools "Bash(rm:*),Bash(sudo:*),Bash(chmod:*)"
# Combine both: allow some, block others
claude --allowedTools "Bash(git:*),Read,Edit" --disallowedTools "Bash(rm -rf:*)"
Or in .claude/settings.json:
{
"permissions": {
"allow": [
"Read",
"Bash(git *)",
"Bash(npm run *)",
"Bash(docker compose *)"
],
"deny": [
"Bash(rm -rf *)"
]
}
}
Models and Effort Levels
| Model | Best For | Speed | |-------|----------|-------| | sonnet (Claude Sonnet 4.6) | Daily coding, edits, refactors, tests | Fast | | opus (Claude Opus 4.6) | Complex architecture, debugging, multi-file changes | Slower | | haiku (Claude Haiku 4.5) | Simple tasks, quick questions | Fastest |
Switch models mid-session with /model opus or Option+P (Mac) / Alt+P (Linux/Windows).
Effort levels control how much reasoning Claude applies:
| Level | Use Case | |-------|----------| | /effort low | Simple questions, quick lookups | | /effort medium | Default, balanced speed and quality | | /effort high | Complex debugging, architecture decisions | | /effort max | Hardest problems (Opus only, unlimited thinking budget) |
MCP Servers - Extend Claude Code
MCP (Model Context Protocol) lets Claude Code connect to external tools and data sources. Configure servers in .mcp.json at the project root or ~/.claude/.mcp.json for all projects.
Example configuration with GitHub and PostgreSQL servers:
{
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_TOKEN"
}
},
"postgres": {
"type": "stdio",
"command": "npx",
"args": ["@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
}
}
}
}
Manage MCP connections with /mcp in the interactive session or pass a config file on the CLI:
# Load MCP servers from an external config
claude --mcp-config ./team-mcp.json
# Load multiple configs
claude --mcp-config ./github-mcp.json ./db-mcp.json
# Ignore all other MCP sources, only use this config
claude --mcp-config ./ci-mcp.json --strict-mcp-config
The --mcp-config flag is useful in CI/CD where you need consistent MCP server configuration across runs. --strict-mcp-config ensures only the specified servers are loaded, ignoring any from .mcp.json or user settings.
Custom Skills - Your Own Slash Commands
Skills are reusable prompts that show up as slash commands. Create them at .claude/skills/ (project) or ~/.claude/skills/ (personal).
Example: create a deploy skill:
mkdir -p .claude/skills/deploy
Create .claude/skills/deploy/SKILL.md:
---
name: deploy
description: Deploy the application to production
argument-hint: "[environment]"
user-invocable: true
---
Deploy the application to the $0 environment (default: staging).
Steps:
1. Run the test suite
2. Build the production bundle
3. Deploy using the deploy script
4. Verify the deployment health check
Now use it: /deploy production
Custom Subagents
Subagents are specialized AI agents that Claude can delegate tasks to. Create them at .claude/agents/:
mkdir -p .claude/agents/code-revi
…
## Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [jmutai](https://github.com/jmutai)
- **Source:** [jmutai/claude-code-cheat-sheet](https://github.com/jmutai/claude-code-cheat-sheet)
- **License:** MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.