Here's my personal Claude Code setup, refined over months of daily use across multiple projects. Last updated: April 2026.
Configuration architecture
Claude Code runs on a 3-tier memory system:
| Tier | File | When it loads |
|---|---|---|
| Global | ~/.claude/CLAUDE.md | Every conversation, every project |
| Project | ./CLAUDE.md at the project root | Every conversation in that project |
| Subfolder | ./CLAUDE.md inside a subfolder | When Claude reads a file in that folder |
Additional files:
~/.claude/rules/: global rules (loaded based on context)~/.claude/commands/: custom skills and commands~/.claude/agents/: autonomous sub-agents~/.claude/scripts/: automation scripts for hooks~/.claude/settings.json: plugins, deny list, global permissions, hooks~/.claude/settings.local.json: status line and local permissions.claude/in each project: project-specific rules and settings
The models I use in 2026
| Model | When I reach for it | How |
|---|---|---|
| Opus 4.7 (1M context) | Important feature, large refactor, reading an entire codebase | Default in /model |
| Sonnet 4.6 (1M context) | Long workflows, editing 10+ files, when Opus gets too slow | /model sonnet |
| Haiku 4.5 | Short tasks, scripts, quick exploration, sub-agents | /model haiku |
| Opus 4.6 (Fast mode) | Rapid iteration with Opus quality | /fast mid-session |
The 1M context changes the game: I can load a whole monorepo before I even start thinking. In practice I stay on Opus 4.7 for anything that needs quality, I switch to Haiku for exploration sub-agents where only raw volume matters, and I flip to /fast when I need to iterate fast without losing Opus-level reasoning.
My global CLAUDE.md (~50 lines)
Loaded in EVERY conversation. Contains:
- Identity: dev Next.js + Supabase + shadcn/ui + Tailwind v4, replies in French, code in English
- Coding standards: TypeScript strict, Server Components by default, Server Actions + RLS + Zod
- UI/UX: shadcn/ui mandatory, Tailwind v4 CSS vars, Recharts SSR pattern
- Git: conventional commits in English, never push or force push without asking
- Tools: pnpm by default, Prettier via hook
My global rules (~/.claude/rules/)
safety.md, what's FORBIDDEN
rm -rf: usetrashsudowithout confirmation- Deleting SQL migrations
supabase db reset(destroys data and credentials)
supabase.md, mandatory patterns
createClient()(anon+RLS) for user pagescreateAdminClient()ONLY for admin and scripts- Server action pattern:
"use server"→createClient()→getUser()→ Zod → query
nextjs.md, Next.js conventions
- Server Components by default, Client Components only if state/events
- READ 3 SIMILAR FILES before creating a new component/route/action
- URL search params for filters (SSR-friendly), no useState
- Never create
middleware.tswithout checking what already exists
quality.md, quality standards
- Never mark a task done without proof it works
- Demand elegance for non-trivial changes
- Simplicity first, no laziness, minimal impact
workflow.md, session management
- Plan mode for any task with 3+ steps
- Subagents to keep context clean
/compactat 60%, STOP at 80%,/rewindif things go off the rails
self-improvement.md, auto-improvement
- After a user correction: save to memory (feedback)
- Missing pattern detected: suggest a rules update
changelog.md, automatic CHANGELOG
- Update
CHANGELOG.mdafter every code change
typescript-errors.md, multi-agent scope
- Only fix TypeScript errors in your own files
writing-style.md, AI anti-patterns
- Zero em-dashes, zero parallelism, zero pompous wording
pdf-export.md, carousel PDF export
- Dimensions divisible by 4 (standard: 1080x1348px)
- pypdf post-processing for exact MediaBox
My hooks
Hooks are the "automatic" side of Claude Code: they fire at precise moments (session start, before a tool, after a tool, end of session). Chapter 9 covers the full mechanism and how to write them. Here are the ones I wired into my ~/.claude/settings.json:
- SessionStart: automatically loads
~/Claude OS/brain/INDEX.mdand~/Claude OS/brain/memory/MEMORY.mdwhen I open a session inside~/Claude OS/. My knowledge base is already in context, no need to re-state it. - PostToolUse (Prettier): after every file edit, runs
npx prettier --write. Code stays formatted without thinking about it. - PostToolUse (console warn): alerts me when a
console.logslips into TypeScript. - PreToolUse (config protection): blocks stealth edits to
.eslintrc,.prettierrc,biome.json. Forces fixing the code instead of weakening the rules. - PreToolUse (TypeScript pre-commit): runs
npx tsc --noEmitbefore everygit commit, blocks the commit on error. - Stop: clickable macOS notification with project, branch, and session duration.
Here's the JSON skeleton:
{
"hooks": {
"SessionStart": [
{
"matcher": "~/Claude OS/**",
"command": "cat ~/Claude\\ OS/brain/INDEX.md ~/Claude\\ OS/brain/memory/MEMORY.md"
}
],
"PostToolUse": [
{ "matcher": "Edit|Write", "command": "npx prettier --write \"$FILE\"" },
{
"matcher": "Edit|Write",
"command": "~/.claude/scripts/console-warn.sh \"$FILE\""
}
],
"PreToolUse": [
{
"matcher": "Edit|Write",
"command": "~/.claude/scripts/config-protection.sh \"$FILE\""
},
{ "matcher": "Bash(git commit*)", "command": "npx tsc --noEmit" }
],
"Stop": [{ "command": "~/.claude/scripts/notify-session-end.sh" }]
}
}
My active plugins
Plugins add pre-configured workflows, installable via the official marketplace.
- superpowers: full framework with 4-round brainstorming, TDD, structured debugging, plans, parallel code review, worktrees.
- claude-seo: full-site, technical, schema, GEO (AI Overviews), image, and sitemap audits.
- claude-blog: editorial engine (write, rewrite, analyze, outline, audit, repurpose) with 100-point scoring for Google rankings and AI citations.
- ralph-loop: tasks that must repeat during a session (monitoring, polling, controlled iteration).
- claude-carbon: carbon footprint of each session with shareable report cards.
My MCP servers
MCP servers connect Claude Code to external services via the Model Context Protocol.
Local
- nano-banana: image generation and editing via Gemini (chapter 15)
Cloud (connected via claude.ai)
- Notion: read, create, and edit pages and databases
- Gmail: search, read, and draft emails
- Google Calendar: manage the calendar
- Supabase: run SQL, migrations, edge functions, types
- Vercel: deployments, logs, project config
- Stripe: payments, webhooks, authentication
- Sentry: monitoring and alerts
- Context7: up-to-date docs for any library
- Canva: design creation and editing
- Excalidraw: diagrams and technical schemas
Result: push a carousel to Notion, check a Vercel deployment, run SQL on Supabase, search an email. Without leaving the terminal.
My /code workflow, Prompt Discovery
The problem, Lost in the Middle
LLMs pay more attention to tokens at the beginning and end of the context. A big initial prompt ends up "in the middle" after exploration, and the model follows it less closely.
The fix, Prompt Discovery: each step is read JUST BEFORE it runs, keeping the instructions fresh at the end of the context.
How to use /code
/code Add a user profile page
Explores the codebase, executes, verifies (TypeScript, build).
/code --plan Add a notifications system
Explores, builds a plan, user validation, executes, verifies.
/code --plan --test --branch --pr Refactor the credits system
Explores, plans, git branch, executes, tests, PR.
The 4 steps
| Step | File | What happens |
|---|---|---|
| Explore | 01-explore.md | Spawns sub-agents to analyze the codebase, reads 3+ similar files |
| Plan | 02-plan.md | Builds a structured plan, identifies decisions (if --plan) |
| Execute | 03-execute.md | Codes in order: migrations → types → actions → UI |
| Verify | 04-verify.md | TypeScript check, lint, build, tests (if --test), PR (if --pr) |
The commands I lean on daily
Beyond /code, three built-in commands pace every session:
/loop: a task that must repeat (polling a deployment, controlled iteration on a render). I give it an interval, or let the model self-pace./rewind(or double Esc): undoes the last code edits AND rolls back the conversation. When Claude heads down a wrong path, this is 3x more efficient than fixing by hand./compact: summarizes the conversation and frees up context. I trigger it around 50-60%, never later.
My custom sub-agents
A sub-agent is a "mini-Claude" dispatched for a specific task. It explores, analyzes, then sends a summary back to the main context. Upside: it can read 120K tokens and return only 1-2K.
Exploration
- explore-codebase: project structure, stack, patterns, utilities (~500 words)
- explore-supabase: SQL migrations, RLS policies, server actions (~800 words)
- doc-lookup: documentation via Context7 MCP or web search (~1000 words)
Blog & content
- blog-researcher: recent stats, source verification, free images
- blog-writer: writing articles optimized for SEO and AI citations
- blog-reviewer: quality review across 5 categories, scoring /100
- blog-seo: on-page SEO optimization
SEO (7 specialized agents)
- seo-content · seo-technical · seo-schema · seo-geo · seo-performance · seo-sitemap · seo-visual
Each SEO agent covers one area: content, technical, schema.org, AI citations, Core Web Vitals, sitemaps, visual rendering.
Impact on context: a sub-agent can read 120K tokens and return only 1-2K to the main context. Massive savings that let you keep your context clean for the instructions that actually matter.
My skills and commands
Every .md file in ~/.claude/commands/ becomes a /name command.
Development
/code · /apex · /debug · /review · /component · /server-action · /form-builder · /migration-sql · /rls-policy · /refactor · /test-gen · /supabase-types · /codebase-map · /security-scan · /deploy-check · /push-prod · /pr · /clean-code · /explain · /perf-audit · /oneshot
Content & marketing
/carousel · /lk · /insta · /bip · /newsletter · /email · /veille · /image · /photo-gaetan · /banner · /video · /short · /deck · /content-repurpose · /recap · /ship · /metrics-share · /inbox-notion
Multi-step workflows
/code: Explore → Plan → Execute → Verify. Each step is a file read just-in-time (Prompt Discovery)./apex: advanced version with flags--auto,--plan,--branch,--pr,--test/brainstorm: deep research in 4 rounds (Exploration, Devil's Advocate, Synthesis, Crystallization)/debug: structured debugging in 5 steps (Init, Analysis, Solutions, Fix, Verify)/review: parallel code review with 4 reviewers (Code, Best Practices, Security, Devil Advocate)
New project checklist
- Create the project and init git
- Run
claudein the project folder - Run
/initto generate theCLAUDE.mdautomatically - Trim
CLAUDE.mdto ~100-200 lines (keep what matters) - Create
.claude/settings.local.jsonwith permissions - Add scoped rules in
.claude/rules/if needed - Add code comments in key utility files (zero cost)
settings.json configuration
The ~/.claude/settings.json file contains settings that improve response quality. These 3 options are recommended by Boris Cherny (Claude Code's creator):
{
"effortLevel": "high",
"alwaysThinkingEnabled": true,
"outputStyle": "Explanatory"
}
What each option does:
- effortLevel: "high": Claude uses more tokens to reason. Slower, but smarter. Boris uses this for everything.
- alwaysThinkingEnabled: true: shows Claude's reasoning. You see why it makes each choice.
- outputStyle: "Explanatory": adds "Insight" boxes that explain the patterns and frameworks used. Helpful when exploring an unfamiliar codebase.
These settings are also accessible via:
/modelto change the model and effort level/configfor the output style/fastto switch to Opus 4.6 (Fast mode) mid-session
Status line with context warning
The status line shows real-time info under the composer. My version adds a context warning:
#!/bin/bash
input=$(cat)
MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')
PCT=$(echo "$input" | jq -r '.context_window.used_percentage // 0' | cut -d. -f1)
COST=$(echo "$input" | jq -r '.cost.total_cost_usd // 0')
FOLDER="${DIR##*/}"
if [ "$PCT" -ge 80 ]; then
CTX=" [COMPACT NOW]"
elif [ "$PCT" -ge 60 ]; then
CTX=" [compact soon]"
else
CTX=""
fi
echo "[$MODEL] $FOLDER | ${PCT}% ctx${CTX} | \$$COST"
Result: [Opus 4.7] my-project | 45% ctx | $1.23. And when context goes above 60%: [Opus 4.7] my-project | 65% ctx [compact soon] | $2.10.
To enable it, add this to settings.local.json:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 2
}
}
Auto-memory: what's official, what's personal
The 4-type taxonomy I use for my memories (user, feedback, project,
reference) is my own convention, not an Anthropic constraint. The
official system only requires a MEMORY.md file that acts as an index.
Everything else (sub-files, categories, naming conventions) is structure I
layered on top so my brain stays readable. Feel free to adopt it, simplify it,
or skip the formalization entirely.
Concretely in my setup, ~/Claude OS/brain/memory/MEMORY.md lists typed memories and points to individual markdown files:
- user: who I am, how I collaborate, what I already know
- feedback: guidance on how to approach the work
- project: decisions, initiative status, deadlines, current context
- reference: pointers to external systems (Linear, Notion, Grafana, etc.)
Hooks write directly into that folder, and Claude reads it at startup through the SessionStart hook. The only truly official contract is the existence of a MEMORY.md as the entry point.
Global deny list (safety net)
In ~/.claude/settings.json, the deny list blocks dangerous commands everywhere, even in trust mode:
{
"permissions": {
"deny": [
"Bash(rm -rf*)",
"Bash(sudo*)",
"Bash(supabase db reset*)",
"Bash(git push --force*)",
"Bash(git push -f*)",
"Bash(git reset --hard*)",
"Bash(git clean -f*)"
]
}
}
These commands are the most destructive: deleting files, rewriting git history, wiping a database. Better to block them once and for all.
Advanced tips
The 3-files rule
Before creating a new component/route/action, Claude must READ at least 3 similar existing files. This guarantees pattern consistency without having to document everything in CLAUDE.md.
Code comments as instructions
Add // CLAUDE: comments in key utility files. When Claude reads those files to understand the patterns, it inherits the instructions for free, 0 extra tokens in the context.
Concrete examples:
supabase/server.ts: difference between anon client and adminai/types.ts: how to add a new AI skillstripe/client.ts: don't expose the secret key client-side
The "ultrathink" keyword
Adding ultrathink in a prompt forces Claude to use deep reasoning (extended thinking). Ideal for complex architecture problems, design choices with lots of trade-offs, or debugging subtle issues.
Prompt Discovery (anti "Lost in the Middle")
Never give all the instructions for a workflow in one go. Split into step files read just-in-time so the instructions always stay "fresh" at the end of the context.
Meta-prompt to optimize your prompts
The /meta-prompt skill generates optimized prompts by applying Anthropic best practices: XML tags, few-shot examples, chain-of-thought, etc. Useful for building system prompts for your AI skills.
Pre-commit TypeScript hook
A PreToolUse hook that intercepts git commit and runs npx tsc --noEmit first. Blocks the commit on a TypeScript error, automatic safety net.
Sample folder layout
~/.claude/
├── CLAUDE.md ← Global preferences
├── settings.json ← Plugins, deny list, hooks
├── settings.local.json ← Status line, local permissions
├── rules/
│ ├── safety.md ← Forbidden commands (rm -rf, sudo, db reset)
│ ├── supabase.md ← Mandatory Supabase patterns
│ ├── nextjs.md ← Next.js conventions
│ ├── workflow.md ← Best practices /compact, /rewind, sessions
│ └── changelog.md ← Update CHANGELOG after every change
├── commands/
│ └── code/
│ ├── skill.md ← /code workflow (entry point)
│ └── steps/
│ ├── 01-explore.md ← Exploration step
│ ├── 02-plan.md ← Plan step (if --plan)
│ ├── 03-execute.md ← Execution step
│ └── 04-verify.md ← Verification step
└── agents/
├── explore-codebase.md ← Project exploration sub-agent
├── explore-supabase.md ← Supabase schema sub-agent
└── doc-lookup.md ← Documentation sub-agent
~/code/my-project/
├── CLAUDE.md ← ~100-200 lines, project-specific
└── .claude/
├── settings.local.json ← Project permissions
└── rules/
├── db-schema.md ← DB schema (if applicable)
└── roadmap.md ← Phases and sprints