Claude Code Operation
Official scope (Exam Guide v1.0): Rules, Skills, Commands, Agents, Agent Memory; session management; slash commands; headless mode, streaming mode, auto mode; the CLAUDE.md hierarchy; repository initialisation; settings.json.
Three layers (design guidance)
Instructions (what to do: CLAUDE.md, rules, skills) · configuration (what is allowed: settings, permissions, hooks) · extensions (what it can do: tools, MCP, subagents, plugins).
Building blocks
| Block | Where | Notes |
|---|---|---|
| CLAUDE.md | Managed, ~/.claude/CLAUDE.md, ./CLAUDE.md, ./CLAUDE.local.md | Concatenated broad→specific; subdirectory files load on demand; under ~200 lines; @path imports (4 hops max). Context, not enforcement |
| Rules | .claude/rules/*.md | Modular instructions, optionally scoped to file paths |
| Skills (commands are skills) | .claude/skills/<name>/SKILL.md, ~/.claude/skills/ | Invoke as /name or let Claude choose by description; only name and description load until used |
| Agents (subagents) | .claude/agents/ | Own prompt, tools, model; fresh context; return a final message |
| Agent memory | Auto memory written by Claude (first 200 lines or 25 KB loaded per session); subagents can have their own | Context, not guarantees |
| settings.json | Managed > CLI > .claude/settings.local.json > .claude/settings.json > ~/.claude/settings.json | Enforced; lists merge; deny wins |
Repository initialisation
/init generates a starter CLAUDE.md from the codebase (suggests improvements if one exists). /memory views and edits memory files.
Session management
Each session starts with a fresh context. /clear resets; /compact summarises; --continue resumes the most recent session; --resume picks a specific one; sessions can be forked (Agent SDK fork_session). Instructions given only in chat are lost on compaction: put durable ones in CLAUDE.md.
Permission modes
| Mode | Runs without asking |
|---|---|
default (shown as Manual) | Reads only |
acceptEdits | Reads, file edits, common filesystem commands |
plan | Reads (plus classifier-approved commands if auto mode is available); explores and proposes before editing |
auto | Everything, with a classifier (a second model) reviewing actions instead of you; reduces prompts, not a guarantee. Default starting mode on recent versions |
dontAsk | Pre-approved tools and reads; anything that would prompt is denied (CI) |
bypassPermissions | Everything; isolated containers/VMs only |
Switch with Shift+Tab or --permission-mode. Permission rules: deny, then ask, then allow.
Headless and streaming mode
claude -p "prompt" (print mode) runs once without a UI and exits (0 on success). --output-format text (default), json, or stream-json (streamed events for live consumers). --json-schema returns a validated structured_output. Used in CI, scripts and GitHub Actions; other languages drive the agent this way.
Debugging wrong behaviour (design guidance)
Check what loaded (/memory, context view), look for conflicting instructions, make instructions specific, shorten CLAUDE.md, move must-run rules into hooks or deny rules.
Exam traps
- CLAUDE.md to block an action.
- A 600-line CLAUDE.md with path-specific rules and procedures in it.
- Expecting a child CLAUDE.md to override a parent (they concatenate).
automode as a security boundary.- Chat-only instructions surviving compaction.
References
- Memory (CLAUDE.md) — checked Oct 16, 2026
- Settings — checked Oct 16, 2026
- Permission modes — checked Oct 16, 2026
- Skills — checked Oct 16, 2026
- Subagents — checked Oct 16, 2026
- Run Claude Code programmatically — checked Oct 16, 2026
- Common workflows — checked Oct 16, 2026
Check your understanding
Explore a codebase without changing anything. Mode?Show answerHide answer
Answer
Plan.Start a new repo's CLAUDE.md. Command?Show answerHide answer
Answer
/init.CI needs a machine-readable result. Flags?Show answerHide answer
Answer
-pwith--output-format json(and--json-schemaif a shape is required).Project allow vs user deny. Result?Show answerHide answer
Answer
Denied.