Skip to content

AI Programming Quick Reference

Quick Reference

Covers the main categories of the Claude Code reference, plus common Codex entry points. Commands may vary slightly between versions — always check the terminal help for accuracy.

13
Categories
187
Entries
187
Showing

Slash Commands

Session, context, review, background tasks, extension management, and workflow entry points.

46 items
/help

View commands, flags, and help entry points supported by the current version.

/clear

Clear the current session context, suitable for starting fresh on a new question.

/compact

Compact long session history, retain key summaries, reduce context pressure.

/context

View or declare the files, directories, and background to focus on for this turn.

Example
/context read README, CLAUDE.md, package.json first
/diff

View file changes for this turn, useful for verifying the scope of changes before committing.

/model

View or switch models, useful for trading off between speed and reasoning intensity.

/cost

View the token count and estimated cost for the current session.

/status

View login status, project path, model, permissions, and runtime environment.

/cd

Switch working directory so subsequent commands run in the specified project.

Example
/cd apps/web
/doctor

Check if CLI, permissions, dependencies, network, and project configuration are working correctly.

/init

Initialize project documentation, generate or update CLAUDE.md.

/memory

View, edit, or refresh long-term memory and project memory.

/review

Enter code review mode, focusing on risks, regressions, and test gaps.

/permissions

View or adjust permission policies for tool calls, file writes, command execution, etc.

/config

Open the configuration entry point to modify model, permissions, output, and project settings.

/login

Log in or switch accounts to restore authorization and subscription status.

/branch

Create or switch to an isolated branch, suitable for experimental changes.

/rewind

Roll back to an earlier conversation checkpoint and choose a different implementation path.

/resume

Resume a historical session to continue an unfinished task.

/rename

Rename the current session for easier retrieval in history.

/export

Export session content, changes, or summaries for review and handover.

/effort

Adjust reasoning intensity; increase for complex design and review tasks.

Example
/effort high
/plan

Plan before executing, suitable for high-risk, multi-file, or unclear requirements tasks.

/btw

Insert side-channel information so the assistant remembers supplementary constraints without interrupting the current task.

/batch

Execute similar tasks in batches, e.g., batch review, batch document updates.

Example
/batch review every package README
/loop

Periodically execute check tasks, suitable for monitoring logs, CI, or local services.

Example
/loop 5m npm test
/schedule

Schedule timed tasks or reminders so the assistant continues processing at a specified time.

/workflows

View or run preset workflows, chaining multiple operations together.

/deep-research

Enter deep research mode, suitable for finding information, comparing solutions, and writing reports.

/debug

Debug following the 'Reproduce, Locate, Fix, Verify' rhythm.

/code-review

Structured code review for PRs or local diffs.

/simplify

Ask the assistant to reduce complexity, compress abstraction and repetitive logic.

/security-review

Perform security checks around permissions, injection, keys, supply chain, and data leaks.

/agents

View, select, or manage available subagents.

/mcp

View MCP servers, tools, and connection status.

/plugin

Browse, install, or manage Plugins.

/reload-plugins

Reload local Plugins, commonly used when debugging Plugins.

/goal

Set the current session goal and budget, giving long tasks a clear endpoint.

/recap

Generate a brief progress and next-step summary for the current session.

/less-permission-prompts

Reduce the frequency of permission confirmations, suitable for high-trust local projects.

/tui

Switch or view terminal interaction interface settings.

/focus

Narrow the context scope so the assistant focuses on the current file or task.

/sandbox

View or adjust sandbox policies to control command and file system access.

/usage-credits

View quota, usage, or subscription information.

/plugin Discover

Go to the Plugins discovery page to find installable extensions.

/plugin Browse

Browse installed Plugins and available commands.

Shortcuts

High-frequency keys for terminal sessions, input, history, sidebar, and mode switching.

12 items
Shift+Tab

Switch between plan mode, auto-edit, or normal input interaction modes.

Option+T / Alt+T

Switch theme or terminal display style.

Ctrl+C

Interrupt the current output or ongoing operation.

Ctrl+D

Exit the current interactive session.

Ctrl+B

Show or hide the sidebar.

Ctrl+O

Open the context, file, or command selector.

Ctrl+R

Search command history or session history.

Ctrl+G

Open goal, task, or session navigation.

Ctrl+K

Clear the input line or open the search entry point, depending on the terminal version.

Esc

Cancel current input, close popover, or exit selection state.

↑ / ↓

Browse input history and candidates.

Tab

Complete commands, file paths, or candidates.

CLI Flags

Non-interactive calls, model selection, output format, permissions, session recovery, and Plugins loading.

27 items
claude -p "prompt"

Execute a prompt once in non-interactive mode, suitable for scripts and CI.

Example
claude -p "summarize this diff"
--output-format json

Output results in JSON, for easy script parsing.

Example
claude -p "review" --output-format json
--output-format stream-json

Stream JSON events, suitable for long tasks and real-time UIs.

--model <name>

Specify the model name.

Example
claude --model sonnet
--permission-mode <mode>

Specify Permission Modes, e.g., default, plan, auto-accept edits, or bypass permissions.

--sandbox

Enable sandboxed execution to restrict command and file system side effects.

--safe-mode

Run in a more conservative mode, suitable for untrusted projects or demo environments.

--max-turns <n>

Limit maximum turns to avoid infinite loops in script tasks.

--no-session-persistence

Don't save this session state, suitable for temporary batch processing.

--resume

Resume a specified or the most recent historical session.

--continue

Continue the most recent session.

--agent <name>

Specify a subagent to execute tasks.

Example
claude --agent code-reviewer
--plugin-dir <path>

Load plugins from the specified directory.

Example
claude --plugin-dir ./plugins
--plugin-url <url>

Install or load plugins from a URL.

--bare

Start in a more lightweight mode, without loading some project decorators and additional context.

--worktree

Run in an isolated worktree, isolating experimental changes.

--dangerously-skip-permissions

Skip permission confirmations; only use in fully trusted isolated environments.

--add-dir <path>

Add extra directories to the readable context.

Example
claude --add-dir ../shared
--mcp-config <file>

Specify an MCP config file.

Example
claude --mcp-config .mcp.json
--channels <plugin>

Enable channels provided by plugins or extensions.

claude auth login

Log in to an account or refresh authorization.

claude project purge [path]

Clean up project-level cache, sessions, or index data.

claude agents

List available subagents.

claude agents --json

Output the subagent list in JSON format.

claude plugin details <name>

View plugin details, commands, and capability descriptions.

claude plugin enable <name>

Enable an installed plugin.

claude plugin disable <name>

Disable an installed plugin.

Config Files

Project instructions, personal preferences, local private settings, skills, agents, and MCP config.

11 items
CLAUDE.md

Project-level instructions: write project structure, commands, constraints, and collaboration rules.

CLAUDE.local.md

Machine-private project notes, suitable for personal paths and temporary preferences.

.claude/settings.json

Shared project settings, can be committed to the repository.

.claude/settings.local.json

Machine-private settings, usually not committed.

~/.claude/CLAUDE.md

Global personal instructions, effective across projects.

~/.claude/settings.json

Global settings, suitable for default models and personal preferences.

.claude/skills/

Project skills directory, for encapsulating reusable workflows and domain knowledge.

.claude/agents/

Project subagents directory, for defining roles like review, testing, and writing.

.claude/rules/*.md

Split rules files, for maintaining project constraints by topic.

.mcp.json

Project MCP server configuration.

~/.claude.json

User-level state and global metadata file.

MCP

Connect external capabilities like databases, browsers, GitHub, and documentation systems into the terminal assistant.

8 items
claude mcp add <name> <uri>

Add an MCP server.

Example
claude mcp add browser http://localhost:3000
claude mcp add --header

Add an MCP server with authentication headers.

claude mcp list

List configured MCP servers.

claude mcp get <name>

View details of a specific MCP server.

claude mcp remove <name>

Remove an MCP server.

claude mcp add-from-claude-desktop

Import MCP configuration from the desktop app.

/mcp

View MCP connection status and available tools within a session.

mcp__server__tool

MCP tool naming format, typically a 'server + tool' combination.

Hooks

Insert automated actions on tool calls, user input, stop, subagent start and stop events.

12 items
PreToolUse

Triggers before tool execution, suitable for intercepting dangerous commands or supplementing audits.

PostToolUse

Triggers after tool execution, suitable for formatting, logging, and syncing state.

UserPromptSubmit

Triggers when the user submits a prompt; can inject context or perform compliance checks.

Stop

Triggers when the main session stops, suitable for summarizing, notifying, or cleaning up resources.

SubagentStart

Triggers when a subagent starts, suitable for preparing isolated directories or environment variables.

SubagentStop

Triggers when a subagent stops, suitable for collecting results and cleaning up temporary files.

Hook types

Hook type determines trigger timing.

Hook matchers

Matchers determine which tools, commands, or contexts trigger the hook.

Hook args (exec form)

Receives input as command arguments, suitable for calling scripts.

Skill-level hooks

Hooks declared within Skills, only active when the Skill is in use.

Stop input fields

Stop event input fields, can be used to read session state and last output.

SubagentStop input fields

Subagent stop event input fields, for reading agent name, status, and artifacts.

Permission Modes

Control boundaries for file read/write, command execution, network access, and auto-accept edits.

8 items
default

Default mode, key operations require confirmation.

plan

Plan mode, only discuss approaches, don't modify files directly.

acceptEdits

Auto-accept file edits, but high-risk commands may still require confirmation.

auto

More proactively executes routine tool calls, suitable for low-risk tasks.

bypassPermissions

Bypass permission confirmations, only suitable for trusted isolated environments.

Allow patterns

Allow specific commands, paths, or tool patterns.

Deny patterns

Deny specific commands, paths, or tool patterns.

sandbox rules

Use sandbox boundaries to restrict process, network, and file system access.

Subagents

Delegate review, research, testing, documentation and other tasks to specialized roles.

7 items
@"agent-name"

Call a specific subagent by name in the conversation.

Example
@"code-reviewer" review this diff
claude --agent <name>

Specify the default subagent at startup.

.claude/agents/*.md

Project subagent definition file.

Built-in agents

Built-in agents, typically covering review, research, implementation, and testing scenarios.

isolation: worktree

Let subagents work in isolated worktrees to reduce interference.

background: true

Allow subagents to run in the background while the main session continues other tasks.

/agents

View, select, and manage available subagents.

Plugins

Install commands, skills, MCP, app connectors, and internal team extensions.

8 items
/plugin install <name>

Install plugins from a plugin source.

/plugin install github:user/repo

Install plugins from a GitHub repository.

/plugin list

List installed plugins.

/reload-plugins

Reload local plugins without restarting the CLI during debugging.

claude --plugin-dir ./path

Load local plugin directory at startup.

.claude-plugin/plugin.json

Plugin manifest file declaring name, version, commands, and capabilities.

plugin-name:command

Plugin command naming convention to avoid conflicts with system commands.

Plugin marketplace

Plugin marketplace or discovery page for finding team and community extensions.

Environment Variables

Model, session, output, updates, safety mode, and provider API keys.

15 items
ANTHROPIC_API_KEY

Anthropic API key.

OPENAI_API_KEY

OpenAI or compatible gateway key.

DEEPSEEK_API_KEY

DeepSeek or compatible model provider key.

CLAUDE_EFFORT

Default reasoning intensity.

CLAUDE_CODE_SESSION_ID

Current session ID, useful for log correlation.

CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN

Disable terminal alternate screen for easier copying of historical output.

CLAUDE_CODE_FORCE_SYNC_OUTPUT

Force synchronous output, suitable for scripts and log collection.

CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE

Control package manager automatic update behavior.

CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY

Enable gateway model discovery.

CLAUDE_CODE_HIDE_CWD

Hide the current working directory, suitable for screen recording or public demos.

CLAUDE_CODE_SAFE_MODE

Enable safety mode.

CLAUDE_CODE_DISABLE_BUNDLED_SKILLS

Disable built-in skills, only use explicitly configured capabilities.

DISABLE_UPDATES

Disable automatic update checks.

CLAUDE_CODE_USE_POWERSHELL_TOOL

Prioritize PowerShell tools in Windows environments.

CLAUDE_CODE_DISABLE_WORKFLOWS

Disable workflow capabilities.

Config Options

Fine-grained control of worktrees, sandboxes, inheritance, cleanup cycles, and model scope.

9 items
worktree.baseRef

Base branch or reference used when creating a worktree.

sandbox.bwrapPath

Specify the Linux bubblewrap sandbox path.

sandbox.socatPath

Specify the socat path for sandbox network bridging.

parentSettingsBehavior

Control whether parent directory settings are inherited.

cleanupPeriodDays

Set the cleanup cycle for cache, temporary data, or history.

prUrlTemplate

Configure PR link templates for jumping from the terminal to code hosting platforms.

disableBundledSkills

Disable built-in skills.

enforceAvailableModels

Restrict the selectable model range, suitable for team-wide cost and compliance policies.

footerLinksRegexes

Identify links in the terminal footer and provide navigation.

Common Workflows

Combine commands into reusable paths, ideal for teaching, team standards, and daily development.

8 items
High-risk Changes

First increase reasoning intensity, then enter plan mode, implement after confirmation.

Example
/effort high -> /plan -> approve -> implement
Pre-commit Self-check

First check diff, then check cost, export summary and compact context if necessary.

Example
/diff -> /cost -> /export -> /compact
Batch Review

Delegate similar review tasks to batch processing commands.

Example
/batch review all changed markdown files
Loop Check

Periodically run tests, logs, or health checks.

Example
/loop 5m npm test
Branch Experiment

Create a new branch for experiments, then merge or restore the main line upon success.

Example
/branch -> experiment -> /resume
Script Review

Pipe diff to the CLI, output JSON for automated systems to read.

Example
git diff | claude -p "review" --output-format json
Project Initialization

Generate documentation, add rules, then commit to the repository.

Example
/init -> edit CLAUDE.md -> commit
Debug Loop

Reproduce, locate, add tests, fix, then run verification.

Example
/debug -> add failing test -> fix -> /diff

Codex Reference

Supplements the most common entry points and configurations for Codex CLI and Codex projects.

16 items
AGENTS.md

Codex project instructions: write project commands, code standards, and collaboration constraints.

~/.codex/config.toml

Codex global config file, typically for model, sandbox, and approval policies.

.codex/

Project or user-level Codex extensions directory, commonly for skills, plugins, and memory.

sandbox_mode

Control the file system sandbox scope for Codex command execution.

approval_policy

Control when Codex requires user approval for commands or network operations.

model_reasoning_effort

Set reasoning intensity; increase for complex tasks.

codex --help

View commands and flags supported by the Codex CLI.

codex exec "<task>"

Non-interactively execute a task once, suitable for automation scripts.

Example
codex exec "review the current diff"
/status

View the current model, directory, sandbox, permissions, and tool status.

/model

Switch or view the model currently used by Codex.

/approvals

View or adjust the approval policy.

/review

View current changes in code review mode.

/mcp

View available MCP servers and tools for Codex.

/skills

View available skills and their trigger methods.

/compact

Compress long session context and continue the current task.

OPENAI_API_KEY / DEEPSEEK_API_KEY

Commonly used when connecting OpenAI-compatible or low-cost models like DeepSeek.