AI · Claude Code · Cheat Sheet

Claude Code cheat sheet.

Install, keybindings, slash commands, skills, hooks, MCP, subagents, plan mode — the working reference for the CLI I live in.

The ultimate reference for Claude Code. Everything here is what the fleet actually runs — 13 sites shipped, 60+ skills in production, and the guardrails that keep the harness stable. Copy freely.

Install & first run

6 entries
  • npm i -g @anthropic-ai/claude-code

    Install the CLI globally. Requires Node ≥ 20.

  • claude

    Launch the interactive TUI in the current directory.

  • claude /login

    Sign in with your Anthropic account (browser flow).

  • claude --version

    Print CLI version. Update often — releases ship weekly.

  • claude update

    Self-update the CLI to the latest release.

  • claude doctor

    Diagnose install / permissions / MCP issues.

Everyday keybindings

8 entries

The TUI layer — the muscle memory you build in week one pays back forever.

  • Enter

    Send the current prompt.

  • Shift + Enter

    Newline inside the prompt (multiline).

  • Ctrl + C

    Cancel the running turn (interrupt tool calls).

  • Ctrl + D

    Exit the session cleanly.

  • Esc

    Cancel autocomplete / close popups.

  • Up / Down

    Cycle through prior prompts in this session.

  • !

    Prefix a line to run it as a raw shell command (result lands in context).

  • #

    Prefix to send a system-style note to the model without asking for action.

Built-in slash commands

15 entries

Everything with a leading slash is either built-in or a skill. Type / to see the picker.

  • /help

    Full command list + docs pointers.

  • /clear

    Reset the current context window (keeps CLAUDE.md loaded).

  • /compact

    Manually compact history when you're low on tokens.

  • /config

    Open the settings UI (theme, model, permissions).

  • /model

    Switch model mid-session (Opus / Sonnet / Haiku).

  • /fast

    Toggle Fast mode on Opus 4.6/4.7 — faster output, same model.

  • /init

    Create a CLAUDE.md scaffold from the current codebase.

  • /review

    Review a pull request.

  • /mcp

    List + manage MCP servers for this session.

  • /hooks

    Inspect + edit the hook settings for this project.

  • /agents

    List available subagents and their tool policies.

  • /goal

    Set a session-scoped goal with a Stop hook that keeps you focused.

  • /loop

    Run a prompt or slash command on a recurring interval.

  • /schedule

    Schedule a remote agent (routine) on a cron.

  • /push

    Push the current branch to origin with a pre-push summary.

CLAUDE.md — persistent context

5 entries

The single most-leveraged file in the harness. Anything here is loaded every session.

  • ~/CLAUDE.md

    User-scope preferences — applies to every project.

  • ./CLAUDE.md

    Project-scope — checked into the repo, applies to all contributors.

  • ./.claude/CLAUDE.local.md

    Local-only overrides — .gitignore'd, per-machine.

  • Keep it small

    Under ~200 lines. Model reads it every turn — bloat costs tokens forever.

  • Rules > prose

    Bulleted 'always / never' rules land better than paragraphs of context.

Skills

5 entries

Reusable, invocable workflows. Live in ~/.claude/skills/<name>/SKILL.md.

  • ~/.claude/skills/<name>/SKILL.md

    The skill definition — name, description, args, body.

  • description: field

    The router. Write it as trigger phrases, not a summary.

  • /skill-creator

    Meta-skill to create, edit, test, and optimize other skills.

  • plugin:skill form

    Fully-qualified name for plugin-namespaced skills.

  • Args string

    Everything after the skill name is passed as one args string.

Hooks

8 entries

Deterministic shell scripts that fire around tool calls. Run outside the model loop.

  • PreToolUse

    Fires before a tool runs — can block or mutate arguments.

  • PostToolUse

    Fires after — good for lint, format, dry-run gates.

  • UserPromptSubmit

    Injects a system reminder each time the user submits.

  • Stop

    Blocks the session from ending until a condition holds (used by /goal).

  • SessionStart / SessionEnd

    Set up / tear down env, log, or announce.

  • .claude/settings.json

    Project-scope hook config (checked into the repo).

  • .claude/settings.local.json

    Local-only overrides — not committed.

  • /update-config

    Skill that safely edits settings.json for you.

MCP — external tools

6 entries

Model Context Protocol. Adds tools + resources from external services into the session.

  • claude mcp add <name>

    Register an MCP server (stdio or HTTP).

  • claude mcp list

    List configured MCP servers and their status.

  • claude mcp remove <name>

    Deregister a server.

  • mcp__<server>__<tool>

    Naming convention for MCP-provided tools in the session.

  • ListMcpResourcesTool

    Enumerate readable resources exposed by a server.

  • ReadMcpResourceTool

    Fetch a resource by URI.

Subagents

7 entries

Isolated sub-Claude instances with their own context + tool policy. Great for parallel work.

  • ~/.claude/agents/<name>.md

    Subagent definition — tools, model, description.

  • subagent_type: Explore

    Fast read-only search subagent (files + grep + read).

  • subagent_type: Plan

    Architect subagent — designs step-by-step plans.

  • subagent_type: general-purpose

    Wildcard — research or multi-step tasks.

  • Agent tool

    Launch a subagent from the main loop; get back a summary.

  • run_in_background: true

    Fire-and-forget parallel subagent (notified when done).

  • isolation: worktree

    Run in an isolated git worktree; auto-cleanup on no-change.

Plan mode

4 entries

Read-only exploration and planning. No writes until you exit the mode.

  • EnterPlanMode

    Switch into plan mode (usually via UI or a slash command).

  • ExitPlanMode

    Commit to a plan and get approval before implementing.

  • Use for big refactors

    Ask for a plan before letting Claude touch files.

  • Combine with subagents

    Send Plan-mode reads to subagents, keep main context clean.

Sessions & scheduling

5 entries
  • /loop <interval> <cmd>

    Run a slash command every interval, e.g. `/loop 5m /watch-ci`.

  • /loop <cmd>

    Self-paced loop — Claude decides when to fire next.

  • /schedule

    Create a remote scheduled agent (routine) on a cron.

  • CronCreate / CronList / CronDelete

    Tool-level control over scheduled agents.

  • ScheduleWakeup

    In-loop tool to pick the next wake time in dynamic loops.

Git workflow

5 entries

Claude Code is git-aware. These are the guardrails the harness enforces.

  • Always new commits

    Never --amend or force-push unless the user explicitly asks.

  • Never --no-verify

    Hook failures are fixed at the root, not bypassed.

  • Add files by name

    Prefer `git add file1 file2` over `git add .` to avoid secrets.

  • gh pr create

    Use gh for PR/issues/checks — never guess GitHub URLs.

  • Co-Authored-By: Claude

    Commit trailer the CLI appends by default.

Permissions

5 entries

Fine-grained control over which tools + shell commands auto-approve.

  • /permissions

    Open the permissions UI.

  • acceptEdits

    Auto-accept file edits (careful — pair with plan mode).

  • denyEdits

    Block all edits (read-only mode).

  • permissions.allow[]

    Explicit allowlist of shell / tool patterns in settings.json.

  • /fewer-permission-prompts

    Skill that scans your transcript and adds safe allowlist entries.

Agent SDK & Managed Agents

4 entries

Building your own agent? Both paths use the same primitives as Claude Code.

  • npm i @anthropic-ai/claude-agent-sdk

    The SDK Claude Code itself is built on.

  • Managed Agents

    Anthropic-hosted agent runtime (April 2026 launch).

  • Same tool contract

    Skills, hooks, MCP all portable between local + managed.

  • /ama

    Master agent skill for learning Managed Agents end-to-end.

Common gotchas

5 entries

Bugs the fleet hit so you don't have to.

  • OpenRouter fallback orderAIOS

    Paid model first, then :free — free models 429 under load.

  • vercel link hangs

    Add --non-interactive to CLI shells; --yes alone hangs.

  • Vercel injects AWS_REGION

    Set S3_REGION explicitly or S3 mis-targets us-east-1.

  • WSL headed Chromium

    Don't run Playwright headed via WSLg — crashes low-RAM laptops.

  • Mongo 500-coll cap

    Central cluster near 500/500 — fold to FLEET shape, don't add new collections.

Some entries reference internal fleet tooling (AIOS, APPAI, ABC skills). If you don't have those, the primitives (skills / hooks / MCP / subagents) still apply verbatim to any Claude Code install.