Every Claude Code Command and Shortcut in One Place
Stop reading about it. Build something.
Bookmark this page. It covers every major Claude Code command, shortcut, CLAUDE.md directive, and workflow pattern you need for productive daily development.
Claude Code's most essential commands include /init (generate CLAUDE.md), /compact (compress context), /cost (check session usage), and /review (code review). For daily workflow, the key patterns are: start with claude in your project directory, approve changes with y, and use /clear to reset context when switching tasks.
Slash Commands
Type these inside an active Claude Code session. Press Tab to autocomplete.
/helpShow all available slash commands/clearClear conversation history and start fresh/compactCompress conversation to save context window space/memoryView and manage memory files Claude is tracking/modelSwitch between Claude models (opus, sonnet, haiku)/costShow token usage and cost for the current session/doctorDiagnose Claude Code configuration issues/initInitialize a new CLAUDE.md in the current directory/reviewRun a code review on staged or specified files/commitGenerate a commit message and stage changesCLI Flags
Flags you pass to the claude command at startup.
--print / -pPrint Claude's response to stdout without interactive mode--modelSpecify model: claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5--no-waitFor Vercel deploys — avoids hanging log streams--dangerously-skip-permissionsSkip all permission prompts (CI/CD pipelines only)--add-dirAdd a directory to Claude's allowed read paths--max-turnsCap agentic turns for automated runsCLAUDE.md Sections
Recommended sections for your CLAUDE.md. Claude reads this file at session start — make every line count.
## CommandsBuild, test, lint, and deploy commands Claude should know## Style GuideCode formatting, naming conventions, preferred libraries## ArchitectureTech stack, database patterns, auth setup## ContextWho is the developer, what is the project, what matters most## Don'tsExplicit constraints — never select("*"), never shell=True, etc.@path/to/file.mdImport another Markdown file into CLAUDE.md scopeKeyboard Shortcuts
Power User Patterns
Check what Claude remembers before diving in. Stale memory entries cause bad output. Delete outdated entries before they corrupt your session.
Context window pressure is real. Running /compact mid-session compresses history without losing the important bits. Cheaper and faster than starting over.
claude -p 'review this diff for security issues' < git.diff pipes cleanly into shell scripts. Use it in pre-commit hooks, CI checks, or batch review pipelines.
Root CLAUDE.md for project-wide rules. Subdirectory CLAUDE.md for module-specific context. Claude reads both — narrower files override broader ones.
Switch to Haiku for rename, format, or boilerplate tasks. Faster, cheaper, and frees Sonnet/Opus quota for complex reasoning work.
Frequently Asked Questions
What are the most useful Claude Code commands?
The essential commands are /init (generate config), /compact (compress context), /cost (check usage), /model (switch models), /review (code review), and /clear (reset context).
Can I create custom Claude Code commands?
Yes. Add markdown files to .claude/commands/ in your project. Each file becomes a slash command that Claude can execute with predefined instructions.
How do I check Claude Code API costs?
Use /cost during any session to see token usage and estimated cost. Claude Code also shows a cost summary when you exit a session.
What is the best way to manage context in Claude Code?
Use /compact to compress your conversation when context gets long, /clear to reset entirely, and CLAUDE.md to provide persistent project context that loads automatically every session. Structure your CLAUDE.md with build commands, coding conventions, and architecture notes.
How do I switch models in Claude Code?
Use /model to switch between Claude models during a session. Use Haiku for simple file operations, Sonnet for standard coding tasks, and Opus for complex multi-file reasoning. This optimizes both cost and quality per task.
Learn Claude Code hands-on
Free interactive lessons. No credit card required.