CLAUDE.md, Settings, Skills and Plugins
CLAUDE.md, rules and auto memory are context that Claude follows as guidance. Settings files are configuration that the client enforces. Skills and plugins package procedures that load on demand. Know where each file lives, what loads at launch versus on demand, how settings precedence and list merging work, how skills are discovered, invoked and restricted (in Claude Code and in the Agent SDK), and what survives `/compact`.
Key points
- 1
CLAUDE.md locations, in load order: managed policy (
/etc/claude-code/CLAUDE.md,C:\Program Files\ClaudeCode\CLAUDE.md, or theclaudeMdmanaged key), user~/.claude/CLAUDE.md, project./CLAUDE.mdor./.claude/CLAUDE.md, and local./CLAUDE.local.md(gitignored). Files from the working directory and every directory above it load at launch and are concatenated, root first, withCLAUDE.local.mdafterCLAUDE.mdin each directory. Subdirectory CLAUDE.md files load on demand. - 2
CLAUDE.md is delivered as a user message after the system prompt, so Claude can miss or misread it. Keep each file under about 200 lines, make instructions concrete and checkable, cut whatever Claude can derive from the code, and avoid contradictions (Claude may pick either side).
@pathimports expand at launch (relative to the importing file, up to four hops), so they do not save context. Block-level HTML comments are stripped. - 3
.claude/rules/*.mdwithout frontmatter load like.claude/CLAUDE.md. Withpaths:globs they load only when Claude reads or edits a matching file.claudeMdExcludes(glob on absolute paths, any settings layer, arrays merge) skips other teams' files in a monorepo but cannot exclude the managed CLAUDE.md. - 4
AGENTS.md(v2.1.277+): by default it is read only when noCLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdexists on the path. Set Project instructions toclaude-md-and-agents-mdto load both, or import it with@AGENTS.md. - 5
Auto memory lives in
~/.claude/projects/<project>/memory/(one folder per git repo, shared by worktrees, local to the machine). The first 200 lines or 25KB ofMEMORY.mdload each session, and topic files are read on demand. Turn it off withautoMemoryEnabled: falseorCLAUDE_CODE_DISABLE_AUTO_MEMORY=1. In the SDK it loads regardless ofsettingSources, and Claude saves new memories with the Write and Edit tools. - 6
Settings precedence, highest first: managed, then
--settings(and the SDKsettingsoption), then.claude/settings.local.json, then.claude/settings.json, then~/.claude/settings.json. Lists such aspermissions.allowmerge across files instead of overriding. Environment variables are decided per key:ANTHROPIC_MODELbeats themodelkey in any file, and--modelor/modelbeat both. Settings files are strict JSON, and a broken file is skipped silently in-pruns (check withclaude doctor). - 7
Skills:
.claude/skills/<name>/SKILL.md(project),~/.claude/skills/(personal), managed, plugin (/plugin-name:skill)..claude/commands/*.mdstill works, and a skill beats a command file with the same name. Same-name resolution: enterprise > personal > project. A same-name skill replaces a bundled command but not its aliases. Progressive disclosure: descriptions are always listed (description pluswhen_to_usecapped at 1,536 characters), the body loads on invocation and stays in context, and supporting files are read when needed. - 8
Key frontmatter:
disable-model-invocation: truemeans user-only and keeps the description out of context.user-invocable: falsemeans Claude-only.allowed-toolspre-approves tools for the invoking turn only and restricts nothing.context: forkplusagentruns the body in a fresh subagent with no conversation history (Explore and Plan also skip CLAUDE.md).paths,model,effortandargumentsare also available.$ARGUMENTS,$0,${CLAUDE_SKILL_DIR}and${CLAUDE_PROJECT_DIR}are substituted. - 9
`
!cmdand``!blocks run before Claude sees the skill and inline the command's output. They are checked against permission rules (never prompted), and any non-zero exit aborts the whole invocation (exit 1 is allowed for grep- and diff-style commands; append|| trueotherwise).disableSkillShellExecutionin managed settings turns injection off for user, project, plugin and added-directory skills. - 10
Agent SDK: skills and CLAUDE.md come from
settingSources(default["user", "project", "local"];[]loads none;"project"is needed for repo CLAUDE.md, rules and skills).skills: "all" | string[] | []filters what the model may invoke and adds the Skill tool. It is not a sandbox, it rejects wildcards, and/namedispatch still works. In Python, settingskillswithsetting_sourcesunset narrows sources to["user", "project"]. The SDK has no API for registering skills in code. - 11
SDK plugins:
plugins: [{ type: "local", path }](local is the only type; relative paths resolve againstcwd;~is not expanded; missing paths are skipped silently). Checkplugins,plugin_errors,skillsandslash_commandsin thesystem/initmessage. Output style is a settings key: in TypeScript usesettings: { outputStyle: "Explanatory" }(not a top-level option); in Pythonsettingstakes a JSON string or file path. Values are case-sensitive. - 12
/compact [focus]summarizes and continues;/clearstarts empty (the old session can be resumed). After compaction, the system prompt and output style still apply. Root CLAUDE.md, unscoped rules and auto memory are re-injected. Path-scoped rules and nested CLAUDE.md reload only on demand. Invoked skills are re-attached (first 5,000 tokens each, 25,000 total, newest first). Anything said only in chat is summarized away. In a one-shot SDKquery(),/clearhas no practical effect.
Common traps
Using CLAUDE.md (even a managed one) for a hard rule. It is guidance. Enforce with
permissions.denyin managed settings or with a hook.Expecting
@importsto shrink context. Use path-scoped rules, nested CLAUDE.md files or skills instead.Assuming a higher-precedence
permissions.allowlist replaces a lower one. Lists merge, so add anaskordenyrule to take something back.Assuming a project skill beats a personal skill with the same name, the way project settings beat user settings. It is the other way round.
Treating
allowed-toolsas a restriction, or as a session-long grant. It pre-approves tools for one turn, and workspace trust does not gate it in-p.Writing
"outputStyle": "explanatory"in lowercase. It silently falls back to the Default style.Passing
settingSources: []withskills: "all"and expecting project skills. Nothing is discovered.Using
context: forkfor a task that depends on the current conversation. The forked subagent never sees it.
Read the source
Further reading
Suggest a resourceNo extra reading for CLAUDE.md, Settings, Skills and Plugins yet. Found a guide, video or cheat sheet that made it click? Share it and help the next learner.
Test yourself on CLAUDE.md, Settings, Skills and Plugins
Ten questions, with the answer and explanation after each one.