Skip to main content

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​

ComponentLives inLoadedPurpose
Memory / rulesCLAUDE.md (user, project, directory) and .claude/rules/CLAUDE.md always; rules when a matching path is touchedStanding conventions and project knowledge
Skills.claude/skills/<name>/SKILL.mdOn invocation, or when the description matches the taskA packaged procedure with its own tool restrictions
Slash commands.claude/commands/*.md (project) or ~/.claude/commands/ (user)When typedA reusable prompt with arguments
Subagents.claude/agents/*.mdWhen delegated toA scoped role with its own prompt, tools, and context
Hookssettings.jsonAt lifecycle eventsDeterministic enforcement — see 7.3
MCP servers.mcp.json (project), user config (personal)At startupExternal tools, resources, and prompts
Settings.claude/settings.json, .claude/settings.local.json, ~/.claude/settings.jsonAt startupPermissions, env, hooks, model
PluginsPlugin configAt startupBundles of the above

Scoping, at a glance​

ScopePath prefixShared through version control?
Project.claude/ in the repoYes
Project-local.claude/settings.local.jsonNo — 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.mdSlash commandSkill
LoadingAlwaysWhen typedOn demand, by invocation or description match
Token costEvery sessionOnly when usedOnly when used
ContentUniversal standardsA parameterised promptA 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​

ActionEffect
ClearStart a fresh context in the same repo — the correct move between unrelated tasks
CompactSummarise the conversation so far, keeping the thread but shrinking the context
Resume / continueReattach to a previous session, with its history
Delegate to a subagentKeep 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​

ModeShapeUse
InteractiveThe terminal REPLNormal development
Plan modeClaude researches and proposes a plan; no edits until you approveMulti-file changes, ambiguous requirements, unfamiliar code
Auto modeThe agent proceeds through the work autonomously under pre-approved permissionsTrusted repository, well-scoped task, permissions already narrowed
Headless / print modeclaude -p "<prompt>" — one non-interactive run, output to stdoutCI, scripts, pre-commit checks, batch jobs
Streaming modeJSON-lines input and/or output (--output-format stream-json)Programmatic integration where you consume events as they happen
IDE / Desktop / webSame engine, different surfaceSame 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.

Interface does not change the rules

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​

  1. 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?

  2. 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?