cc101 チートシートcc101 Cheat Sheet
Claude Code の「あれ、なんだっけ?」を 1 枚で解決。印刷してモニタの横にどうぞ。Every "wait, what was that command?" moment, solved on one page. Print it and keep it next to your monitor.
インストール & 更新Install & update
| コマンドCommand | 説明What it does |
|---|---|
curl -fsSL https://claude.ai/install.sh | bash | ネイティブインストール(推奨・自動更新つき)Native installer (recommended; auto-updates) |
brew install --cask claude-code | Homebrew 版(更新は手動)Homebrew cask (manual updates) |
npm install -g @anthropic-ai/claude-code | npm 版(Node.js 22+ が必要・sudo 禁止)npm install (needs Node.js 22+; never sudo) |
claude --version | バージョン確認(インストール成功の合図)Check version (proof the install worked) |
claude update | 今すぐ手動アップデートApply an update right now |
brew upgrade claude-code | Homebrew 版のアップデートUpdate the Homebrew install |
claude doctor | 総合診断(--text で読みやすい出力)Full diagnostics (--text for friendlier output) |
which -a claude | 重複インストールの発見(古い版が残っている時)Find duplicate installs (when an old version lingers) |
sw_vers | macOS バージョン確認(13.0 以上が必要)Check macOS version (13.0+ required) |
セッションの開始と再開Starting & resuming sessions
| コマンドCommand | 説明What it does |
|---|---|
claude | 対話セッションを開始Start an interactive session |
claude "fix the login bug" | 最初のプロンプト付きで開始Start with an initial prompt |
claude -c / --continue | このディレクトリの直近の会話を続行Continue the most recent conversation here |
claude -r / --resume | 保存済みセッションのピッカーを開くOpen the saved-session picker |
claude --resume "auth-refactor" | 名前や ID を指定して再開Resume by name or ID |
claude -n "auth-refactor" | 名前を付けて開始(ピッカーで見つけやすく)Start a named session (easy to find later) |
claude --from-pr 42 | PR にひもづいたセッションを再開Resume the session linked to a PR |
claude -p "explain this code" | 一回きりの実行:答えを出力して終了Print mode: answer once, then exit |
cat file.txt | claude -p "summarize" | パイプで入力を渡すPipe input straight in |
claude --permission-mode plan | プランモード(読み取り専用)で開始Start in plan mode (read-only) |
claude --model opus | モデルを指定して開始Start with a specific model |
claude --worktree feature-auth | worktree を作って並行作業Spin up a git worktree for parallel work |
終了はどれでも:⌃ Ctrl + D、/exit(または /quit)、⌃ Ctrl + C を 2 回。
Exit any of these ways: ⌃ Ctrl + D, /exit (or /quit), or ⌃ Ctrl + C twice.
セッション内キーボード & 入力プレフィックスIn-session keys & input prefixes
キーボードKeyboard
| キーKey | 説明What it does |
|---|---|
| ⎋ Esc | Claude の応答を途中で止める(作業内容は保持)Stop Claude mid-response (work so far is kept) |
| ⎋ Esc ⎋ Esc | 下書きをクリア。入力が空ならチェックポイントに巻き戻しClear the draft; if input is empty, rewind to a checkpoint |
| ⇧ Shift + Tab | 権限モードを切替:default → acceptEdits → plan → …Cycle permission modes: default → acceptEdits → plan → … |
| ⇧ Shift + ⏎ Enter | 複数行入力(⌃ Ctrl + J や \ + ⏎ でも可)Multiline input (⌃ Ctrl + J or \ + ⏎ also work) |
| ⌃ Ctrl + C | 1 回で入力クリア、2 回でセッション終了Once clears input; twice exits the session |
| ⌃ Ctrl + R | 履歴を逆方向検索Reverse-search command history |
| ⌃ Ctrl + O | トランスクリプト表示(ツール呼び出しの詳細)Toggle transcript view (detailed tool calls) |
| ⌃ Ctrl + T | Claude のタスクリストを表示/非表示Toggle Claude's task list |
| ⌃ Ctrl + B | 実行中の Bash コマンドをバックグラウンドへSend a running Bash command to the background |
| ⌃ Ctrl + G | プロンプトやプランを $EDITOR で編集Edit your prompt or plan in $EDITOR |
| ⌃ Ctrl + L | 画面を再描画(表示乱れの修復)Redraw the screen (fixes garbled display) |
| ⌥ Option + P | モデルピッカーを開く(要 Option=Meta 設定)Open the model picker (needs Option-as-Meta) |
| ⌥ Option + T | 拡張思考の ON/OFF(Fable 5 には効果なし)Toggle extended thinking (no effect on Fable 5) |
| ⌃ Ctrl + V | 画像をペースト(iTerm2 では ⌘ Cmd + V)Paste an image (in iTerm2 use ⌘ Cmd + V) |
⌥ Option 系ショートカットは初期設定では動きません。iTerm2:Settings → Profiles → Keys → Option キーを「Esc+」に。Terminal.app:Settings → Profiles → Keyboard →「Use Option as Meta Key」にチェック。
⌥ Option shortcuts don't work out of the box. iTerm2: Settings → Profiles → Keys → set the Option keys to "Esc+". Terminal.app: Settings → Profiles → Keyboard → check "Use Option as Meta Key".
入力プレフィックスInput prefixes
| 先頭文字Prefix | 説明What it does |
|---|---|
/ | スラッシュコマンド。/mo のように打つと絞り込み検索Slash commands. Type /mo to filter the list as you go |
! | シェルモード:コマンドを直接実行し、出力を会話に追加。Tab で履歴補完、⎋ Esc で解除Shell mode: run a command directly and add its output to the chat. Tab completes from history; ⎋ Esc exits |
# | メモリに追加:.claude/memory/ に保存され、次回以降も自動で読み込まれるAdd to memory: saved under .claude/memory/ and auto-loaded in future sessions |
@ | ファイル参照のあいまい補完(@auth.ts など)Fuzzy file references (e.g. @auth.ts) |
スラッシュコマンド(よく使う約 20 個)Slash commands (the ~20 you'll actually use)
| 🗂 セッション🗂 Session | |
|---|---|
/clear | まっさらな会話を開始(前の会話は /resume に保存)Start fresh (previous chat is saved for /resume) |
/resume | 名前・ID で再開、または一覧から選択Resume by name/ID, or pick from the list |
/rename | セッションに表示名を付けるGive the session a display name |
/rewind | コードと会話をチェックポイントへ巻き戻しRoll code and conversation back to a checkpoint |
/exit / /quit | セッションを終了Exit the session |
| 🧠 モデル & コンテキスト🧠 Model & context | |
/model | モデルを切替(引数なしでピッカー表示)Switch models (no argument opens the picker) |
/effort | 推論の深さを設定:low / medium / high / xhigh / maxSet reasoning depth: low / medium / high / xhigh / max |
/context | トークン使用量をグリッド表示+最適化のヒントVisualize token usage as a grid + optimization hints |
/compact | 会話を要約して空きを作る(焦点の指示も可)Summarize the chat to free space (optional focus) |
/usage | セッションのコストと利用状況(/cost /stats も同じ)Session cost & usage (/cost and /stats are aliases) |
| 📝 メモリ & 設定📝 Memory & setup | |
/init | CLAUDE.md をひな形から自動生成Generate a starter CLAUDE.md |
/memory | CLAUDE.md と自動メモリを閲覧・編集View & edit CLAUDE.md and auto-memory |
/permissions | allow / ask / deny ルールを管理Manage allow / ask / deny rules |
/config | 設定 UI を開く、または key=value で直接設定Open settings UI, or set key=value directly |
/mcp | MCP サーバの接続・認証・有効/無効Connect, authenticate, enable/disable MCP servers |
/hooks | 設定済み hooks の一覧を表示List configured hooks |
| 🔧 ワークフロー🔧 Workflow | |
/plan | プランモードに入る(読み取り専用で計画)Enter plan mode (read-only planning) |
/diff | 対話型 diff ビューアInteractive diff viewer |
/code-review | 差分をバグ・改善点でレビューReview your diff for bugs and cleanups |
/export | 会話をテキストで書き出しExport the conversation as plain text |
/btw | 履歴に残さずサッと質問Ask a quick side question without touching history |
| 🩺 ヘルプ & おまけ🩺 Help & fun | |
/help | コマンド一覧とヘルプShow help and available commands |
/status | バージョン・モデル・アカウント・接続状態Version, model, account, connectivity |
/doctor | インストールと設定を診断Diagnose installation and settings |
/radio | Claude FM(lo-fi ラジオ)を再生 📻Open Claude FM lo-fi radio 📻 |
/ を打つだけで全コマンドが検索できるので、この表すら覚えなくて大丈夫。/mo と打てば /model や /mcp に一瞬で絞り込まれます。
Type / and the whole catalog becomes searchable — you don't even need to memorize this table. Typing /mo instantly narrows to /model, /mcp, and friends.
メモリ & CLAUDE.md ファイル地図Memory & the CLAUDE.md file map
| 場所Location | 役割(読み込み順)Role (load order) |
|---|---|
/Library/Application Support/ClaudeCode/CLAUDE.md | 組織の管理ポリシー(ユーザーは編集不可)Managed org policy (not user-editable) |
~/.claude/CLAUDE.md | あなた専用・全プロジェクト共通のルールYour personal rules for every project |
./CLAUDE.md | プロジェクト共有(git にコミット、./.claude/CLAUDE.md も可)Team-shared, checked into git (./.claude/CLAUDE.md also works) |
./CLAUDE.local.md | 個人用の上書きメモ(.gitignore に追加する)Personal-only notes (add to .gitignore) |
./src/CLAUDE.md | サブディレクトリ用。そこを触るときだけ遅延ロードNested; lazy-loaded only when Claude works there |
.claude/memory/ | # プレフィックスの保存先(自動メモリ)Where # memory entries land (auto-memory) |
@path構文で他ファイルを取り込み可能(再帰は最大 4 ホップ)。例:@docs/git-instructions.mdImport other files with@path(recursive up to 4 hops), e.g.@docs/git-instructions.md- 自動メモリは先頭 200 行または 25KB までがセッション開始時に読み込まれますAuto-memory loads its first 200 lines or 25 KB at session start
- CLAUDE.md は 200 行以下が目安。短いほど守られやすいKeep CLAUDE.md under ~200 lines — shorter files are followed better
設定ファイルと権限ルール構文Settings files & permission rule syntax
| ファイルFile | スコープ(上ほど優先)Scope (higher wins) |
|---|---|
/Library/Application Support/ClaudeCode/managed-settings.json | 組織の管理設定(上書き不可)Managed policy (cannot be overridden) |
--model などの CLI フラグCLI flags like --model | そのセッション限りの上書きSession-only override |
.claude/settings.local.json | プロジェクト個人設定(git 管理外)Personal project settings (gitignored) |
.claude/settings.json | プロジェクト共有設定(git にコミット)Team-shared project settings (committed) |
~/.claude/settings.json | ユーザー全体の既定値Your global defaults |
{
"permissions": {
"allow": ["Bash(npm run *)", "Read(.claude/**)"],
"ask": ["Bash(rm *)"],
"deny": ["Read(~/.ssh/**)"]
}
}| ルール例Rule | 意味Meaning |
|---|---|
Bash(npm run *) | npm run で始まるコマンドCommands starting with npm run |
Bash(ls *) vs Bash(ls*) | 前者は単語区切りあり(lsof は対象外)、後者はなしFirst has a word boundary (won't match lsof); second doesn't |
Edit(src/**) | プロジェクトの src/ 以下の編集Edits under the project's src/ |
Read(~/.ssh/**) | ホームの .ssh 以下の読み取りReads under ~/.ssh |
WebFetch(domain:github.com) | github.com へのアクセスのみWeb requests to github.com only |
mcp__github__* | github MCP サーバの全ツールAll tools from the github MCP server |
- 評価順:deny が常に最優先 → ask → allow。allow で deny は突破できませんEvaluation order: deny always wins → ask → allow. An allow rule can never override a deny
- パスの起点:
/path=設定ファイル基準、~/path=ホーム、//path=絶対パス、path=作業ディレクトリPath anchors:/path= relative to the settings file,~/path= home,//path= absolute,path= working directory
Hooks イベント一覧Hook events at a glance
| イベントEvent | 発火タイミングFires when |
|---|---|
SessionStart / SessionEnd | セッション開始(matcher: startup / resume / clear / compact)・終了Session begins (matcher: startup / resume / clear / compact) or ends |
UserPromptSubmit | あなたがプロンプトを送信した直後Right after you submit a prompt |
PreToolUse / PostToolUse | ツール実行の直前・直後(matcher はツール名。ブロック可能)Before/after any tool call (matcher = tool name; can block) |
FileChanged | ファイルの作成・変更(matcher はファイル名パターン)A file is created or modified (matcher = filename pattern) |
Stop / StopFailure | Claude の応答完了・失敗Claude finishes a response / a response fails |
Notification | 通知の表示(matcher: permission_prompt など)A notification is shown (matcher: permission_prompt, etc.) |
SubagentStart / SubagentStop | サブエージェントの開始・終了A subagent starts or finishes |
PreCompact | コンテキスト圧縮の直前Just before context compaction |
CwdChanged / WorktreeCreate / Setup | 作業ディレクトリ変更・worktree 作成・セットアップ処理Working dir changes / a worktree is created / setup flows |
- 終了コード:
0=成功(stdout の JSON を処理)、2=ブロック(stderr が Claude に渡る)、その他=非ブロックのエラーExit codes:0= success (JSON on stdout is processed),2= block the action (stderr goes to Claude), anything else = non-blocking error - 定義場所は settings.json の
"hooks"キー。/hooksで一覧、CLAUDE_CODE_DISABLE_ALL_HOOKS=1で一時停止Defined under the"hooks"key in settings.json. List with/hooks; pause them all withCLAUDE_CODE_DISABLE_ALL_HOOKS=1
MCP コマンドMCP commands
| コマンドCommand | 説明What it does |
|---|---|
claude mcp add --transport http <name> <url> | リモート HTTP サーバを追加Add a remote HTTP server |
claude mcp add <name> -- <command> [args...] | ローカル stdio サーバを追加(-- 区切りは必須!)Add a local stdio server (the -- separator is required!) |
claude mcp add --scope project ... | .mcp.json に保存してチームで共有Save to .mcp.json and share with your team |
claude mcp list | 設定済みサーバの一覧List configured servers |
claude mcp get <name> | サーバ 1 件の詳細を表示Show details for one server |
claude mcp remove <name> | サーバを削除Remove a server |
claude mcp login <name> | OAuth 認証を完了(logout で解除)Complete OAuth (logout to clear) |
/mcp | セッション内パネル:接続状態・認証・有効/無効切替In-session panel: connection status, auth, enable/disable |
スコープは 3 種類:local(既定・このプロジェクトの自分だけ)、project(.mcp.json でチーム共有)、user(自分の全プロジェクト)。
Three scopes: local (default — just you, this project), project (team-shared via .mcp.json), and user (all your projects).
ヘッドレスモード主要フラグHeadless mode: the flags that matter
| フラグFlag | 説明What it does |
|---|---|
-p "prompt" | プリントモード:一度応答して終了(すべての起点)Print mode: answer once and exit (the starting point) |
--output-format json | 結果・session_id・コストを含む JSON で出力(stream-json でストリーミング)Structured JSON with result, session_id, cost (stream-json to stream) |
--bare | hooks・skills・プラグイン・MCP・CLAUDE.md をスキップ(CI 最速)Skip hooks, skills, plugins, MCP, CLAUDE.md (fastest for CI) |
--max-turns 5 | エージェントの反復回数を制限Cap agentic iterations |
--allowedTools "Bash(git *),Read,Edit" | ツールを事前承認Pre-approve tools |
--disallowedTools "Bash(rm *)" | パターンで拒否Deny by pattern |
--permission-mode acceptEdits | ファイル編集を自動承認(auto なら分類器が安全確認)Auto-approve file edits (auto adds a safety classifier) |
--max-budget-usd 10.00 | 支出の上限を設定Set a spend cap |
--continue | 直近セッションの続きから実行Continue from the last session |
組み合わせるとこうなります。git ログが 1 コマンドでチェンジログに:
Put together, one command turns your git log into a changelog:
git log --oneline main..HEAD | claude -p "Generate a changelog" --output-format json | jq -r '.result'