DEV Community

Cover image for Most people using Claude Code only know 3 commands.
jonny2301
jonny2301

Posted on

Most people using Claude Code only know 3 commands.

Claude Code Master Cheat Sheet

Every slash command, @ mention, CLI flag, and power trick — all in one place.

By @Dav23Jonn76

📖 Full page on Notion


/ Slash Commands

Command What It Does Mental Model
/help Show all commands Open the manual
/clear Clear conversation history Fresh whiteboard
/compact Summarize + compress context Zip the memory
/cost Show token usage & cost Check the bill
/status Show current session info Dashboard
/bug Report a bug to Anthropic File a ticket
/review Request code review Call in the expert
/init Init CLAUDE.md in project Set up home base
/memory Edit CLAUDE.md memory file Edit the brain
/model Switch AI model Change the engine
/terminal-setup Install shell key bindings Wire the keyboard
/vim Toggle vim mode Summon vim spirit

@ Mentions

Syntax What It Does Mental Model
@filename Add a file to context Hand Claude a file
@folder/ Add entire folder Hand Claude a folder
@url Fetch & read a URL live Read a webpage
@git Reference git context Read the repo history
@changes Include git diff/changes Show what changed
@README.md Load project README Brief Claude on project
@package.json Load package info Show dependencies
@*.test.ts Glob pattern file match Batch load files

-- CLI Flags

Flag What It Does Mental Model
--print / -p Print response, no interactive UI One-shot mode
--output-format Set output: text / json / stream Choose the format
--model Specify which model to use Pick the engine
--no-tools Disable all tools Chat only mode
--allowedTools Whitelist specific tools Selective permissions
--dangerously-skip-permissions Skip all confirmations Auto-approve all 🚨
--verbose Show detailed logs Debug mode on
--max-turns Limit agentic loop turns Set a leash
--system-prompt Override system prompt Custom instructions
--resume Resume a past session by ID Load a save file
--continue / -c Continue last conversation Pick up where left off
--version Show Claude Code version Version check

⚙ CLAUDE.md & Config

Concept What It Does Mental Model
CLAUDE.md Project memory Claude always reads Standing orders
~/.claude/CLAUDE.md Global memory across all projects Personal rules
settings.json Config file for permissions & tools Claude's rulebook
allowedTools Tools Claude can use without asking Pre-approved list
blockedTools Tools Claude can never use Banned list
ANTHROPIC_API_KEY Your API key env variable Secret credential
/init Auto-generate CLAUDE.md from codebase Auto-brief Claude
MCP servers Connect external tools to Claude Plugin system

💡 Pro tip: Put your stack, coding style, and never-do rules in CLAUDE.md once. Claude will follow them forever across that project.

# CLAUDE.md example

## Stack
- Next.js 14, TypeScript, Tailwind
- Supabase for database

## Rules
- Never use var, always const/let
- Always add error handling
- Write tests for every function
Enter fullscreen mode Exit fullscreen mode

★ Power User Tricks

Trick What It Does Mental Model
claude "fix this" --print One-shot answer, no UI Quick fire mode
claude -c Jump straight into last session Resume game
`cat file \ claude -p "explain"` Pipe any file into Claude
claude --dangerously-skip-permissions Full auto-approve for CI/CD Robot mode 🤖
/compact then continue Free up context without losing thread Context reset trick
@CLAUDE.md in prompt Explicitly reference memory mid-chat Remind Claude
Esc Esc Edit your last message Take it back
Ctrl + C twice Abort running tool immediately Hard stop
claude --resume [id] Restore a specific old session Time travel
claude "task" --max-turns 5 Run agentic task with turn limit Controlled agent
Shift + Enter Multi-line input without sending Paragraph mode

Real examples:

# Explain any file instantly
cat src/index.ts | claude -p "explain this code"

# Run a task fully automated (CI/CD)
claude "run tests and fix any failures" --dangerously-skip-permissions

# One-shot with JSON output
claude "list all functions in @src/" --print --output-format json

# Controlled agent with turn limit
claude "refactor the auth module" --max-turns 10
Enter fullscreen mode Exit fullscreen mode

Keyboard Shortcuts

Shortcut What It Does
↑ / ↓ Navigate message history
Ctrl + C Cancel current generation
Ctrl + C twice Force stop running tool
Esc Esc Edit last sent message
Shift + Enter New line without sending
Tab Autocomplete file/command
Ctrl + L Clear screen

Install & Setup

# Install globally
npm install -g @anthropic-ai/claude-code

# Set your API key
export ANTHROPIC_API_KEY=sk-ant-...

# Add to shell config so it persists
echo 'export ANTHROPIC_API_KEY=sk-ant-...' >> ~/.zshrc

# Update to latest
claude update

# Check version
claude --version

# Diagnose issues
claude doctor

# Install shell shortcuts
claude /terminal-setup

# Bootstrap a new project
claude /init
Enter fullscreen mode Exit fullscreen mode

The Mental Model That Changed Everything

Stop thinking of Claude Code as a chatbot. Think of it as a junior dev that lives in your terminal.

  • CLAUDE.md = the onboarding doc you give a new hire
  • @ mentions = handing them the exact files they need
  • --max-turns = telling them how far to go before checking back in
  • /compact = clearing the whiteboard when it gets too cluttered

Once you think like that, you stop fighting it and start directing it.


If this helped you, drop a ⭐ and share it with someone using Claude Code.

Top comments (0)