CertPrep
Domain 3 · Lesson 3.1 · 4 min read

Operating Claude Code

Exam skillClaude Code Operation

Operating Claude Code correctly across the CLI, desktop, IDE, web, and mobile surfaces, including session management, the CLAUDE.md hierarchy and precedence, settings.json, permission modes, headless and streaming modes, and built-in commands.

Run Claude Code correctly on every surface: start and resume sessions, keep CLAUDE.md and settings in the right files, pick the permission mode that matches the risk, run it headlessly in scripts and CI with machine-readable output and limits, and use the built-in commands that manage context and changes.

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

ModeBehaviorFits
defaultAsks before edits and most commandsUnfamiliar code, careful work
acceptEditsAuto-approves file edits (and common file commands) in the working directoryTrusted, reversible work
planExplores and plans; no edits or commands until you approveUnfamiliar or high-stakes changes
autoA classifier approves routine actions and stops risky onesFewer prompts with a safety net
dontAskDenies anything not pre-approved, without promptingLocked-down automation
bypassPermissionsNo checks at allOnly isolated containers or VMs

Administrators can disable bypass mode in managed settings. Deny rules still apply in every mode.

Sessions

  • claude --continue resumes the latest session in the directory; --resume lets you choose one.
  • /compact (optionally with what to keep) summarizes a long session; /clear starts fresh for an unrelated task.
  • /context shows what fills the context window; /cost shows usage.
  • Checkpoints let you rewind code and conversation (/rewind); changes made by shell commands still need git.
  • /init drafts 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
  • -p runs 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-turns and 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

Question 1

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.

Question 2

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.

Question 3

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

Exercise · about 20 minCase: Quarry Lane Software

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.

  1. Write the headless invocation for CI, with tools and limits.
  2. Choose the output format and what the workflow does with it.
  3. Recommend modes for local refactoring at each stage.
    Done when: the CI job cannot push or run unbounded.
Check your work
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.

Key termsClaude CodeEscalationHeadless modePermission modePlan mode

Sources