claude-code-cli

Claude Code CLI, on one page

Every command, mode, and file from the talk, checked against the current docs. Copy a line, paste it, and it runs.

/help for help · Welcome to the Claude Code cheat sheet
cwd: mrballistic.com/claude-code-cli-cheatsheet

Install (macOS, Linux, WSL)

curl -fsSL https://claude.ai/install.sh | bash

Try it: focus the box and press Shift+Tab

Try “add a dark mode toggle”

Claude asks before every edit and command.

Simulated. Bypass appears in the real cycle only after you enable it.

Prompts get you a draft. Specs get you the build.

Install and launch#

One native binary. It updates itself in the background.

  • macOS, Linux, WSL
    curl -fsSL https://claude.ai/install.sh | bash
  • Homebrew
    brew install --cask claude-code
  • Windows PowerShell
    irm https://claude.ai/install.ps1 | iex

Launch

Launch
CommandWhat it doesCopy
claudeStart an interactive session
claude "fix the failing test"Start with a first prompt
claude -cContinue the most recent conversation
claude -r auth-refactorResume a session by name or ID
claude -p "explain this repo"Print one answer and exit (scripts, CI)
cat error.log | claude -p "what broke?"Pipe input into a one-shot query
claude --versionCheck the installed version

Everyday commands#

Slash commands go in the Claude Code prompt. Type / to see them all as you go.

Slash commands

Slash commands
CommandWhat it doesCopy
/initWrite a starter CLAUDE.md from your codebase
/helpList every command
/modelSwitch models
/effortSet how hard the model thinks
/contextSee what’s filling the context window
/compactSummarize the conversation to free up context
/clearStart fresh in the same session
/resumePick up an earlier session
/rewindRoll back the conversation and file edits to an earlier point
/btwAsk a side question without adding it to the context
/code-reviewReview pending changes (alias /review); add --fix to apply
/usageSession cost, plan limits, activity (alias /cost)
/memoryEdit the CLAUDE.md files in play
/powerupInteractive lessons on features you haven’t tried
/doctorDiagnose your install and settings

Keyboard shortcuts

Keyboard shortcuts
KeysWhat it does
Shift+TabCycle permission modes
EscInterrupt Claude or close a dialog
EscEscClear the draft, or open rewind when it’s empty
Ctrl+RSearch prompt history
Ctrl+BSend a running task to the background
Ctrl+OOpen the full transcript
Ctrl+GEdit the prompt in your $EDITOR
Option+PSwitch model (Alt+P on Windows/Linux)
Option+TToggle extended thinking (Alt+T)
Option+OToggle fast mode (Alt+O)

Permission modes#

How much Claude may do without asking. Press Shift+Tab in a session to cycle, or start in a mode with --permission-mode.

Permission modes
ModeWhat it doesUse when
Manual--permission-mode defaultAsks before edits and commandsLearning a codebase, or anything risky
Edit automatically--permission-mode acceptEditsEdits files and runs basic file commands (mkdir, mv, cp) without asking; asks for everything elseYou trust the edits but want to see commands
Plan--permission-mode planReads and plans; no edits until you approve the planBefore a big change, or to understand code
Auto--permission-mode autoA classifier reviews each action and blocks risky ones; no prompts for the restWell-scoped work with a good CLAUDE.md
Don’t ask--permission-mode dontAskFlag or settings onlyRuns only pre-approved tools; denies anything that would promptScripts and CI with an allowlist
Bypass permissionsDanger--dangerously-skip-permissionsIn the cycle only once enabledNo prompts, no checks. Deny rules still apply.Throwaway containers and VMs only

Auto mode

“Seatbelts, not a force field.”

How it works
Before each action runs, a classifier (Sonnet 5 by default) checks it against your request and blocks anything destructive or out of scope. It’s a safety net, not a sandbox.
Who gets it
All plans, on supported models. On by default for Team and Enterprise; admins can turn it off. Recent versions start interactive sessions in auto mode.
  • Interactive

    claude --permission-mode auto
  • Headless

    claude -p "run the tests and fix failures" --permission-mode auto

CLAUDE.md#

A markdown file Claude reads at the start of every session: what the project is, how to build it, and what not to touch. Run /init to draft one.

Where it lives

./CLAUDE.md
Project, committed with the repo (or ./.claude/CLAUDE.md)
./CLAUDE.local.md
Project, just for you (gitignored)
~/.claude/CLAUDE.md
You, across every project
.claude/rules/*.md
Topic rules, optionally scoped to paths

Pull other files in with @path/to/file. A CLAUDE.md in a subfolder loads when Claude works there.

What makes one good

Be specific
“Use snake_case for database columns” beats “follow our conventions.”
Say what not to do
Constraints prevent more mistakes than instructions do.
Keep it current
When Claude gets something wrong twice, the fix belongs here.
CLAUDE.md
# CLAUDE.md

## Project Overview
What this project does, in two sentences.

## Build & Run
```bash
npm run dev        # Development
npm run build      # Production build
npm test           # Run tests
```

## Architecture
Key patterns, file layout, data flow.

## Conventions
- Naming, imports, file organization
- See @docs/style-guide.md

## What NOT To Do
- Anti-patterns specific to this project
- Files and directories never to touch

Skills#

A folder with a SKILL.md: instructions, and optionally scripts and reference files. Claude loads one when its description matches the task, or you run it as /skill-name.

.claude/skills/release-notes/SKILL.md
---
name: release-notes
description: Draft release notes from merged PRs. Use when the user asks for a changelog or release notes.
disable-model-invocation: false
---

# Release notes

1. List PRs merged since the last tag.
2. Group them: features, fixes, chores.
3. Write one plain sentence per change.

Where they live

.claude/skills/<name>/SKILL.md
This project
~/.claude/skills/<name>/SKILL.md
Every project
The description is the trigger
Claude decides whether to load a skill from its description alone, so say when to use it.
Skills are slash commands
Every skill can be run as /name. Add disable-model-invocation: true for skills you only want to run by hand.
An open standard
Skills follow the Agent Skills format, so the same folder works in other tools that support it.

Find more

Plugins#

A plugin bundles skills, commands, hooks, agents, and MCP servers into one install. Browse with /plugin. These two are the author’s picks.

Superpowers

By Jesse Vincent and Prime Radiant · github.com/obra/superpowers

Makes Claude brainstorm, plan, and test before it writes code, then review before it ships.

/plugin install superpowers@claude-plugins-official

The workflow it enforces

  1. BrainstormPin down what you actually want
  2. Design docWrite the spec down
  3. WorktreeIsolate the work on a branch
  4. PlanBreak the spec into small steps
  5. TDDFailing test first, then the code
  6. SubagentsHand steps to fresh agents
  7. ReviewCheck the work against the plan
  8. FinishMerge, PR, or clean up

Skills you’ll see it use

brainstorming
Questions before code
writing-plans
Specs broken into bite-size tasks
test-driven-development
Red, green, refactor
subagent-driven-development
One fresh agent per task
requesting-code-review
Review against the plan
finishing-a-development-branch
Merge or PR, then clean up

Impeccable

By Paul Bakaus · impeccable.style

Gives Claude a design vocabulary: critique a page, audit it for accessibility, then polish, simplify, or push it bolder.

/plugin marketplace add pbakaus/impeccable
/plugin install impeccable@impeccable

Commands worth starting with

Commands worth starting with
CommandWhat it doesCopy
/impeccable critiqueScored design review with priority fixes
/impeccable auditAccessibility, performance, responsive checks
/impeccable polishFinal pass before shipping

This page’s redesign started with /impeccable critique. It scored the old version 19 out of 40.

MCP servers#

The Model Context Protocol connects Claude to tools and data outside the repo: GitHub, browsers, databases, docs. Remote servers use HTTP; local ones run as a process (stdio).

Add a server

  • Remote (HTTP)

    claude mcp add --transport http my-server https://api.example.com/mcp
  • Local process (stdio)

    claude mcp add --transport stdio my-server -- npx -y my-mcp-server
  • From JSON

    claude mcp add-json my-server '{"type":"stdio","command":"npx","args":["-y","my-mcp-server"]}'

Scopes

Scopes
ScopeStored inApplies to
Local(default)~/.claude.jsonYou, in this project only
Project--scope project.mcp.jsonEveryone on the repo (commit it)
User--scope user~/.claude.jsonYou, in every project

Popular servers

  • GitHub · Issues, PRs, code search (GitHub’s hosted server)

    claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_GITHUB_PAT"
  • Playwright · Drive a real browser

    claude mcp add playwright -- npx @playwright/mcp@latest
  • Context7 · Current docs for the libraries you use

    claude mcp add --transport stdio context7 -- npx -y @upstash/context7-mcp
  • Brave Search · Web search

    claude mcp add --transport stdio --env BRAVE_API_KEY=YOUR_KEY brave -- npx -y @brave/brave-search-mcp-server
  • Filesystem · Files outside the project

    claude mcp add --transport stdio filesystem -- npx -y @modelcontextprotocol/server-filesystem ~/notes
  • Sequential Thinking · Step-by-step reasoning scratchpad

    claude mcp add --transport stdio thinking -- npx -y @modelcontextprotocol/server-sequential-thinking

Manage

Manage
CommandWhat it doesCopy
claude mcp listList configured servers
claude mcp get <name>Show one server’s config
claude mcp remove <name>Remove a server
/mcpStatus and sign-in, inside a session

Build your own (Python, FastMCP)

server.py
from fastmcp import FastMCP

mcp = FastMCP("my-tools")

@mcp.tool
def search_docs(query: str) -> str:
    """Search project documentation."""
    return f"No results for {query!r} yet."

if __name__ == "__main__":
    mcp.run()

Spec and SDKs: modelcontextprotocol.io

Hooks#

Commands that run on Claude Code events, every time, whatever the model decides. Configure them in .claude/settings.json or with /hooks.

Events you’ll use most

Events you’ll use most
EventFiresCopy
SessionStartWhen a session starts or resumes
UserPromptSubmitBefore Claude sees your prompt
PreToolUseBefore a tool runs (can block it)
PermissionRequestWhen a permission prompt would appear
PostToolUseAfter a tool succeeds
NotificationWhen Claude needs your attention
StopWhen Claude finishes responding
PreCompactBefore the context is compacted

There are about 30 more, from SubagentStop to FileChanged.Full list

Handlers can be a shell command, an HTTP call, an MCP tool, or a prompt for a model to judge.

Format every edit

Runs Prettier on each file Claude writes. The file path arrives as JSON on stdin.

.claude/settings.json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
          }
        ]
      }
    ]
  }
}

Tell me when it’s done

A macOS notification each time Claude stops.

~/.claude/settings.json
{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Claude is done\" with title \"Claude Code\"'"
          }
        ]
      }
    ]
  }
}

Subagents#

Claude can hand work to subagents. Each gets its own context window, tools, and instructions, and returns only a summary, so your main context stays clean.

Built in

Explore
Fast, read-only search across the codebase
Plan
Research for plan mode
general-purpose
Multi-step tasks that need every tool

Write your own

A markdown file in .claude/agents/ (this project) or ~/.claude/agents/ (every project). Ask Claude to write one.

.claude/agents/test-runner.md
---
name: test-runner
description: Runs the test suite and fixes failures. Use after code changes.
tools: Read, Edit, Bash
model: sonnet
---

Run the tests. For each failure, find the cause,
fix it, and re-run until the suite passes.
Report what you changed.

Links#

The official docs, the repos mentioned above, and a skill from the talk.

Download

  • prd-writer

    Writes PRDs precise enough for Claude Code to build from unattended: structured sections, quality gates, stack defaults.

    Download skill

Read more