What you need to know
Claude Code runs in the terminal, as a desktop app, in IDEs (VS Code, JetBrains), on the web and from mobile. The same configuration ideas apply everywhere.
Permission modes
| Mode | Behavior | Fits |
|---|---|---|
default | Asks before edits and most commands | Unfamiliar code, careful work |
acceptEdits | Auto-approves file edits (and common file commands) in the working directory | Trusted, reversible work |
plan | Explores and plans; no edits or commands until you approve | Unfamiliar or high-stakes changes |
auto | A classifier approves routine actions and stops risky ones | Fewer prompts with a safety net |
dontAsk | Denies anything not pre-approved, without prompting | Locked-down automation |
bypassPermissions | No checks at all | Only isolated containers or VMs |
Administrators can disable bypass mode in managed settings. Deny rules still apply in every mode.
Sessions
claude --continueresumes the latest session in the directory;--resumelets you choose one./compact(optionally with what to keep) summarizes a long session;/clearstarts fresh for an unrelated task./contextshows what fills the context window;/costshows usage.- Checkpoints let you rewind code and conversation (
/rewind); changes made by shell commands still need git. /initdrafts a CLAUDE.md from the codebase; review and trim it.
Memory and settings
CLAUDE.md loads from the managed, user and project levels at launch, and from subdirectories when Claude works with files there. Settings follow managed > CLI > local project > shared project > user. Permission rules in settings.json allow, ask or deny tool calls by pattern, for example "deny": ["Read(./.env*)"].
Headless and streaming
claude -p "Update the lockfiles and summarize changes" \
--allowedTools "Read,Edit,Bash(npm install:*)" \
--output-format json --max-turns 15
-pruns one non-interactive task.--output-format text | json | stream-json: json returns one result object at the end; stream-json (with--verbose) emits events as they happen, for live monitoring.- Pre-approve tools (or set a permission mode) so the job never waits for input.
- Bound unattended runs with
--max-turnsand a CI job timeout.
In the exam
Items describe a developer's goal or a session problem and ask for the mode, flag, file or command. Match risk to mode, use headless flags for automation, and use /compact, /clear, /context or rewind for session health. Distractors use bypass for convenience, put enforcement in CLAUDE.md, use text output for scripts, or confuse /compact with /clear.
Check your understanding
Analyze an unfamiliar codebase and propose a refactor without changing anything. Which mode?
Show answer
Answer: B. Plan mode explores and proposes without edits or commands.
A script must react to each tool call during a headless run. Which output format?
Show answer
Answer: C. stream-json emits events as the run progresses.
After three hours the session is slow and forgets instructions, but its decisions still matter. Which command?
Show answer
Answer: A. Compaction keeps the essentials and frees context.
Apply it: Set up Quarry Lane's CI fixer
Quarry Lane wants Claude Code in GitHub Actions to propose fixes for failing builds as pull-request comments, without pushing. Some runs have taken 40 minutes. Developers also want a safe way to try large refactors locally.
- Write the headless invocation for CI, with tools and limits.
- Choose the output format and what the workflow does with it.
- Recommend modes for local refactoring at each stage.
Done when: the CI job cannot push or run unbounded.
Show model answer
1. claude -p "<failing test output and task>" --allowedTools "Read,Grep,Glob,Bash(npm test:*)" --max-turns 20 --output-format json, with a 15-minute job timeout. No Edit permission on protected paths, no git push permission; the workflow, not Claude, posts the comment.
2. json: the workflow reads the result field and posts it as a PR comment; it fails the step if the result reports an error.
3. Start in plan mode to get a reviewed plan; continue in default mode for the first files, then acceptEdits once the pattern is trusted. Use /compact between phases, rewind if a step goes wrong, and never bypass on a laptop.