1. cheat-sheets
  2. /claude code-commands

Claude Code Commands

Terminal commands and slash commands for Claude Code sessions. Verify with claude --help on your installed version.

Last reviewed: June 2026

Full guide: Claude Code · Commands change between releases.

CLI launch

CommandPurpose
claudeStart interactive session in cwd
claude -p "prompt"Print mode — single response, exit
claude --continueResume last conversation
claude --model <id>Override model for session
claude --helpList flags for your version

In-session slash commands

Commands vary by version. Common ones (confirm in-app with /help):

CommandPurpose
/helpList available slash commands
/clearClear conversation context
/compactSummarize context to free tokens
/costShow session token usage (if enabled)
/modelSwitch model mid-session
/memoryView or edit project memory (if enabled)
/initGenerate CLAUDE.md from repo (if enabled)

Prompt patterns

TaskExample
Scoped fixFix the failing test in src/foo.test.ts only. Run npm test after.
Plan firstPropose a plan only — do not edit files yet.
ReviewReview git diff against main for security issues. Checklist format.
CommitStage only src/lib/foo.ts and write a Conventional Commit message.

See Prompting for Code and AI Prompting.

Project files

FilePurpose
CLAUDE.mdProject instructions (Claude Code reads at start)
AGENTS.mdOften read by Claude Code and other agents
.claude/settings.jsonHooks, MCP servers, permissions

Mirror stack/commands from AGENTS.md Template.

Hooks (settings.json)

HookUse
before_file_writeBlock protected paths
after_file_writeRun linter
Custom scriptsAudit log agent edits

Example pattern in Claude Code guide.

MCP

Add mcpServers to Claude Code settings — same JSON shape as MCP Config Cheat Sheet.

Skills

Invoke with /skill-name or rely on auto-discovery. Author in .cursor/skills/ or Claude skills path — see Agent Skills.

CI / headless

PatternNotes
claude -p "..."Scriptable one-shot
Claude Code SDKCustom pipelines — verify SDK docs
Read-only checkoutScope files in prompt; no auto-merge

See AI in CI/CD.