Back to Blog

Best Claude Code Settings & Configuration (2026): Power User Guide

Optimize your Claude Code setup with the best settings for CLAUDE.md, hooks, model routing, effort levels, permissions, and sub-agent configuration.

Theo Marsh13 min read

#Why Configuration Matters

Out of the box, Claude Code is good. Properly configured, it's transformative. The difference between a beginner and a power user isn't skill with prompts — it's how they've set up their environment.

This guide covers every configuration surface in Claude Code: CLAUDE.md files, settings.json, hooks, model selection, effort tuning, permissions, and sub-agent routing. Each section includes the actual config you should use.


#CLAUDE.md Best Practices

Your CLAUDE.md is the highest-leverage configuration file. Claude reads it at the start of every session. A good one saves you hundreds of repeated instructions.

#Project-Level CLAUDE.md

Place this at your project root and commit it to git. Your whole team benefits.

markdown
# CLAUDE.md
## Project
Brief description of what this project does.
## Stack
- Language: TypeScript 5.x
- Framework: Next.js 15 (App Router)
- Database: PostgreSQL via Drizzle ORM
- Styling: Tailwind CSS
- Testing: Vitest + Playwright
- Package manager: pnpm
## Commands
- Dev: `pnpm dev`
- Build: `pnpm build`
- Test: `pnpm test`
- Lint: `pnpm lint`
- Type check: `pnpm tsc --noEmit`
## Conventions
- Components in src/components/, colocated with their tests
- API routes in src/app/api/
- Database schemas in src/db/schema/
- Use server components by default, 'use client' only when needed
- Error boundaries around all data-fetching components
- Use zod for all input validation
## Do NOT
- Use default exports (except pages/layouts)
- Add new dependencies without checking if we already have an equivalent
- Modify the auth middleware without discussing first

Key principles:

  • Be specific about commands — include flags and paths
  • List conventions that Claude might not infer from code alone
  • Add a "Do NOT" section for common mistakes you've had to correct

#Personal CLAUDE.md

Place at ~/.claude/CLAUDE.md for preferences that apply across all projects:

markdown
# Personal Preferences
- Always use TypeScript, never plain JavaScript
- Prefer functional components over class components
- Write tests for any new function with >5 lines of logic
- Use descriptive variable names, no single-letter variables except loop counters
- When creating commits, use conventional commit format

#Nested CLAUDE.md

You can place CLAUDE.md files in subdirectories. Claude reads them when working in those directories:

src/
components/
CLAUDE.md # "All components use forwardRef and accept className prop"
api/
CLAUDE.md # "All API routes validate input with zod, return standardized error format"

Deep dive: Claude Code Memory & CLAUDE.md Guide


Want step-by-step guides for this and more?

ClawDocx Pro includes 500+ curated prompts, setup guides, SKILL.md files, and templates — everything to make your AI agent unstoppable.

See plans & pricing

#Settings.json Configuration

Claude Code reads settings from two locations:

  • Project: .claude/settings.json (committed, shared with team)
  • Global: ~/.claude/settings.json (personal)
json
{
"permissions": {
"allow": [
"Read",
"Glob",
"Grep",
"Bash(pnpm test*)",
"Bash(pnpm lint*)",
"Bash(pnpm build*)",
"Bash(pnpm dev*)",
"Bash(npx tsc*)"
],
"deny": [
"Bash(rm -rf*)",
"Bash(git push*)",
"Bash(git reset --hard*)"
]
}
}

Why this matters: The allow list lets Claude run tests, lint, and build without asking permission every time. The deny list prevents destructive operations. This balances autonomy with safety.

#Permission Modes

Claude Code has three permission modes:

ModeBehavior
DefaultAsks permission for writes, commands, and sensitive operations
PermissiveAuto-approves most operations, only blocks dangerous commands
RestrictedRequires approval for everything

For solo development, permissive mode with a solid deny list is the fastest workflow. For shared environments, default mode with explicit allow lists is safer.


#Hooks Configuration

Hooks fire automatically on Claude Code events. They live in .claude/settings.json under the hooks key.

#Auto-Format on File Write

json
{
"hooks": {
"afterWrite": [
{
"command": "npx prettier --write $FILE",
"description": "Auto-format written files"
}
]
}
}

#Lint Check Before Commit

json
{
"hooks": {
"beforeCommit": [
{
"command": "pnpm lint --quiet",
"description": "Lint before committing"
}
]
}
}

#Block Writes to Protected Files

json
{
"hooks": {
"beforeWrite": [
{
"command": "echo $FILE | grep -qE '(package-lock|pnpm-lock|\\.env)' && exit 1 || exit 0",
"description": "Prevent writes to lock files and .env"
}
]
}
}

Stack multiple hooks per event. They run in order — if any hook exits non-zero, the operation is blocked.

Deep dive: Claude Code Hooks Beginner's Guide


#Model Selection Strategy

Use /model to switch between models mid-session. Here's when to use each:

ModelBest ForToken Cost
Opus 4.6Complex architecture, nuanced refactoring, debugging hard issues, multi-file changesHighest
Sonnet 4.6Standard feature implementation, code review, writing testsMedium
Haiku 4.5Quick questions, simple edits, file lookups, explanationsLowest

Power user pattern: Start a session with Opus for planning and architecture, switch to Sonnet for implementation, drop to Haiku for quick follow-up questions.

Sub-agents automatically route to cheaper models when appropriate — Explore uses Haiku by default. You can override this in custom sub-agent definitions.


#Effort Level Tuning

The /effort command controls how deeply Claude reasons about each response.

LevelTokensUse Case
low~500-1KRename a variable, answer a quick question, simple file edit
medium~1-3KStandard feature work, write a function, add a test
high~3-10K+Debug a complex issue, architect a new module, refactor across files

Default is medium. Most power users leave it there and switch to high only for specific complex tasks. Using high for everything wastes tokens and slows you down.

Full breakdown: Effort, Context & Slash Commands


#/compact Strategy

Context window management is one of the biggest levers for Claude Code quality. Here's the strategy:

  1. Proactive compaction: Run /compact every 15-20 messages, or whenever you shift to a new task within a session
  2. Before complex tasks: Compact before starting a major feature so Claude has maximum context space
  3. When quality drops: If Claude starts repeating itself, losing track of requirements, or producing lower-quality code, compact immediately
  4. Custom summary: You can provide a focus — /compact focus on the auth module changes — to preserve specific context

#Sub-Agent Routing Rules

For custom sub-agents, you can control model, tools, and system prompt:

markdown
<!-- In CLAUDE.md -->
## Custom Agents
- For database migration tasks, use Opus with full shell access
- For documentation generation, use Haiku with read-only access
- For security review, use Opus with read-only access and emphasize OWASP top 10

Claude Code will respect these routing preferences when delegating to sub-agents. The key insight: cheap models for exploration, expensive models for decision-making.

Deep dive: Claude Code Sub-Agents Guide


#Memory Management

Beyond CLAUDE.md, Claude Code maintains a .claude/ directory with auto-generated memories. Manage this actively:

  • Review periodically: Check .claude/ to see what Claude has remembered. Delete anything outdated.
  • Seed important context: Add files to .claude/ manually for context you want persisted across sessions but don't want in the committed CLAUDE.md.
  • Keep CLAUDE.md lean: If your CLAUDE.md exceeds ~100 lines, it's too long. Move detailed information to separate files in .claude/ and reference them.

#The Complete Power User Setup

Here's everything together — a checklist for optimizing a new project:

  1. Create CLAUDE.md at project root with stack, commands, conventions, and "do not" rules
  2. Create .claude/settings.json with permission allow/deny lists
  3. Add hooks for formatting, linting, and protected file guards
  4. Set up nested CLAUDE.md files for directories with special conventions
  5. Configure your personal ~/.claude/CLAUDE.md with cross-project preferences
  6. Establish a /compact habit — proactive, not reactive

The payoff compounds. Each session starts smarter than the last, and you spend less time correcting Claude and more time shipping.


#Further Reading


#FAQ

What's the single most impactful Claude Code setting? CLAUDE.md. Nothing else comes close. A well-written CLAUDE.md file at your project root eliminates the majority of correction cycles and makes Claude Code behave like a teammate who knows your codebase. Invest 10 minutes writing a thorough one before configuring anything else.

Should I use permissive mode or default mode? For solo development on personal projects, permissive mode with a deny list for destructive operations is fastest. For team projects or anything in production, use default mode with explicit allow lists. The few seconds of approval clicks are worth the safety. Never use restricted mode unless you have a specific compliance requirement — it kills productivity.

How often should I run /compact? Every 15-20 messages, or whenever you notice quality degradation. Many power users compact proactively before starting each new major task, even if the conversation isn't that long yet. Think of it like saving your game — do it before the boss fight, not after you've already lost.

Can I share Claude Code settings across a team? Yes. Commit .claude/settings.json and your root CLAUDE.md to git. These are designed to be shared. Personal preferences go in ~/.claude/CLAUDE.md and ~/.claude/settings.json, which stay local. This gives teams consistent behavior while letting individuals customize their experience.

Does the model I choose really matter that much? Yes. Opus 4.6 produces noticeably better results for complex tasks — architecture decisions, multi-file refactoring, subtle bug diagnosis. But it's 5-10x more expensive than Haiku. The power user approach is strategic switching: Opus for thinking, Sonnet for implementing, Haiku for searching. Don't use Opus for everything — your bill will thank you.

Get the full experience with ClawDocx Pro

Access 500+ prompts, step-by-step guides, SKILL.md files, and more. Everything you need to master OpenClaw.

Start Free Trial

Related Posts