Introducing a new way to review your PRs.

Read the announcement

anthropics / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

View on GitHub

13 documents · Updated Nov 16, 2026

docs / examples-and-configuration-templates

Examples and configuration templates

Overview

The examples/** tree is a set of deployable or copy-and-edit templates for Claude Code managed settings, hooks, and Claude apps gateway deployments. These examples are not runtime source for the product; they encode expected runtime behavior through settings keys, hook exit codes, gateway configuration, cloud resource wiring, and deployment-time guard rails.

examples/…/README.md frames the settings files as organization deployment starting points and calls out that some controls only matter from enterprise-managed settings, such as strictKnownMarketplaces, allowManagedHooksOnly, and allowManagedPermissionRulesOnly. The basic profiles are intentionally small: examples/…/settings-lax.json disables bypass permissions mode and blocks all plugin marketplaces with an empty strictKnownMarketplaces, while examples/…/settings-strict.json also asks for Bash approval, denies WebSearch/WebFetch, ignores user/project permission rules and hooks, and configures an empty sandbox network. examples/…/settings-bash-sandbox.json is narrower: it demonstrates managed Bash sandbox enforcement with no unsandboxed fallback, empty excluded commands, no network domains, no local binding, and no weaker nested sandbox.

The HIPAA-oriented settings pair is the most complete managed-settings example. examples/…/settings-hipaa.json is meant to be deployed as managed-settings.json; it forces Claude.ai login to a specific org, allows only Anthropic as a provider, forces fresh remote settings, disables remote control/artifacts/account sync paths, blocks MCP by default through empty allowlists plus built-in server denies, and denies tools and file paths that could move content or credentials off the machine. Its sandbox block forces Bash into the sandbox, denies unsandboxed commands, limits network to placeholder Git/registry hosts, hides credential files and environment variables, and sets local cleanup to 30 days. Its env block routes traffic through a proxy, sends OTLP telemetry to a collector, and disables prompt/response/tool/raw-body logging. examples/…/managed-mcp-hipaa.json is the companion managed-mcp.json with an empty mcpServers object, which disables MCP while preserving the required key shape. examples/…/README-hipaa.md explains what operators must replace before deployment, including forceLoginOrgUUID, proxy and collector hosts, sandbox allowed domains, retention, reviewed MCP/plugin/hook allowlists, and credential path coverage.

examples/mdm/** shows how the same minimal managed-setting payload can be delivered as enterprise policy. examples/…/managed-settings.json is the raw JSON file form for the system config directory. examples/mdm/macos/com.anthropic.claudecode.plist and examples/mdm/macos/com.anthropic.claudecode.mobileconfig encode the same permissions.disableBypassPermissionsMode = disable value for Jamf/Kandji custom settings or a full configuration profile under the com.anthropic.claudecode preference domain. examples/mdm/windows/Set-ClaudeCodePolicy.ps1 writes C:\Program Files\ClaudeCode\managed-settings.json with UTF-8 no BOM for Intune platform scripts. examples/mdm/windows/ClaudeCode.admx and examples/mdm/windows/en-US/ClaudeCode.adml define a machine policy that stores a single-line JSON string at HKLM\SOFTWARE\Policies\ClaudeCode\Settings, which Claude Code treats as a highest-precedence managed source.

examples/…/bash_command_validator_example.py is a PreToolUse Bash hook example. The docstring includes the settings snippet that registers the script for PreToolUse with matcher: "Bash". At runtime the hook reads the JSON hook payload from stdin, ignores non-Bash tools, extracts tool_input.command, and blocks commands matching its validation rules by printing guidance to stderr and exiting 2. Exit 1 is reserved for malformed JSON and shows stderr to the user but not Claude; exit 0 allows execution. The shipped rules prefer rg over simple grep and rg --files patterns over find ... -name.

The gateway examples are full cloud reference deployments for the claude gateway runtime. examples/gateway/gcp/gateway.yaml.example configures a Cloud Run/GKE-shaped gateway with Google Workspace OIDC, refresh-token parameters, a required Postgres store, Agent Platform (provider: vertex) upstream auth via ADC, optional telemetry fan-out, optional managed policies, optional admin keys, and optional model catalog pinning. examples/…/setup.sh automates the GCP walkthrough: enabling APIs, creating a runtime service account with Agent Platform access, building a verified Claude Code binary image, creating a VPC/Private Services Access path, creating private-IP Cloud SQL, writing Postgres/JWT/config secrets, and deploying Cloud Run with Direct VPC egress. Its Dockerfile expects a prebuilt linux-x64 claude binary and mounts gateway.yaml from Secret Manager at etc/…/gateway.yaml. The GCP Terraform sibling in examples/…/*.tf provisions the same Cloud Run path declaratively, but still requires a separate image build/push; it reads ../gateway.yaml, fails if non-comment REPLACE_ME placeholders remain, stores it as a secret, mounts it into Cloud Run, and stamps config/secret hashes so secret rotations or config edits create a new revision.

examples/gateway/aws/gateway.yaml.example is the AWS-shaped gateway configuration: Okta OIDC, Bedrock upstream auth via the AWS default credential chain, required Postgres store, optional telemetry, optional managed policies/admin keys, and model catalog notes for US-geo Bedrock inference profiles. Unlike the GCP example, the AWS config is intended to be baked into the image rather than mounted from a config secret. examples/…/setup.sh provisions the ECS Fargate path: security groups chaining corp network to an internal ALB to gateway tasks to RDS, task/execution IAM roles, immutable scanned ECR images, private encrypted RDS with TLS enforcement, Secrets Manager values for JWT/OIDC/Postgres, and an ECS service behind an internal ALB. examples/gateway/aws/Dockerfile copies the filled gateway.yaml and RDS CA bundle into the distroless image, sets NODE_EXTRA_CA_CERTS, and runs claude gateway --config /etc/claude/gateway.yaml. The AWS Terraform module in examples/…/*.tf mirrors the ECS path while leaving VPC/private subnets as prerequisites; Terraform creates ECR but not the image, reads ../gateway.yaml for placeholder checks and roll-trigger hashes, injects secrets into the task definition, and outputs ALB and deployment identifiers.

Coverage / routing

This document owns examples/**, including:

  • examples/settings/** managed settings and HIPAA settings examples.
  • examples/mdm/** macOS, Windows, and generic managed-settings deployment templates.
  • examples/hooks/** hook examples.
  • examples/gateway/aws/** AWS gateway YAML, shell, Docker, and Terraform examples.
  • examples/gateway/gcp/** GCP gateway YAML, shell, Docker, and Terraform examples.

Coupling

  • If a gateway YAML template changes how secrets are referenced, update its deployment scripts and Terraform in the same provider directory. examples/gateway/gcp/gateway.yaml.example uses ${OIDC_CLIENT_SECRET}, ${GATEWAY_JWT_SECRET}, and ${GATEWAY_POSTGRES_URL} as environment variables; examples/…/setup.sh and examples/…/main.tf inject those names and mount only gateway.yaml as a file. examples/gateway/aws/gateway.yaml.example uses the same environment variable names, and examples/…/setup.sh plus examples/…/main.tf inject matching Secrets Manager values into ECS.
  • If the AWS gateway config stops being baked into the image, change all three AWS deployment surfaces together: examples/gateway/aws/gateway.yaml.example documents the baked-config model, examples/gateway/aws/Dockerfile copies the config into etc/…/gateway.yaml, and examples/…/setup.sh/examples/…/main.tf gate on filled gateway.yaml before building or applying. A config edit currently requires a new image tag; documenting or implementing a runtime mount in only one place would leave operators deploying stale config.
  • If the GCP gateway config mount path changes, keep examples/gateway/gcp/Dockerfile, examples/…/setup.sh, and examples/…/main.tf aligned. The entrypoint always reads etc/…/gateway.yaml; Cloud Run setup mounts the config secret there, and Terraform mounts a Secret Manager volume at /etc/claude with item path gateway.yaml.
  • If the gateway store TLS settings change, update the cloud examples as pairs. GCP builds gateway-postgres-url with ?sslmode=require in examples/…/setup.sh and examples/…/main.tf. AWS builds ?sslmode=verify-full, enforces RDS rds.force_ssl, and relies on NODE_EXTRA_CA_CERTS from examples/gateway/aws/Dockerfile; dropping any one of those makes the TLS behavior described by the templates untrue.
  • If managed-settings schema or precedence changes, update both settings and MDM examples. examples/…/*.json show the policy keys themselves, while examples/mdm/** shows platform delivery of a minimal managed payload at the highest precedence. A key renamed in settings but left in examples/…/managed-settings.json, the macOS plist/mobileconfig, the Windows PowerShell script, or the ADMX/ADML example gives administrators a policy that appears deployed but has no runtime effect.
  • If hook exit-code semantics change, revise examples/…/bash_command_validator_example.py and any settings prose that tells users how to block Bash calls. The example depends on exit 2 blocking the tool call and surfacing stderr to Claude; changing that contract would turn the validator into advice instead of enforcement.

Risks

  • examples/…/settings-hipaa.json intentionally ships placeholders and broad sample assumptions. If forceLoginOrgUUID, proxy hosts, OTEL_EXPORTER_OTLP_ENDPOINT, sandbox.network.allowedDomains, and credential path denies are not edited as described in examples/…/README-hipaa.md, Claude Code can fail at startup, route traffic to nonexistent proxies, block legitimate package/Git access, or leave local credential locations readable/writable.
  • examples/gateway/aws/gateway.yaml.example, examples/gateway/aws/Dockerfile, examples/…/setup.sh, and examples/…/main.tf use a baked-config image model. If an operator edits gateway.yaml but reuses the old image tag, ECS redeploys the old config even if Terraform notices a config hash change; login redirects, upstream regions, or managed policies can remain stale.
  • examples/…/setup.sh and examples/…/main.tf mount secrets at latest and rely on config/secret hashes to roll Cloud Run revisions. If that hash plumbing is removed, rotating the database password, JWT secret, OIDC secret, or gateway config can leave warm revisions using stale values and cause reconnects or logins to fail later.
  • examples/gateway/aws/gateway.yaml.example, examples/…/setup.sh, and examples/…/main.tf require trusted_proxies/corporate CIDR/subnet choices to stay separated. If the ALB subnet CIDRs listed as trusted proxies overlap with untrusted workloads or the corporate ingress range, a co-located host can spoof X-Forwarded-For, corrupting audit IPs, per-IP rate limits, or IP allowlists.