12.1 Claude Code Enterprise Standards & Configuration Precedence
Key Takeaways
CLAUDE.md and .claude/rules/ files provide behavioral context, not enforceable security policy.
Ordinary settings precedence is managed, session, project-local, shared project, then user; permission lists merge across scopes and matching deny rules precede allow rules.
Protect sensitive files and network boundaries using managed permissions plus OS-level sandboxing, access controls and least-privilege credentials.
Path-scoped rules load on demand; imports organize content but do not save context, while forked skills run as a separate subagent.
Package repeatable multi-component workflows as reviewed plugins in managed marketplaces; choose task-appropriate permission modes and independently enforce runtime boundaries.
12.1 Claude Code Enterprise Standards & Configuration Precedence
Rolling out Claude Code to hundreds or thousands of engineers requires separating advisory behavioral guidance from deterministic security enforcement. Treating Markdown prompt instructions as security controls leaves an enforcement gap. Enterprise architects must design two complementary configuration planes: the instruction plane (CLAUDE.md and .claude/rules/) and the policy plane (settings.json and managed settings).
The Critical Boundary: Advisory Context vs. Enforced Controls
CLAUDE.md files are natural-language instructions loaded into Claude's context window. They excel at teaching repository conventions, preferred test runners, architectural patterns, and naming standards. However, CLAUDE.md is probabilistic advisory context—Claude may overlook or misinterpret guidance even when it remains in context. The root file is reloaded after compaction; nested files and path-scoped rules load again as needed.
Architectural Rule: Never rely solely on CLAUDE.md to enforce security invariants such as blocking .env reads, preventing destructive shell commands, or stopping outbound network calls. Use managed tool permission rules and appropriate lifecycle hooks for client-side controls. For hard filesystem and network guarantees, enforce separate operating-system or infrastructure controls as well.
CLAUDE.md Hierarchy, Concatenation & Modular Rules
Unlike JSON configuration files that override lower layers key-by-key, discovered CLAUDE.md files concatenate into the session context. If a global file and a project file contain contradictory prose guidance, there is no deterministic override winner—Claude interprets both in context and may follow either.
| Scope | Typical File Path | Loading Behavior | Primary Enterprise Purpose |
|---|---|---|---|
| Managed Policy | /etc/claude-code/CLAUDE.md (Linux) or /Library/Application Support/ClaudeCode/CLAUDE.md (macOS) | Loaded at startup when CLAUDE.md loading is enabled | Org-wide engineering standards, compliance disclaimers, internal tool pointers |
| User Global | ~/.claude/CLAUDE.md | Loaded for the user when enabled | Personal output style, preferred editor workflow, local workstation habits |
| Project Shared | ./CLAUDE.md or ./.claude/CLAUDE.md | Loaded from the root when project instructions are enabled | Committed team conventions: build commands, PR checklists, service boundaries |
| Subdirectory | ./services/billing/CLAUDE.md | Loaded on demand when reading nested files | Package-specific invariants in large monorepos without bloating root context |
Keeping Monorepo Context Lean with @import and .claude/rules/
Stuffing 1,500 lines of database, frontend, and Terraform guidance into a root CLAUDE.md wastes input tokens on every turn and increases instruction dilution. Two mechanisms solve this:
- File Imports (
@import): RootCLAUDE.mdcan reference shared docs such as@docs/architecture/error-handling.mdso documentation stays single-sourced without copy-paste drift. Imported content is loaded with its parent file, so this improves organization rather than reducing input tokens. - Path-Scoped Rules (
.claude/rules/*.md): Modular Markdown files inside.claude/rules/support YAML frontmatter with apathsarray of glob patterns. Claude loads a scoped rule when it reads a file matching those globs.
---
paths:
- "src/api/**/*.ts"
- "src/middleware/**/*.ts"
---
# TypeScript API Standards
- Validate all request payloads with Zod schemas before service calls.
- Return RFC 9457 Problem Details objects for 4xx and 5xx responses.
By scoping API rules strictly to src/api/**, a developer editing React components in src/ui/ does not have to load the unrelated backend instructions up front.
settings.json Scope & Permission Precedence
While CLAUDE.md shapes behavior, settings.json controls machine-enforced configuration: tool permissions, hooks, environment variables, sandbox boundaries, and model defaults. Most ordinary settings keys resolve through this scope precedence (some security-sensitive settings may be stricter at a lower scope):
- Managed Enterprise Settings (Highest Priority): Deployed by IT/Security via
managed-settings.json, drop-inmanaged-settings.d/*.jsonfragments, MDM profiles, or OS registry policies. Developers cannot override these settings locally. - Command-Line Arguments: Session JSON supplied via the
--settingsflag. - Local Project Overrides (
.claude/settings.local.json): Git-ignored personal settings file for an individual developer's repo-specific preferences. - Shared Project Settings (
.claude/settings.json): Committed to Git so the entire team inherits consistent defaults, shared hooks, and baseline tool permissions. - User Global (
~/.claude/settings.json, Lowest Priority): Personal defaults across all repositories on a workstation.
Tool Permission Precedence: deny > ask > allow
Permission lists normally merge across settings levels. Matching deny rules are evaluated before ask and allow rules, with permission modes and sandboxing also affecting prompts. Managed-only permission policies may restrict which sources can contribute rules.
Consider a security policy in managed-settings.json that places Bash(curl *), Bash(rm -rf *), and Read(.env*) in deny. Even if a developer adds Read(.env*) to allow inside .claude/settings.local.json, or passes --allowedTools on the command line, the matching managed deny rule still blocks that Read tool call. This is not a substitute for OS-level file permissions and sandboxing: enforce actual access restrictions independently.
| Setting Scope | Version Control | Can Override Managed deny? | Typical Configuration Keys |
|---|---|---|---|
| Managed Settings | MDM / IT Fleet Tooling | Authoritative source | permissions.deny, approved MCP policies, org telemetry env vars |
| CLI Arguments | Ephemeral session | No | Session-specific settings |
.claude/settings.local.json | Git-ignored | No | Developer-specific allow shortcuts, local port overrides |
.claude/settings.json | Committed to Git | No | Team PostToolUse formatters, shared ask rules for DB scripts |
~/.claude/settings.json | Local home dir | No | Global UI preferences, personal non-sensitive defaults |
Custom Slash Commands & Skills: Packaging Repeatable Workflows
Teams turn tribal workflows—such as PR security reviews, API endpoint scaffolding, or database migration checks—into versioned custom slash commands (.claude/commands/*.md) and skills (.claude/skills/ folders containing SKILL.md). Both accept YAML frontmatter that constrains execution:
allowed-tools: Pre-approves the listed tools for the invoking turn (for example,Read, Grep, Glob). It is not a restriction on other tools; managed permissions and the runtime security boundary still apply.argument-hint: Documents expected parameters in autocomplete (for example,[pr-number] [service-name]) so engineers invoke workflows consistently.context: fork: Runs the skill as a separate subagent using the skill as its prompt. A review skill can inspect many files and return findings without filling the primary conversation with intermediate tool results. This is context isolation, not an OS security boundary; the skill needs enough task information to work without the parent conversation history.
Distributing Proven Workflows Across Teams
Once a workflow combines several skills, commands, hooks, subagents and MCP connections, package it as a Claude Code plugin instead of manually copying configuration into every repository. An individual team may still use a standalone project skill when it needs only one local procedure.
| Plugin component | Purpose |
|---|---|
.claude-plugin/plugin.json | Plugin identity, version and component metadata |
skills/<name>/SKILL.md or commands/<name>.md | Reusable instructions or a named invocation; skills are preferred for new work and can carry supporting files |
agents/<name>.md | Focused subagent definition |
hooks/hooks.json | Lifecycle hook configuration |
.mcp.json | MCP server definitions; store actual credentials outside the artifact |
A plugin marketplace catalogs plugins and their source locations in .claude-plugin/marketplace.json. An organization can maintain a reviewed private marketplace and use managed extraKnownMarketplaces and enabledPlugins to register approved catalogs and provision plugins. Managed strictKnownMarketplaces restricts marketplace sources; a source allowlist alone does not establish that all components or installation routes are trusted. Apply the organization's additional managed plugin and customization restrictions, effective permission policies and runtime isolation. Review plugin versions, dependency changes, hooks and MCP permissions before rollout; verify required components actually loaded in CI. A plugin root CLAUDE.md is not loaded as project instructions; use a skill for reusable instructions.
Decide which standards must be central (approved integrations, sensitive-resource access, release checks) and which can be team-specific (language style, local build conventions). Package a tested documentation-review skill and programmatic lint checks centrally, for instance, while letting repositories supply their own documentation paths. Never replace authorization with the skill's prose.
Select Permission Modes for the Task
| Mode | Appropriate interpretation |
|---|---|
default (Manual) | Requests approval for most edits and actions that require permission; ordinary allowed reads can proceed |
acceptEdits | Accepts file edits and certain filesystem commands within configured working directories; not unrestricted tool approval |
plan | Explore and plan without editing source files; independent restrictions still matter |
auto | Uses classifier-based action review where supported; not guaranteed human approval |
dontAsk | Denies calls that would otherwise require a prompt, while authorized/preapproved operations can proceed |
bypassPermissions | Skips most prompts; inappropriate for a sensitive shared environment. Prefer restricted tools and independent isolation; administrators can disable this mode. |
Choose modes based on whether a person is available, whether changes are intended and the actual permissions of the runner. In unattended CI, preapprove only required operations and deny unexpected ones; verify the effective managed rules and enforce an independent acceptance gate. Do not treat an approval mode as an operating-system boundary.
Common Exam Traps
- Trap 1: Assuming a directive in
./CLAUDE.mdsuch as "Never read.envfiles" guarantees secret protection. Use managed client-side permissions and separate OS-enforced access controls instead of relying on memory. - Trap 2: Assuming
.claude/settings.local.jsonoverridesmanaged-settings.jsonbecause local overrides sit higher than shared project settings. Managed enterprise settings always occupy the top tier, anddenyalways beatsallow. - Trap 3: Putting every domain rule in root
CLAUDE.mdinstead of.claude/rules/withpaths:globs orcontext: forkskills, causing unnecessary token spend and degraded instruction adherence.
Official references
An enterprise security team discovers that several engineers placed Read(.env.production) inside their local .claude/settings.local.json allow lists to speed up local debugging, despite managed-settings.json listing Read(.env*) under permissions.deny. What happens when an engineer runs Claude Code and asks it to inspect .env.production?
Claude reads .env.production because .claude/settings.local.json is project-specific and overrides global enterprise defaults
Claude is blocked from reading .env.production because managed enterprise settings outrank local project settings and deny always overrides allow
Claude prompts the user to confirm the read because conflicting allow and deny rules downgrade to ask
Claude reads .env.production only if the engineer passes --allowedTools Read on the command line
A 400-engineer monorepo has distinct coding standards for Go microservices (services/go/**), React frontends (apps/web/**), and Terraform modules (infra/**). Placing all three rule sets into the root ./CLAUDE.md causes bloated prompts and frequent rule misses during long sessions. Which configuration best solves this?
Move all three rule sets into ~/.claude/CLAUDE.md on each developer's laptop
Duplicate the entire rule set into every subdirectory's settings.json file
Place hard security prohibitions in root CLAUDE.md and rely on context compaction to trim unused rules
Split domain guidance into .claude/rules/*.md files with YAML frontmatter paths globs targeting each directory
A platform engineer must enforce a filesystem and network boundary for Claude Code shell execution rather than relying on natural-language guidance. Which approach best addresses the requirement?
Configure managed tool permissions and OS-level sandbox restrictions for filesystem and network access, with least-privilege credentials
Place an all-caps warning at the top of the managed policy CLAUDE.md file
Add a reminder in a universally loaded project rules file
Configure context: fork on every developer skill
A team builds a custom /arch-review slash command that inspects 30 files, runs git log queries, and summarizes architectural violations. Developers complain that running /arch-review fills their main coding session with noisy file reads and degrades subsequent edits. Which skill frontmatter setting addresses this?
Setting argument-hint: [branch-name] so developers pass fewer arguments
Adding ./CLAUDE.md via @import inside the slash command header
Setting context: fork so the review executes in an isolated sub-context and returns only its summary
Moving the slash command from .claude/commands/ to .claude/settings.local.json
A documentation-review workflow proven in one team combines a skill, focused subagent, lint hook and approved MCP integration. Other teams need the same reviewed bundle with centrally governed installation and room for repository-specific styles. Which design fits?
Copy each component by hand into every repository and rely on a shared prose reminder for security
Distribute one root CLAUDE.md and assume that it loads plugin hooks and tool connections automatically
Publish a versioned plugin in an approved internal marketplace, provision it through managed settings, keep access controls central and repository conventions local
Ask developers to install any plugin with a matching name from any marketplace
An unattended documentation CI job may use approved read tools, but it must deny calls that would need an interactive approval. Which permission mode best matches that requirement, alongside actual tool restrictions and isolated execution?
dontAsk
acceptEdits
auto
bypassPermissions
Sections you finish are checked off in the contents.