A working cheat sheet for engineers who already live in a terminal (Codex, Aider, Cursor CLI…) and want the shortest path to being productive in Claude Code. Optimized for the things that actually change how you work — not an exhaustive flag dump.
Native installer is the default now (no npm required, self-updates). Log in with your Claude subscription (Pro/Max) or an API key.
# macOS / Linux
curl -fsSL https://claude.ai/install.sh | bash
# Windows (PowerShell)
irm https://claude.ai/install.ps1 | iex
# or via npm if you prefer
npm install -g @anthropic-ai/claude-code
cd your-repo
claude # interactive session in this repo
claude doctor # verify install, version, MCP health
claude update # manual update (auto-updates by default)
Run it from the repo root — Claude Code treats your working directory as its project scope and reads CLAUDE.md from there.
claude
> /init # generates CLAUDE.md from the codebase
> /model # pick model (Fable 5 default tier)
> /terminal-setup # Shift+Enter newlines, key fixes
> /statusline # model/branch/context in your prompt
Then ask a real question before asking for code: “give me an overview of this codebase”, “how does auth work here?”. Claude explores with its own search tools — you don’t feed it files manually.
Auth: /login uses your Claude.ai subscription; or set ANTHROPIC_API_KEY for API billing. /usage shows plan limits, /cost shows API spend.
Same genre, different defaults. Claude Code leans agentic-by-default: it searches, edits, and runs commands itself, gated by a permission system you tune rather than approve-every-step.
| You know (Codex) | Claude Code equivalent | Notes |
|---|---|---|
| codex | claude | Interactive REPL in cwd. |
| codex exec "…" | claude -p "…" | Headless “print mode”; add --output-format json for scripting. |
| AGENTS.md | CLAUDE.md | Same idea: persistent project instructions. CC also reads AGENTS.md if present, but CLAUDE.md is canonical and supports @file imports. |
| /approvals · --full-auto | Shift+Tab modes · --dangerously-skip-permissions | Cycle default → auto-accept edits → plan mode. YOLO flag exists; prefer sandboxed environments for it. |
| codex resume | claude -c / claude -r | -c continues the last session, -r opens a picker. /resume inside a session too. |
| model reasoning effort | Tab thinking toggle · /model | Extended thinking is toggled per-session; “think hard / ultrathink” in a prompt still scales reasoning budget. |
| custom prompts | Skills (.claude/skills/) + slash commands | Skills are folders of instructions + scripts that load on demand — more powerful than prompt snippets. See §09. |
@path/to/file if helpful, and let Claude explore. Course-correct early with Esc rather than letting a wrong direction run.There are ~50 built-ins; these are the ones experienced users actually run daily. Type / to fuzzy-search them all.
/clear — wipe context between unrelated tasks. The single highest-leverage habit./compact — summarize context; accepts focus hints: /compact keep the API design decisions./context — visualize what’s eating your context window./resume — picker for past sessions (also claude -c / -r from shell)./rewind — checkpoint time-machine: restore code, conversation, or both. Also EscEsc./init — bootstrap CLAUDE.md for the repo./model — switch model mid-session (Fable 5, Opus 4.8, Sonnet 4.6, Haiku 4.5)./fast — fast mode: Opus-quality output at much higher token speed. Great for long refactors./memory — open/edit CLAUDE.md files; # prefix adds a memory inline./permissions — view/edit allow & deny rules instead of clicking “yes” forever./add-dir — grant access to another directory (e.g. a sibling service)./code-review — review the current diff at an effort level (low→max); --fix applies findings; /code-review ultra launches a multi-agent cloud review of the branch or a PR./security-review — security pass over pending changes./simplify — reuse/simplification cleanup of the changed code (quality, not bug-hunting)./verify — actually run the app and observe that a change works./pr-comments — pull PR review comments into context./mcp — manage/authenticate MCP servers./agents — create custom subagents (own prompt, tools, context window)./plugin — browse marketplaces, install skill/command/agent bundles./hooks — wire shell commands to lifecycle events (format-on-edit, gate dangerous Bash)./install-github-app — set up @claude mentions on your GitHub repo./schedule — recurring or one-shot cloud agents on a cron (“run the triage routine every morning”)./loop — re-run a prompt/skill on an interval in-session (poll a deploy, babysit CI)./bashes — list/manage background shells (dev servers, tails)./todos — view the agent’s current task list./status — account, model, connectivity./doctor — health-check the install./usage / /cost — plan limits / API spend./export — export conversation to file/clipboard./vim — vim keybindings for the input. /config for everything else.The interrupt key is the steering wheel. Everything else is gravy.
/bashes).@ — fuzzy file reference (@src/auth/jwt.ts) — pulls the file into context.! prefix — bash mode: run a shell command yourself; output lands in context.# prefix — append a memory to CLAUDE.md (“# always use pnpm”)./terminal-setup); Ctrl+V — paste images for UI work.Reads are always free; edits and commands are gated by mode + your allow/deny rules. Tune rules once instead of approving forever.
| Mode | Behavior | Use when |
|---|---|---|
| Default | Asks before file edits and non-allowlisted commands. | Unfamiliar repo, risky surface area. |
| Accept edits Shift+Tab | File edits auto-approved; commands still gated. | The 90% case once you trust the plan. |
| Plan mode Shift+Tab×2 | Read-only research → produces a plan you approve before any mutation. Start it from the shell with claude --permission-mode plan. | Big or ambiguous changes. The best feature for non-trivial work — use it. |
Bypass --dangerously-skip-permissions | No prompts at all. | Containers/CI/sandboxes only. Pair with --allowedTools limits if you can. |
/permissions and allowlist what you trust — e.g. Bash(npm test:*), Bash(git diff:*), Edit. Rules live in .claude/settings.json (commit it to share with the team) or ~/.claude/settings.json (personal). The built-in /fewer-permission-prompts skill mines your history and proposes an allowlist for you.Claude Code is also a Unix tool: pipe data in, get JSON out, wire it into CI.
claude -c # continue last session
claude -r # resume picker
claude --model opus # or sonnet / haiku / full model id
claude --permission-mode plan # start read-only
claude --add-dir ../other-svc # extra working dirs
claude --allowedTools "Bash(git:*)" "Edit"
claude --append-system-prompt "Prefer functional style"
claude --dangerously-skip-permissions # sandboxes only
# one-shot, plain text out
claude -p "explain the failing test in CI logs"
# pipe anything in
cat error.log | claude -p "root-cause this stack trace"
# machine-readable
claude -p "lint my commit messages" --output-format json
claude -p "…" --output-format stream-json # NDJSON events
# CI example: auto-triage
gh issue view 42 --json title,body | \
claude -p "label and propose a fix plan" \
--allowedTools "Read" "Grep" "Bash(gh issue:*)"
Building something bigger? The Claude Agent SDK (TypeScript/Python) exposes the same harness programmatically.
Context is your scarcest resource. CLAUDE.md is how you stop re-explaining your repo every session.
~/.claude/CLAUDE.md # you, everywhere (style, tools)
./CLAUDE.md # project — commit it
./CLAUDE.local.md # project, personal (gitignored)
./packages/api/CLAUDE.md # subdir — loaded on demand
# imports keep it lean:
See @docs/architecture.md and @package.json
What belongs there: build/test commands, conventions Claude gets wrong, repo etiquette (“never commit to main”), gotchas. What doesn’t: anything derivable from the code. Keep it short — it’s loaded into every session; bloat costs you context and attention.
Iterate on it like a prompt: when Claude repeats a mistake, hit # and record the correction.
/clear between tasks. Stale context degrades quality more than anything else./compact focus on X at a natural breakpoint beats an automatic one mid-thought./context shows the breakdown when things feel sluggish (MCP tools are a common silent hog — disable unused servers).Field-tested patterns. The common thread: give Claude a target it can verify itself against — tests, a screenshot, a plan.
For anything non-trivial: Shift+Tab×2 into plan mode, ask it to research the change. Read the plan, push back, approve. Then let it implement in accept-edits mode and finish with commit and open a PR — it writes solid commit messages from the actual diff.
Skipping the plan step is the #1 cause of “it confidently did the wrong thing.”
Ask for failing tests first, from the spec — tell it explicitly not to write implementation. Commit the tests. Then: “make these pass; don’t modify the tests.” The red/green loop gives Claude an objective target, and it will iterate against it autonomously.
For UI: paste a mock (Ctrl+V), give it a way to see results (Playwright/Chrome DevTools MCP screenshots, or the /verify skill), and say “iterate until it matches.” Agents with eyes converge in 2–3 rounds; agents without them don’t.
git worktree add ../proj-auth feature/auth
cd ../proj-auth && claude
One Claude per worktree = independent tasks with zero collision. Many engineers run 2–4. The desktop app and claude.ai/code web sessions do the isolation for you for cloud-friendly tasks.
Long mechanical tasks (lint sweeps, codemods, dependency bumps): run in a devcontainer/Docker sandbox with --dangerously-skip-permissions and let it grind. Checkpoint with git; /rewind covers in-session mistakes, commits cover the rest.
Watch the first minute of work. Wrong direction? Esc, refine, go again. EscEsc to fork from an earlier checkpoint beats arguing with a session that’s gone sideways — and /clear beats both when the task changes.
/code-review on the branch before you push — at high effort for risky diffs, or ultra for a multi-agent cloud review of a whole PR. Pair with /security-review on auth/input-handling changes and /simplify to strip the AI-generated flab.
/install-github-app, then mention @claude on issues/PRs: “@claude fix the lint failures”, “@claude implement this issue”. It works in Actions, pushes a branch, opens a PR. Headless claude -p covers everything else in CI.
“Spin up subagents to investigate these three hypotheses in parallel” — each gets a fresh context, you get the conclusions. Define reusable ones with /agents (e.g. a code-reviewer with read-only tools) in .claude/agents/, committed for the team.
A skill is a folder with a SKILL.md (instructions + optional scripts/resources) that Claude loads only when relevant — zero context cost until triggered. Plugins bundle skills, commands, agents, hooks and MCP servers for one-command install. This is the ecosystem’s biggest differentiator — use it.
.claude/skills/deploy-checks/SKILL.md # project (committed)
~/.claude/skills/… # personal, all projects
# SKILL.md
---
name: deploy-checks
description: Pre-deploy validation for our k8s services.
Use before any production deploy.
---
1. Run ./scripts/preflight.sh
2. Verify migrations are reversible…
# plugin marketplaces
claude plugin marketplace add anthropics/skills
/plugin # browse & install in-session
The description is the trigger — write it like a “when to use” sentence. Invoke explicitly with /skill-name or just describe the task and let it fire.
anthropics/skills (official marketplace) — the document suite (pdf, docx, xlsx, pptx) produces real Office files via scripts instead of hallucinated markup; skill-creator scaffolds well-formed skills of your own; mcp-builder for writing MCP servers; webapp-testing for browser-driven verification.obra/superpowers — the most-adopted community pack: disciplined TDD, systematic debugging, brainstorming and planning workflows encoded as skills. Why: it gives Claude a process, not just knowledge — noticeably better on gnarly multi-step work.trailofbits/skills) — professional-grade static analysis & audit workflows (semgrep/CodeQL-style sweeps). Why: written by actual auditors; far stronger than “please review for security.”Audit third-party skills before installing — they’re instructions + executable scripts running with your permissions.
Model Context Protocol servers give Claude tools beyond the filesystem: your issue tracker, browser, DB, error tracker. Add with one command; OAuth handled via /mcp.
# remote (HTTP/SSE) servers
claude mcp add --transport http github \
https://api.githubcopilot.com/mcp/
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp add --transport sse linear https://mcp.linear.app/sse
# local (stdio) servers
claude mcp add playwright -- npx @playwright/mcp@latest
claude mcp add pg -- npx -y @bytebase/dbhub \
--dsn "postgresql://localhost:5432/app"
claude mcp list # /mcp in-session to auth & inspect
Scopes: --scope local (you, this repo — default), project (writes .mcp.json, committed for the team), user (you, everywhere).
gh (though gh via Bash is often enough).Every connected server’s tool list consumes context. Connect what you use; prune with /mcp when /context shows bloat.
Hooks are deterministic shell commands at lifecycle points — guarantees, not suggestions. Settings cascade: enterprise → project local → project → user.
// .claude/settings.json
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"hooks": [{ "type": "command",
"command": "npx prettier --write \"$CLAUDE_FILE_PATHS\"" }]
}],
"PreToolUse": [{
"matcher": "Bash",
"hooks": [{ "type": "command",
"command": "./scripts/block-prod-db.sh" }] // exit 2 = block
}]
}
}
Events: PreToolUse (can block), PostToolUse, UserPromptSubmit, Stop, SubagentStop, SessionStart, PreCompact, Notification. Classic uses: auto-format on every edit, block rm -rf/prod credentials, run typecheck when Claude says it’s done, desktop notify on permission prompts.
~/.claude/settings.json # you, global
.claude/settings.json # team, committed
.claude/settings.local.json # you, this repo (gitignored)
.mcp.json # team MCP servers
.claude/skills/ agents/ commands/ # committed extensions
Env vars to know: ANTHROPIC_API_KEY, ANTHROPIC_MODEL, CLAUDE_CODE_USE_BEDROCK=1 / CLAUDE_CODE_USE_VERTEX=1 (cloud-provider routing), BASH_DEFAULT_TIMEOUT_MS, DISABLE_TELEMETRY=1. Set them under "env" in settings.json to apply per-project.
A committed .claude/ directory is how you onboard the whole team at once — settings, permissions, hooks, skills, agents in one PR.
| Model | ID | Use for |
|---|---|---|
| Fable 5 | claude-fable-5 | Latest flagship; default for new sessions. Best judgment on large, ambiguous tasks. |
| Opus 4.8 | claude-opus-4-8 | Deep reasoning workhorse; supports /fast mode (same model, much faster output). |
| Sonnet 4.6 | claude-sonnet-4-6 | Speed/cost sweet spot; 1M-token context option for monorepo-scale sessions. |
| Haiku 4.5 | claude-haiku-4-5 | Cheap + fast: headless pipelines, subagent fan-outs, simple chores. |
/model; a common pattern is plan on Fable/Opus, implement on Sonnet./clear between tasks. A fresh context outperforms a polluted one, every time.auth.test.ts without widening the timeout.”/permissions once beats a hundred approvals./code-review + your own eyes; you still own the merge.