Claude Code Operation
Configure and operate Claude Code for a team: know where instructions, skills, commands, subagents and memory live; how the CLAUDE.md and settings hierarchies resolve; and how to run sessions, headless and streaming modes, and permission modes safely.
Key points
- 1
Core components: CLAUDE.md files and
.claude/rules/hold standing instructions. Skills (SKILL.md) are reusable procedures, invoked as/nameor loaded automatically when their description matches. Subagents (.claude/agents/,~/.claude/agents/) run in their own context windows. Hooks give deterministic automation. Auto memory holds notes Claude keeps for itself. - 2
Custom commands have been merged into skills.
.claude/commands/deploy.mdand.claude/skills/deploy/SKILL.mdboth create/deploy; skills add supporting files and automatic invocation.$ARGUMENTS(or$0,$1, and so on) inserts the text typed after the command. - 3
CLAUDE.md scopes: managed policy (for example
/etc/claude-code/CLAUDE.mdon Linux) for the whole organization;~/.claude/CLAUDE.mdfor you in every project;./CLAUDE.mdor./.claude/CLAUDE.mdfor the team, committed;./CLAUDE.local.mdfor you in this project, gitignored. - 4
CLAUDE.md files in the working directory and its parents load at launch and are concatenated, not overridden. Files in subdirectories load on demand when Claude reads files there.
@pathimports still load at launch, so they organize content without saving context. Keep each file under about 200 lines. - 5
Rules:
.mdfiles in.claude/rules/load unconditionally unless they havepathsfrontmatter (globs), in which case they load only when Claude works with matching files.~/.claude/rules/holds personal rules for all projects. - 6
Repository initialization:
/initanalyzes the codebase and generates a starting CLAUDE.md (build and test commands, conventions). If one exists, it suggests improvements instead of overwriting. Then add what Claude cannot discover on its own. - 7
Auto memory is on by default and machine-local: notes live in
~/.claude/projects/<project>/memory/, with aMEMORY.mdindex loaded at session start. It is not shared with teammates, so team conventions belong in the project CLAUDE.md. Manage it with/memory. - 8
Subagent persistent memory (the
memoryfrontmatter field) has three scopes:user(~/.claude/agent-memory/, all projects),project(.claude/agent-memory/, shareable through git) andlocal(.claude/agent-memory-local/, not committed). - 9
settings.json precedence, highest first: managed settings, command-line arguments,
.claude/settings.local.json,.claude/settings.json,~/.claude/settings.json. Nothing a developer sets overrides managed settings. Array settings such aspermissions.allowmerge across scopes. - 10
Sessions:
claude --continue(-c) reopens the most recent conversation in the current directory.claude --resume(-r) reopens a specific session by ID or name, or shows a picker.--fork-sessionresumes under a new session ID. In scripts with overlapping runs, capturesession_idfrom JSON output and use--resume. - 11
Headless mode:
claude -p "..."runs once and exits.--output-formatistext,json(one final object withresult,session_idand cost) orstream-json(newline-delimited events).--json-schemawithjsonreturnsstructured_output. Use--allowedToolsto pre-approve tools and--barefor fast, reproducible scripted runs. - 12
Streaming mode:
--output-format stream-json --verbose --include-partial-messagesstreams token deltas, and the last line is aresultmessage.--input-format stream-jsonaccepts streamed input. - 13
Permission modes:
default(Manual),acceptEdits(file edits and common filesystem commands),plan(read-only analysis),auto(acts without prompts while background safety checks screen actions),dontAsk(only pre-approved actions; everything else is denied, suited to CI) andbypassPermissions(no checks; isolated containers or VMs only). Shift+Tab cycles modes. - 14
Auto mode treats boundaries you state in chat ("don't push") as block signals, but these live in the transcript and can be lost to compaction. For a hard guarantee, add a deny rule; deny rules apply in every mode. Admins can turn auto mode off with
disableAutoModein managed settings.
Read the source
Test yourself on Claude Code Operation
Ten questions, with the answer and explanation after each one.