Claude Settings: The Complete Guide
Every setting that shapes how Claude behaves โ what each one does, best practices, and ready-to-use examples
Why Settings Matter
Most Claude users never touch their settings beyond adding an MCP. That's like buying a sports car and leaving all the driving modes on their factory defaults. The settings system controls what Claude can do autonomously, how safe its actions are, which model it uses, and how it behaves across every conversation. Spending 30 minutes on your settings is one of the highest-leverage things you can do.
~/.claude/settings.json for Claude Code / Cowork โ this controls tools, permissions, hooks, and MCPs. (2) Claude.ai web settings โ controls memory, custom instructions, appearance, and integrations. This lesson covers both exhaustively.Part 1: ~/.claude/settings.json
The master config file for Claude Code and Cowork. Here is every field with what it does and best-practice recommendations.
Full Annotated settings.json
{
// โโโ MODEL SELECTION โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"model": "claude-sonnet-4-6", // Main model for all tasks
"smallFastModel": "claude-haiku-4-5-20251001", // Used for quick sub-tasks
// โโโ MCP SERVERS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem",
"/Users/you/Documents", "/Users/you/Desktop"],
"env": {}
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_TOKEN" }
}
},
// โโโ PERMISSIONS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"permissions": {
"allow": [
"bash(git:*)", // Allow all git commands
"bash(npm:*)", // Allow all npm commands
"bash(ls:*)", // Allow directory listing
"read(*)", // Allow reading any file
"edit(~/Projects/**)" // Allow editing only in Projects folder
],
"deny": [
"bash(rm -rf:*)", // Never allow recursive delete
"bash(sudo:*)", // Never allow sudo
"bash(curl * | bash:*)" // Block piped curl execution
]
},
// โโโ HOOKS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"hooks": {
"pre_tool_call": [{
"command": "echo "[$(date)] Pre: $TOOL_NAME" >> ~/claude-audit.log"
}],
"post_tool_call": [{
"command": "echo "[$(date)] Post: $TOOL_NAME done" >> ~/claude-audit.log"
}],
"notification": [{
"command": "osascript -e "display notification \"Claude needs input\" with title \"Claude\""
}],
"stop": [{
"command": "echo "[$(date)] Session ended" >> ~/claude-audit.log"
}]
},
// โโโ ENVIRONMENT โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"env": {
"NODE_ENV": "development",
"ANTHROPIC_API_KEY": "$ANTHROPIC_API_KEY"
},
// โโโ BEHAVIOUR โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
"includeCoAuthoredBy": true, // Add "Co-Authored-By: Claude" to commits
"cleanupPeriodDays": 30 // Keep conversation history for 30 days
}Model Selection
Two model fields control which Claude model is used for what.
model โ Primary modelUsed for all main tasks: code writing, analysis, planning, complex reasoning.
"model": "claude-sonnet-4-6" // Best balance: speed + quality "model": "claude-opus-4-6" // Maximum capability (slower, higher cost) "model": "claude-haiku-4-5-20251001" // Fastest, cheapest (simple tasks only)
smallFastModel โ Sub-task modelUsed automatically for lightweight operations: summarisation, quick lookups, tool call routing. Keeping this as Haiku saves tokens without sacrificing quality on your main work.
"smallFastModel": "claude-haiku-4-5-20251001"
Permissions: The Safety Layer
The permission system controls which Bash commands and file operations Claude can run without asking you first. Getting this right is the most important safety configuration you have.
How Permissions Work
Claude asks for approval before every tool call โ every file edit, every bash command. Safe but slow and disruptive.
allow rulesCommands matching the pattern run automatically. Claude stops and asks only for commands not in your allow list.
deny rulesCommands matching deny patterns are blocked entirely โ Claude cannot run them even if you ask. Your last line of defence.
Permission Pattern Syntax
// Format: "tool(command:arguments)" "bash(git:*)" // Any git command "bash(npm run:*)" // Any npm run script "bash(cat:*)" // Any cat command "read(*)" // Read any file "read(~/Projects/**)" // Read files in Projects only "edit(~/Projects/**)" // Edit files in Projects only "edit(*.md)" // Edit only markdown files
Recommended Permission Profiles
"permissions": {
"allow": [
"bash(git:*)", "bash(npm:*)", "bash(npx:*)",
"bash(node:*)", "bash(python3:*)", "bash(pip3:*)",
"bash(ls:*)", "bash(cat:*)", "bash(echo:*)",
"bash(mkdir:*)", "bash(cp:*)", "bash(mv:*)",
"read(*)", "edit(~/Projects/**)"
],
"deny": [
"bash(rm -rf:*)", "bash(sudo:*)",
"bash(curl * | bash:*)", "bash(eval:*)"
]
}"permissions": {
"allow": [
"bash(ls:*)", "bash(cat:*)", "bash(echo:*)",
"bash(grep:*)", "bash(find:*)",
"read(*)", "edit(~/Documents/**)", "edit(~/Desktop/**)"
],
"deny": [
"bash(rm:*)", "bash(sudo:*)", "bash(curl:*)",
"bash(wget:*)", "bash(chmod:*)"
]
}"permissions": {
"allow": [
"bash(ls:*)", "bash(cat:*)", "bash(grep:*)",
"bash(git log:*)", "bash(git diff:*)", "bash(git status:*)",
"read(*)"
],
"deny": [
"bash(git commit:*)", "bash(git push:*)",
"edit(*)", "bash(rm:*)", "bash(mv:*)",
"bash(sudo:*)", "bash(curl:*)"
]
}- Always have a
denylist even if yourallowlist is broad - Never allow
sudoโ Claude should never need root access - Scope
editpermissions to specific directories, notedit(*) - Block
curl * | bashpatterns โ these can download and execute arbitrary code - Start conservative and loosen as you understand what you actually need
Hooks: Automations on Every Action
Hooks run shell commands automatically at key points in Claude's workflow. They are the most underused setting โ and one of the most powerful.
The Four Hook Types
pre_tool_call โ Runs before Claude uses any toolEnvironment variables available: $TOOL_NAME, $TOOL_INPUT_PATH (JSON file with tool args)
Use for: approval gates, audit logging, rate limiting, validating file paths before edits
post_tool_call โ Runs after every tool call completesAdditional env var: $TOOL_OUTPUT_PATH (JSON file with result)
Use for: auto-running tests after code changes, committing after edits, notifying on completion
notification โ Runs when Claude needs human inputUse for: desktop notifications, Slack alerts, sound cues โ so you can walk away and come back
stop โ Runs when a Claude session endsUse for: session summaries, cleanup tasks, end-of-session logs
Real-World Hook Examples
"notification": [{
"command": "osascript -e 'display notification "Claude needs your attention" with title "Claude" sound name "Glass"'"
}]"pre_tool_call": [{
"command": "echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] TOOL: $TOOL_NAME INPUT: $(cat $TOOL_INPUT_PATH)" >> ~/claude-audit.log"
}]"post_tool_call": [{
"command": "if echo "$TOOL_NAME" | grep -q 'write'; then FILEPATH=$(cat $TOOL_INPUT_PATH | python3 -c "import json,sys; print(json.load(sys.stdin).get('path',''))" 2>/dev/null); if echo "$FILEPATH" | grep -q '.test.'; then cd $(dirname $FILEPATH) && npm test --testPathPattern=$(basename $FILEPATH) 2>&1 | tail -5; fi; fi"
}]Checks if Claude wrote to a .test.* file, then runs just that test file automatically.
"pre_tool_call": [{
"command": "if [ "$TOOL_NAME" = "edit" ]; then FILEPATH=$(cat $TOOL_INPUT_PATH | python3 -c "import json,sys; print(json.load(sys.stdin).get('path',''))"); if echo "$FILEPATH" | grep -qE "(production|prod.env|.env.prod)"; then echo "BLOCKED: Cannot edit production files" >&2; exit 1; fi; fi"
}]"stop": [{
"command": "echo "[$(date)] Claude session ended" >> ~/claude-sessions.log"
}]exit 1 in pre_tool_call to block the tool call. Always test hooks manually in your terminal before adding them to settings.Environment Variables
The env block injects environment variables into every Claude session. This is the right place for API keys referenced by MCPs and for setting project-wide defaults.
"env": {
"GITHUB_TOKEN": "ghp_abc123realtoken" // โ Plaintext secret in config
}// In ~/.claude/settings.json:
"env": {
"GITHUB_TOKEN": "$GITHUB_TOKEN",
"ANTHROPIC_API_KEY": "$ANTHROPIC_API_KEY"
}
// In ~/.zshrc or ~/.bash_profile:
export GITHUB_TOKEN="ghp_abc123realtoken"
export ANTHROPIC_API_KEY="sk-ant-..."This way the secret lives in your shell profile (which you can exclude from backups) not in settings.json (which might sync).
Behaviour Settings
includeCoAuthoredByWhen true, Claude adds โCo-Authored-By: Claudeโ to every commit message it writes. Useful for transparency in team repos. Set to false for personal/private projects where you'd rather not expose your tooling.
"includeCoAuthoredBy": true // Recommended for team repos "includeCoAuthoredBy": false // For private/personal repos
cleanupPeriodDaysHow many days of conversation history to retain locally. Higher values mean Claude can reference older context across sessions. Lower values reduce disk usage and keep Claude's memory focused on recent work.
"cleanupPeriodDays": 30 // Recommended: 30 for active projects "cleanupPeriodDays": 7 // For privacy-sensitive or shared machines "cleanupPeriodDays": 90 // For long-running research projects
Part 2: Claude.ai Web Settings
These settings live at claude.ai โ Settings (top-right menu). They apply to all conversations in the web interface and the Claude desktop app.
Custom Instructions (System Prompt)
Found under Settings โ Profile. This is text injected as a system prompt at the start of every conversation โ Claude.ai's equivalent of a global CLAUDE.md.
I am a software developer. Please be helpful and concise.
Adds no real value โ Claude already tries to be helpful and concise.
I am a senior Python/FastAPI engineer at a fintech startup. Context: - Stack: Python 3.12, FastAPI, PostgreSQL, SQLAlchemy, pytest - We use async/await throughout โ never suggest synchronous patterns - Our API follows OpenAPI 3.1 โ always include type hints and docstrings - We run Ruff for linting (pyproject.toml config) Communication preferences: - Lead with the answer, then explain - Flag security issues proactively even when not asked - For complex changes, show a before/after diff, not just the new code - Use British English spelling What to avoid: - Never suggest JavaScript/TypeScript alternatives when I ask Python questions - Don't add requirements.txt changes without explaining why
- Keep it under 500 words โ it's loaded on every conversation
- Include your tech stack versions (not just โPython developerโ but โPython 3.12 + FastAPIโ)
- Add โwhat to avoidโ โ Claude takes prohibitions very seriously
- Specify communication style (lead with answer, bullet vs prose, spelling preferences)
- Revisit quarterly and compress as you learn what's actually helping
Memory Settings
Found under Settings โ Memory. Claude.ai can remember facts across conversations. This is distinct from CLAUDE.md โ it's a summary Claude builds automatically, not something you write.
Claude automatically saves: your name and role, recurring preferences it notices, project context you've mentioned, correction patterns (if you frequently correct the same thing, Claude saves to avoid repeating).
You can view and edit your memory at any time. Regularly review it and delete outdated entries. Tell Claude explicitly what to remember: โRemember that I prefer TypeScript over JavaScript for all my projects.โ
# Tell Claude what to remember: "Remember: I work in the healthcare domain. All data examples should use synthetic/fake patient data, never real examples." # Tell Claude to forget something: "Please forget that you remembered my old company name โ I changed jobs in January 2026."
Shared accounts, privacy-sensitive environments, or when you want each conversation to be fully independent. Go to Settings โ Memory โ toggle off. Existing memories are not deleted, just not used.
Feature Settings
Found under Settings โ Features. These toggle specific Claude capabilities on or off.
Enables Claude to โthink out loudโ before responding โ visible reasoning chain. Best for: complex decisions, multi-step planning, math-heavy tasks. Slower and higher cost per message. Best practice: Leave enabled. You can request it per-message: โThink step by step before answering.โ
Claude suggests follow-up questions at the end of responses. Useful when you are exploring a topic. Can be distracting in focused coding workflows. Best practice: Turn off if you find yourself ignoring them โ they consume UI space.
Allows Claude to search the web during conversations. Critical for current events, recent API changes, and anything that may have changed since Claude's training cutoff. Best practice: Always leave on. You can suppress it per-message: โAnswer from your training data only, don't search.โ
The Recommended Settings Audit (Run This Now)
๐ 15-Minute Settings Setup
cat ~/.claude/settings.json # If it doesn't exist yet: mkdir -p ~/.claude && touch ~/.claude/settings.json
Here is my current ~/.claude/settings.json: [paste contents] My workflow: [describe what you use Claude for โ coding / writing / research / etc] Review my settings and: 1. Flag any security issues (especially in permissions or env) 2. Suggest permissions rules appropriate for my workflow 3. Recommend hooks I am not using that would help me 4. Identify anything missing that experienced Claude users typically have
Go to claude.ai โ Settings โ Profile โ Custom Instructions. Paste this template and fill it in:
I am a [role] at [company/context]. Stack: [languages, frameworks, databases, tools] Code preferences: - [specific style preference] - [testing approach] - [what to avoid] Communication preferences: - [lead with answer or explanation first?] - [bullet points or prose?] - [language/spelling preferences] Do not: - [specific things Claude keeps getting wrong for you] - [suggestions you keep rejecting]
Go to claude.ai โ Settings โ Memory. Delete anything outdated. Add anything important Claude should always know.
# In Claude Code, run: /mcp # For each connected server, ask yourself: # "Did I use this in the last 2 weeks?" # If no, remove it from settings.json
Settings Cheat Sheet
model โ Main model (sonnet recommended) smallFastModel โ Sub-task model (haiku recommended) mcpServers โ External tools Claude can use permissions.allow โ Commands that run without asking permissions.deny โ Commands that are blocked entirely hooks.pre_tool_call โ Runs before any tool call hooks.post_tool_call โ Runs after any tool call hooks.notification โ Runs when Claude needs you hooks.stop โ Runs when session ends env โ Environment variables injected per session includeCoAuthoredBy โ Add Claude attribution to commits cleanupPeriodDays โ How long to keep conversation history
Profile โ Custom Instructions โ Global system prompt Profile โ Memory โ Cross-conversation facts Features โ Extended Thinking โ Visible reasoning chain Features โ Web Search โ Real-time internet access Features โ Suggested Prompts โ Follow-up suggestions Appearance โ Dark/light mode, font size Notifications โ Email digest settings
Sets the main Claude model. Sonnet for default, Opus for complex tasks. In settings.json.
Bash/file patterns Claude can execute without asking. Scope tightly: edit(~/Projects/**) not edit(*).
Patterns blocked entirely. Always include: rm -rf, sudo, curl|bash. Your last line of defence.
pre_tool_call / post_tool_call / notification / stop. Use for audit logs, auto-tests, desktop alerts.
Global system prompt on claude.ai. Under 500 words. Include: stack, style, communication prefs, and "do not" rules.
Cross-conversation facts Claude learns automatically. Review monthly, delete outdated entries, add corrections.