Copy-paste Claude Code settings templates that help reduce accidental exposure from human error and add guardrails against risky shell commands. They also help lower the risk of prompt injection and supply-chain attacks.
This repo is documentation and templates only. Treat every file as a starting point—review it against your own threat model before you ship it.
| Path | What it’s for |
|---|---|
settings-template.jsonc |
Reference template that collects security-related permissions options, ask prompts, sandbox settings, and small network/filesystem examples. |
examples/ |
Scope-specific templates for user, project, and managed settings. This directory includes ready-to-copy examples such as examples/user-settings.jsonc, examples/project-settings.jsonc, and examples/managed-settings.json. |
Scope and merge order are described in the official Settings docs.
File extensions: templates use .jsonc (JSON with // comments) so editors can validate them cleanly. Claude Code accepts that syntax when you paste into settings.json. To emit strict JSON, pipe through scripts/jsonc_to_json.py (see Getting started).
For per-file details, recommended install paths, and scope-specific usage, see examples/README.md.
Project scope
mkdir -p .claude
python3 scripts/jsonc_to_json.py examples/project-settings.jsonc > .claude/settings.jsonUser scope
mkdir -p ~/.claude
python3 scripts/jsonc_to_json.py examples/user-settings.jsonc > ~/.claude/settings.jsonManaged scope
Use examples/managed-settings.json as a reference if you manage Claude Code settings centrally. For install paths, see Settings — settings files.
The examples do not try to cover every toolchain with broad permissions.allow rules—add Bash(...) (and other) allow patterns for your stack as needed.
Merge allow rules into .claude/settings.local.json (or into .claude/settings.json if your team agrees), for example:
"permissions": {
"allow": [
"Bash(git *)",
"Bash(npm *)",
"Bash(npx *)",
"Bash(docker compose *)"
]
}Claude Code permissions and sandbox settings help reduce the risk of model-suggested tool use, but they are not a complete security boundary. Bash in particular has several ways to bypass static rules, so these templates should be used alongside OS-level controls, secret scanning, least-privilege credentials, and human review of AI-suggested commands.
No snippet replaces proactive security practices.