The Claude Code command-line flags you actually use, grouped by job instead of A to Z. Resuming a session, picking the model and effort, permissions, scripts with -p and JSON output, loading settings and MCP servers, worktrees and background sessions, and the flags for fixing a broken setup. Checked against Claude Code 2.1.308.
Short answer: The ones worth remembering: claude -c continues the last conversation in this folder, claude -r picks an older one, --model and --effort choose the model and how hard it thinks, --permission-mode plan starts in plan mode, -p "prompt" runs once and prints the answer for scripts, and --safe-mode starts with every customisation off when something is broken. claude --help lists them all.
claude --help prints more than sixty flags in alphabetical order, which is the right order for a reference and the wrong one for remembering. Below are the ones that matter, grouped by what you are trying to do, with an example each. All of them are from the help of Claude Code 2.1.308.
text, json (one result) or stream-json (as it happens)
--json-schema
claude -p --json-schema '{...}' "..."
Makes the answer match a JSON Schema
--max-budget-usd
claude -p --max-budget-usd 2 "..."
Stops when the API cost reaches this amount
--no-session-persistence
Does not save the session to disk
Two warnings from the help itself: with -p the workspace trust dialog is skipped, so run it only in folders you trust, and settings files that fail validation are silently ignored. Run Claude Code headless in CI puts these together.
#How do you load settings, MCP servers and prompts for one run?
Flag
Example
Does
--settings
claude --settings ./ci-settings.json
Loads extra settings from a file or a JSON string
--setting-sources
claude --setting-sources user
Loads only these settings files: user, project, local
--mcp-config
claude --mcp-config ./mcp.json
Loads MCP servers from JSON files or strings
--strict-mcp-config
claude --mcp-config ./mcp.json --strict-mcp-config
Checks the installation; /doctor inside a session can also fix issues
If Claude Code behaves strangely, claude --safe-mode is the quickest test: if the problem is gone, it is in your configuration, and you can turn things back on one at a time.
Config Studio for Claude Code explains every file Claude Code reads and its headless runs, with the flags taken from Claude Code's own help, and writes the settings and the claude -p command for you. Nothing changes on your computer until you run its install script yourself.