Level 3Lesson 28โฑ๏ธ 75 min

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.

Two places to configure Claude: (1) ~/.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 model

Used 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)
Best practice: Use Sonnet as your default. Switch to Opus only for complex architectural decisions, extended thinking tasks, or when Sonnet is clearly underperforming. Haiku is rarely worth the quality trade-off for coding tasks.
smallFastModel โ€” Sub-task model

Used 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

Without permissions configured

Claude asks for approval before every tool call โ€” every file edit, every bash command. Safe but slow and disruptive.

With allow rules

Commands matching the pattern run automatically. Claude stops and asks only for commands not in your allow list.

With deny rules

Commands 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

Developer (most permissive โ€” for trusted workflows)
"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:*)"
  ]
}
Knowledge Worker (conservative โ€” for document/email work)
"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:*)"
  ]
}
Read-only / Audit Mode (for sensitive environments)
"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:*)"
  ]
}
Best practices for permissions:
  • Always have a deny list even if your allow list is broad
  • Never allow sudo โ€” Claude should never need root access
  • Scope edit permissions to specific directories, not edit(*)
  • Block curl * | bash patterns โ€” 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 tool

Environment 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 completes

Additional 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 input

Use for: desktop notifications, Slack alerts, sound cues โ€” so you can walk away and come back

stop โ€” Runs when a Claude session ends

Use for: session summaries, cleanup tasks, end-of-session logs

Real-World Hook Examples

๐Ÿ”” macOS desktop notification when Claude needs you
"notification": [{
  "command": "osascript -e 'display notification "Claude needs your attention" with title "Claude" sound name "Glass"'"
}]
๐Ÿ“ Full audit log of every tool call
"pre_tool_call": [{
  "command": "echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] TOOL: $TOOL_NAME INPUT: $(cat $TOOL_INPUT_PATH)" >> ~/claude-audit.log"
}]
โœ… Auto-run tests when Claude writes a test file
"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.

๐Ÿ”’ Block edits to production config files
"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"
}]
๐Ÿ†• Session summary on stop
"stop": [{
  "command": "echo "[$(date)] Claude session ended" >> ~/claude-sessions.log"
}]
Hook best practices: Keep hooks fast (under 2 seconds). Long-running hooks block Claude. Use 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.

โŒ Never put secrets directly in env
"env": {
  "GITHUB_TOKEN": "ghp_abc123realtoken"  // โŒ Plaintext secret in config
}
โœ… Reference shell environment variables instead
// 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

includeCoAuthoredBy

When 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
cleanupPeriodDays

How 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.

โŒ Weak custom instructions
I am a software developer. Please be helpful and concise.

Adds no real value โ€” Claude already tries to be helpful and concise.

โœ… Strong custom instructions
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
Best practices for Custom Instructions:
  • 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.

What Memory stores

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).

How to manage it well

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."
When to turn Memory off

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.

Memory vs CLAUDE.md vs Custom Instructions:Memory = what Claude learns automatically | Custom Instructions = what you explicitly set globally | CLAUDE.md = project-specific context for Claude Code. All three stack on top of each other. Conflicts are resolved in favour of the most specific (project wins over global).

Feature Settings

Found under Settings โ†’ Features. These toggle specific Claude capabilities on or off.

Extended thinking

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.โ€

Suggested prompts

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.

Web search

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

Step 1 โ€” Open your settings file
cat ~/.claude/settings.json
# If it doesn't exist yet:
mkdir -p ~/.claude && touch ~/.claude/settings.json
Step 2 โ€” Ask Claude to audit your current settings
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
Step 3 โ€” Set up custom instructions

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]
Step 4 โ€” Review your Memory

Go to claude.ai โ†’ Settings โ†’ Memory. Delete anything outdated. Add anything important Claude should always know.

Step 5 โ€” Verify your MCPs are minimal
# 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

settings.json field reference
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
Claude.ai settings reference
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
Lesson 28 Quick Reference
model field

Sets the main Claude model. Sonnet for default, Opus for complex tasks. In settings.json.

permissions.allow

Bash/file patterns Claude can execute without asking. Scope tightly: edit(~/Projects/**) not edit(*).

permissions.deny

Patterns blocked entirely. Always include: rm -rf, sudo, curl|bash. Your last line of defence.

hooks

pre_tool_call / post_tool_call / notification / stop. Use for audit logs, auto-tests, desktop alerts.

Custom Instructions

Global system prompt on claude.ai. Under 500 words. Include: stack, style, communication prefs, and "do not" rules.

Memory

Cross-conversation facts Claude learns automatically. Review monthly, delete outdated entries, add corrections.