3.1 Claude Code operation
The whole of Domain 3 (3.1%) — roughly two items. Know the components and where each one lives; do not memorise every flag.
Core components
| Component | Lives in | Loaded | Purpose |
|---|---|---|---|
| Memory / rules | CLAUDE.md (user, project, directory) and .claude/rules/ | CLAUDE.md always; rules when a matching path is touched | Standing conventions and project knowledge |
| Skills | .claude/skills/<name>/SKILL.md | On invocation, or when the description matches the task | A packaged procedure with its own tool restrictions |
| Slash commands | .claude/commands/*.md (project) or ~/.claude/commands/ (user) | When typed | A reusable prompt with arguments |
| Subagents | .claude/agents/*.md | When delegated to | A scoped role with its own prompt, tools, and context |
| Hooks | settings.json | At lifecycle events | Deterministic enforcement — see 7.3 |
| MCP servers | .mcp.json (project), user config (personal) | At startup | External tools, resources, and prompts |
| Settings | .claude/settings.json, .claude/settings.local.json, ~/.claude/settings.json | At startup | Permissions, env, hooks, model |
| Plugins | Plugin config | At startup | Bundles of the above |
Scoping, at a glance
| Scope | Path prefix | Shared through version control? |
|---|---|---|
| Project | .claude/ in the repo | Yes |
| Project-local | .claude/settings.local.json | No — gitignored |
| User | ~/.claude/ | No |
The single most-tested consequence: something a teammate must get on git pull lives under .claude/ in the repo, never in ~/.claude/.
Skills versus commands versus CLAUDE.md
CLAUDE.md | Slash command | Skill | |
|---|---|---|---|
| Loading | Always | When typed | On demand, by invocation or description match |
| Token cost | Every session | Only when used | Only when used |
| Content | Universal standards | A parameterised prompt | A procedure, optionally with restricted tools and an isolated context |
| Best for | "We use pnpm and vitest" | /review, /changelog | "Analyse the codebase and report structure" |
A skill's frontmatter carries name, description, and optionally allowed-tools (pre-approve tools so they run without a permission prompt), disallowed-tools (remove tools it must not use) and a forked-context setting (run in isolation so verbose output never enters the main conversation).
Repository initialization
/init inspects the repository and writes a starting CLAUDE.md — build and test commands, project layout, conventions it can infer. Treat the result as a draft to edit down: an accurate ten-line file beats a generated hundred-line one, because every line is re-read on every session.
A complete first-time setup is: /init, prune the generated file, add the commands that actually matter, add .claude/settings.json with the permissions the team wants, add .mcp.json if there are shared MCP servers, and commit all of it.
Session management
| Action | Effect |
|---|---|
| Clear | Start a fresh context in the same repo — the correct move between unrelated tasks |
| Compact | Summarise the conversation so far, keeping the thread but shrinking the context |
| Resume / continue | Reattach to a previous session, with its history |
| Delegate to a subagent | Keep verbose exploration out of the main context entirely |
Long sessions degrade for the same reason long prompts do: the signal you need competes with everything else in the window. Clearing between tasks is a performance decision, not tidiness.
Interfaces and modes
| Mode | Shape | Use |
|---|---|---|
| Interactive | The terminal REPL | Normal development |
| Plan mode | Claude researches and proposes a plan; no edits until you approve | Multi-file changes, ambiguous requirements, unfamiliar code |
| Auto mode | The agent proceeds through the work autonomously under pre-approved permissions | Trusted repository, well-scoped task, permissions already narrowed |
| Headless / print mode | claude -p "<prompt>" — one non-interactive run, output to stdout | CI, scripts, pre-commit checks, batch jobs |
| Streaming mode | JSON-lines input and/or output (--output-format stream-json) | Programmatic integration where you consume events as they happen |
| IDE / Desktop / web | Same engine, different surface | Same configuration files apply |
Headless usage has two non-negotiables: explicitly allow only the tools the job needs, and treat the exit status and output as a CI contract. A CI job with unrestricted tools is a supply-chain risk, and one whose failure is invisible is worse than no job.
CLAUDE.md, settings.json, hooks, skills, and MCP configuration apply the same way in interactive, headless, and IDE sessions. An item that says "it behaves differently in CI" is pointing at configuration scope, allowed tools, or a missing environment variable — not at a different engine.
Quiz
- Question 1
A team runs Claude Code as a repository health check on every pull request. Which property of the run is the one CI actually depends on?
- Question 2
A five-step release procedure must run the same way for everyone, produces several thousand lines of intermediate output, and is used perhaps twice a month. Which Claude Code component fits?
Links
- https://code.claude.com/docs/en/overview
- https://code.claude.com/docs/en/memory
- https://code.claude.com/docs/en/skills
- https://code.claude.com/docs/en/commands
- https://code.claude.com/docs/en/subagents
- https://code.claude.com/docs/en/headless
- https://code.claude.com/docs/en/settings
- https://code.claude.com/docs/en/mcp
- https://code.claude.com/docs/en/best-practices