claude.nagdy.me

Quick Reference

Keep the most useful Claude Code commands, shortcuts, config files, and workflow reminders in one printable place.

/help

Show available commands and usage hints.

/clear

Start a fresh conversation. CLAUDE.md instructions stay active.

/compact

Summarize conversation to reduce context usage. Accepts focus instructions.

Example

/compact focus on the auth module
/context

Show context window usage with a visual breakdown of token allocation.

/diff

Open an interactive viewer for uncommitted changes.

/model

Switch between Sonnet, Opus, and Haiku mid-session.

Example

/model opus
/cost

Show session token usage and estimated cost.

/status

Show current version, model, and account info.

/doctor

Run a health check on your Claude Code installation.

/init

Scan your project and generate a starter CLAUDE.md.

/memory

View and edit CLAUDE.md memory files (global, project, auto).

/review

Review code changes on the current branch with suggestions.

/permissions

View and manage tool permissions. Configure in .claude/settings.json.

/config

Open Claude Code configuration and settings.

/login

Switch Anthropic accounts.

/branch

Fork conversation into a parallel branch to explore alternatives.

/rewind

Roll back to a previous message and undo file changes after that point.

/resume

Resume a previously saved session by name or ID.

Example

/resume auth-refactor
/rename

Rename the current session for easier recall later.

/export

Export the conversation to a markdown file.

Example

/export session-review.md
/effort

Set reasoning depth: low, medium, high, or max.

Example

/effort high
/plan

Enter planning mode — Claude researches first, then presents a plan for approval.

Example

/plan migrate from REST to GraphQL
/btw

Ask a side question without adding it to conversation history.

Example

/btw what's the syntax for a TS generic constraint?
/batch

Split work across parallel agents in isolated git worktrees.

Example

/batch add JSDoc to all exported functions
/loop

Run a task on a recurring interval within your session.

Example

/loop 5m check if the build succeeded
/schedule

Create a cloud-backed scheduled task that runs even when offline.

Example

/schedule "run security audit every Monday at 9am"
/debug

Toggle verbose mode to see tool calls and thinking steps. Also Ctrl+O.

/simplify

Review recently changed files for code quality, reuse, and efficiency.

/agents

List, create, edit, or remove subagent definitions.

/mcp

Show active MCP server connections and available tools.

/plugin

Manage plugins — install, list, remove, or reload.

Example

/plugin install pr-review
/reload-plugins

Hot-reload all plugin files during development.

/sandbox

Enable OS-level isolation for file system and network access.

Shift+Tab

Cycle through permission modes: default → plan → acceptEdits → auto.

Option+T / Alt+T

Toggle extended thinking on or off.

Ctrl+C

Cancel the current operation or stop a running command.

Ctrl+D

Exit Claude Code from the terminal.

Ctrl+B

Background a currently running subagent task.

Ctrl+O

Toggle verbose/debug mode (same as /debug).

Ctrl+G

Open the current plan in an external editor.

Ctrl+K

Open site search on claude.nagdy.me.

Esc

Dismiss the active dialog or current suggestion.

claude -p "prompt"

Run a one-shot prompt non-interactively. Foundation for CI/CD integration.

Example

echo "$DIFF" | claude -p "review these changes for security issues"
--output-format json

Return structured JSON output. Useful for parsing in scripts and pipelines.

Example

claude -p "analyze this" --output-format json
--model <name>

Override the default model for a single invocation.

Example

claude --model opus "redesign the database schema"
--permission-mode <mode>

Set permission mode: default, plan, acceptEdits, auto, or bypassPermissions.

Example

claude -p "run tests" --permission-mode bypassPermissions
--sandbox

Enable OS-level isolation for safe automated analysis.

--max-turns <n>

Cap execution to n turns. Useful for time-limiting automated runs.

--no-session-persistence

Don't save session data. Good for disposable automation tasks.

--resume

Resume the most recent Claude Code session.

--continue

Continue a paused workflow from the current repository.

--agent <name>

Start a session with a specific subagent.

Example

claude --agent security-reviewer
--plugin-dir <path>

Load a plugin for this session only (for testing).

Example

claude --plugin-dir ./my-plugin
--bare

Cleanest output for scripted usage. No formatting or decoration.

--worktree

Run in an isolated git worktree for experimental work.

CLAUDE.md

Project-level instructions, conventions, and workflow notes. Committed to git and shared with the team.

CLAUDE.local.md

Personal overrides for CLAUDE.md. Git-ignored, not shared.

.claude/settings.json

Project settings: permissions, hooks, MCP servers. Committed to git.

Example

{ "permissions": { "allow": ["Bash(npm run test)"], "deny": ["Bash(rm -rf /)"] } }
.claude/settings.local.json

Personal project settings. Git-ignored, overrides .claude/settings.json.

~/.claude/CLAUDE.md

Global user instructions that apply to all projects.

~/.claude/settings.json

Global user settings that apply to all projects.

.claude/skills/

Project-scoped custom skills (SKILL.md files). Committed to git.

.claude/agents/

Project-scoped subagent definitions. Committed to git.

.claude/rules/*.md

Path-scoped rules. Use frontmatter paths: field to target specific files.

Example

--- paths: src/api/**/*.ts --- Always validate input parameters.
.mcp.json

Project MCP server configuration. Committed to git, shared with team.

~/.claude.json

User/local MCP server configuration.

claude mcp add <name> <uri>

Register a new MCP server. Supports HTTP and stdio transports.

Example

claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-github
claude mcp add --header

Add an MCP server with authentication headers.

Example

claude mcp add --header "Authorization: Bearer $TOKEN" api https://api.example.com/mcp
claude mcp list

List all configured MCP servers with transport and connection status.

claude mcp get <name>

Show details for a specific MCP server.

claude mcp remove <name>

Remove an MCP server configuration.

claude mcp add-from-claude-desktop

Import MCP server configurations from Claude Desktop.

/mcp

Show active connections in-session and trigger OAuth flows.

mcp__server__tool

MCP tools appear namespaced. Use naturally in conversation.

Example

Use the GitHub MCP to list open PRs older than 3 days.
Hooks

Hooks

PreToolUse

Runs before a tool executes. Can block the action (exit code 2).

Example

Validate Bash commands before execution, block dangerous patterns.
PostToolUse

Runs after a tool completes. Use for formatting, linting, or logging.

Example

Auto-format files after Edit/Write with prettier.
UserPromptSubmit

Intercept user input before Claude processes it.

Stop

Runs when Claude finishes responding. Check completion criteria.

Example

Verify all tests pass before marking a task complete.
SubagentStart / SubagentStop

Track subagent lifecycle for orchestration and logging.

Hook types

command (shell), prompt (LLM evaluation), agent (subagent), http (webhook).

Hook matchers

Filter which tools trigger hooks: exact name, regex, or * for all.

Example

matcher: "Edit|Write" — only trigger on file modifications.
Skill-level hooks

Define hooks in SKILL.md frontmatter. Scoped to that skill only.

default

Ask before write/edit/bash operations. Read, Glob, Grep always allowed.

plan

Research and present plans only. No file modifications until approved.

acceptEdits

Allow file edits without prompting. Still ask for Bash commands.

auto

Allow all operations without prompting. Use in trusted environments.

bypassPermissions

Skip all safety checks. Only for fully automated CI/CD pipelines.

Allow patterns

Pre-approve specific tools in .claude/settings.json.

Example

"allow": ["Bash(npm run test)", "Bash(git *)", "Read", "Edit"]
Deny patterns

Block dangerous operations regardless of permission mode.

Example

"deny": ["Bash(git push --force*)", "Bash(rm -rf /)"]
@"agent-name"

Invoke a specific agent inline during conversation.

Example

@"security-reviewer" audit the auth module
claude --agent <name>

Start a full session with a specific agent from the CLI.

.claude/agents/*.md

Define project-scoped agents with frontmatter for tools, model, effort.

Built-in agents

general-purpose, Explore (Haiku, read-only), Plan (research first).

isolation: worktree

Run agent in an isolated git worktree for safe experimentation.

background: true

Run agent in background. Use Ctrl+B to background a running agent.

/plugin install <name>

Install a plugin from the official marketplace.

Example

/plugin install pr-review
/plugin install github:user/repo

Install a plugin directly from a GitHub repository.

/plugin list

List installed plugins with their skills, agents, and hooks.

/reload-plugins

Hot-reload plugin files during development.

claude --plugin-dir ./path

Load a plugin for one session only (for testing).

.claude-plugin/plugin.json

Required plugin manifest. Declares name, version, author, userConfig.

plugin-name:command

Plugin commands are namespaced to avoid conflicts.

Example

/pr-review:check-security
/effort high → /plan → approve → implement

Deep work: set high reasoning, plan first, then execute.

/diff → /cost → /export → /compact

End-of-session: review changes, check cost, export, then compact.

/batch <instruction>

Large refactors: split work across parallel agents in isolated worktrees.

/loop 5m <check>

Monitoring: poll build status, error logs, or deploy health on interval.

/branch → experiment → /resume

Exploration: branch conversation, try an approach, resume if it fails.

echo $DIFF | claude -p "review" --output-format json

CI/CD: pipe diffs into Claude for automated code review with JSON output.

/init → edit CLAUDE.md → commit

Project setup: generate instructions, customize, share with team.