Zero Labs
Industry News / AI

How I Tamed Claude Code: Setup, Quirks, and What Defaults Get Wrong

Source · Towards AI By Andrii Tkachuk

From the publisher’s feed, collected in the ZeroLabs newsroom.

A no-nonsense walkthrough of how I configured Claude Code from scratch — what I turned off, what I kept, and the small details that make a big difference in daily work.If you’re using Claude Code daily, you probably already know it’s powerful. What’s less obvious is that out of the box, it’s not configured for you — it’s configured for a generic developer with no opinions and infinite tokens.I spent an evening tuning mine, and the difference is night and day. Cleaner context window, fewer interruptions, no accidental connections to MCP servers I never asked for, and a sane set of permissions that lets me work without playing whack-a-mole with confirmation dialogs.This article is exactly what I did, in the order I did it. Steal whatever’s useful.Photo by Dan Farrell on UnsplashBefore we start!🦾If this piece gives you something practical you can take into your own system:👏 leave 50 claps (yes, you can!) — Medium’s algorithm favors this, increasing visibility to others who then discover the article.🔔 Follow me on Medium and LinkedIn for more deep dives into agentic systems, LLM architecture, and production-grade AI engineering.1. The Hidden MCP Server Problem (Read This First)Here’s the thing nobody warns you about: if you use Claude.ai in the browser with a corporate or Pro account, all your connected MCP servers automatically sync into Claude Code.I run claude mcp list for the first time and see this:claude.ai Notion: ✓ Connectedclaude.ai Gmail: ! Needs authenticationclaude.ai Google Calendar: ! Needs authenticationclaude.ai Slack: ! Needs authenticationclaude.ai Atlassian: ! Needs authenticationclaude.ai Asana: ! Needs authenticationclaude.ai GitHub MCP: ! Needs authentication... 33 servers totalThirty-three MCP servers. I added zero of them manually. They came from my browser-based Claude.ai workspace.Why this matters: every MCP server you have active loads tool descriptions into Claude’s system prompt. With dozens of them, you’re burning thousands of tokens before you even type your first message. You’re also widening the attack surface — every connected server is one more thing that could break, leak, or be misused.Step 1: See what you haveclaude mcp listLook at that list with intent. Ask yourself for each one: “Do I need this in the terminal?”For most developers, the answer for things like Notion, Gmail, Slack, Pendo, Mixpanel, Lucid is no. You use those tools in their actual apps. You don’t need them in your coding terminal.Step 2: Disable the syncThere’s an environment variable that controls this:export ENABLE_CLAUDEAI_MCP_SERVERS=falseAdd it to ~/.zshrc (or ~/.bashrc) to make it permanent. Even better — put it directly in your Claude Code config so it doesn't depend on your shell:{ "env": { "ENABLE_CLAUDEAI_MCP_SERVERS": "false" }}(in ~/.claude/settings.json)Step 3: Add back only what you actually needFor example, that’s four servers — all related to diagrams and documentation, all useful in the terminal:claude mcp add --transport http --scope user drawio https://mcp.draw.io/mcpclaude mcp add --transport http --scope user excalidraw https://mcp.excalidraw.com/mcpclaude mcp add --transport http --scope user mermaid https://chatgpt.mermaid.ai/anthropic/mcpclaude mcp add --transport http --scope user context7 https://mcp.context7.com/mcpThe --scope user flag makes them available in all projects on this machine.After this, claude mcp list shows exactly four servers, and /context inside a session shows MCP tools loaded on-demand — meaning their descriptions don't pollute your context window unless they're actually used.Verify it worked:claude# inside the session:/contextYou should see something like MCP tools · /mcp (loaded on-demand). That's the goal.2. Permissions: The Three-Tier SystemDefault Claude Code asks you to confirm almost every action. Within an hour you’ll be smashing “yes” reflexively, which is the worst possible state — because the one time it asks about something dangerous, you’ll just keep clicking yes.The fix is deliberate permissions in ~/.claude/settings.json. Three buckets:allow — runs silently. Safe rituals: git status, npm test, cat, pytest, your own scripts.ask — Claude shows you the command and waits. Stuff that changes the world: git push, kubectl, aws, curl.deny — never runs, period. The catastrophic stuff and reading secrets.Here’s a sane baseline I use:{ "model": "sonnet[1m]", "env": { "ENABLE_CLAUDEAI_MCP_SERVERS": "false" }, "permissions": { "allow": [ "Read(**)", "Glob(**)", "Grep(**)", "WebSearch", "Bash(ls:*)", "Bash(cat:*)", "Bash(grep:*)", "Bash(rg:*)", "Bash(git status:*)", "Bash(git diff:*)", "Bash(git log:*)", "Bash(git add:*)", "Bash(git commit:*)", "Bash(git checkout:*)", "Bash(git pull:*)", "Bash(npm run:*)", "Bash(npm test:*)", "Bash(pnpm:*)", "Bash(python:*)", "Bash(pip install:*)", "Bash(uv:*)", "Bash(pytest:*)", "Bash(ruff:*)", "Bash(mypy:*)", "Bash(make:*)", "Bash(docker compose:*)", "Bash(./test.sh:*)", "Bash(./lint.sh:*)", "Bash(./start.sh:*)", "Bash(./scripts/*.sh:*)" ], "ask": [ "Bash(git push:*)", "Bash(git merge:*)", "Bash(git rebase:*)", "Bash(docker run:*)", "Bash(kubectl:*)", "Bash(aws:*)", "Bash(curl:*)", "Bash(wget:*)", "Edit(**/.env*)", "Edit(**/Dockerfile)", "Edit(**/package.json)", "Edit(**/pyproject.toml)" ], "deny": [ "Bash(rm -rf:*)", "Bash(sudo:*)", "Bash(git push --force:*)", "Bash(git push -f:*)", "Bash(git reset --hard:*)", "Bash(chmod 777:*)", "Bash(npm publish:*)", "Read(./.env)", "Read(**/.env)", "Read(**/.env.*)", "Read(**/secrets/**)", "Read(**/*.pem)", "Read(**/*.key)", "Read(**/id_rsa*)", "Read(~/.ssh/**)", "Read(~/.aws/credentials)", "Read(~/.config/gcloud/**)" ] }}A few things worth highlightingReading secrets is in deny. This is the single most important entry in the whole file. Without it, an unlucky prompt could put your .env contents into the model's context, into a log, into a PR description Claude is helping you write. Once secrets are out, you can't put them back.Syntax gotcha. The :* pattern means "any arguments" and must be at the end of the rule. Bash(rm -rf:*) is valid; Bash(curl:*| sh*) is not — Claude Code will warn you on startup if you get it wrong. Listen to those warnings.Project-specific scripts. If you have scripts in subdirectories (like ./docker/test.sh), don't add them to your global config. Put them in a project-level .claude/settings.json:{ "permissions": { "allow": [ "Bash(./docker/*.sh:*)", "Bash(bash ./docker/*.sh:*)" ] }}This file can be committed to your repo. Your team gets the same configuration. Just remember to add .claude/settings.local.json to .gitignore — that one is for personal/machine-specific stuff and shouldn't be shared.3. Pick the Right Model for the JobClaude Code lets you switch between models, and this is one of the easiest wins.Screenshot from Anthropic’s “Claude in Amazon Bedrock” courseOpus — the heavyweight. Best reasoning, also the most expensive in tokens. Use when you really need it: complex architecture decisions, debugging gnarly issues, working through unfamiliar code at scale.Sonnet — the workhorse. Strong enough for 95% of coding tasks, much cheaper. Default for daily work.Haiku — the speedster. Cheap, fast, good for simple edits, file moves, mechanical refactors.The mistake I see people make: they leave Opus on by default “to be safe” and then wonder why their token usage is brutal. Opus burns through context fast. Save it for when you genuinely need its reasoning.Switch models inside a session with /model. You can also pin a default in ~/.claude/settings.json:{ "model": "sonnet[1m]"}The [1m] part requests the 1-million token context variant if your account supports it. Useful for big codebases, but don't treat it as a license to dump everything into the chat — quality of attention degrades on every LLM as context fills up. More space ≠ better answers.4. CLAUDE.md: The Underused SuperpowerCLAUDE.md is a plain Markdown file Claude Code automatically reads at the start of every session. There's no magic frontmatter, no YAML, no special syntax. Just instructions in your own words.The hierarchy:~/.claude/CLAUDE.md # global — applies everywhere/CLAUDE.md # project-level — committed, shared with team/CLAUDE.local.md # project-level personal — gitignored//CLAUDE.md # subdirectory rules — loaded when working in that dirThat last one is the underrated trick: subdirectory CLAUDE.md files load on demand when Claude works with files in that folder. So you can have specific rules for frontend/, backend/, migrations/, docker/ without bloating your project's main CLAUDE.md.One specific use case I love: custom logging conventionsEvery team has its own logging style. I have very particular preferences — log structure, what to include, what level to use, how to handle exceptions. Writing this once into CLAUDE.md means I never have to remind Claude again. It just does the right thing in every new file.If you find yourself correcting Claude on the same thing twice — that’s a CLAUDE.md entry waiting to happen.Generating the first versionDon’t write it from scratch. Run /init in your project root. Claude will scan your codebase, look at your package.json/pyproject.toml/Makefile/README.md, and generate a sensible starting CLAUDE.md. Then refine.A note on AGENTS.mdYou may have an AGENTS.md in your project — it's a cross-tool standard for AI agent instructions (Cursor, Codex CLI, Aider, and others read it). Claude Code as of this writing reads CLAUDE.md, not AGENTS.md. The cleanest way to handle both:# CLAUDE.md@AGENTS.md## Claude Code-specific notes(any extra Claude-only stuff goes here)The @filename syntax inlines another file's contents. One source of truth (AGENTS.md), Claude-specific additions on top.5. Skills: For Things You Do RepeatedlySkills are the most underrated feature in Claude Code. If you find yourself explaining the same complex thing every time — the structure of a project type, your team’s API design conventions, a framework you build — that’s a skill.A skill is a folder with a SKILL.md describing what it covers, plus any supporting files (templates, checklists, reference scripts). Claude reads the description and decides on its own whether to load the full skill for a given task. This is called progressive disclosure: the description costs almost no tokens, the full content only loads when relevant.My example: I build MCP servers regularly. I have a skill called create-mcp-server that contains:My standard project layoutBoilerplate for the MCP server lifecycleAuthentication patterns I’ve settled onCommon gotchas with specific transportsA reference templateNow when I say “create a new MCP server for XXX”, Claude pulls in this skill automatically and produces a project that already matches my conventions. I don’t re-explain anything.Skills live in ~/.claude/skills//SKILL.md (user-level) or /.claude/skills//SKILL.md (project-level).The general principle: anything repeatable that contains a lot of instruction belongs in a skill, not in a chat message.6. Memory: Personalize Across SessionsClaude Code has a memory feature — it can remember facts across sessions. You don’t manage this with files manually; you just tell Claude:“Remember that I prefer async/await over .then() callbacks.”Or:“Remember that for this project we deploy via make deploy-staging, never directly with aws CLI."It writes this into its memory store, and the fact persists into all future sessions.You’re in full control: you can view, edit, or remove memories any time. This is a different mechanism from CLAUDE.md:CLAUDE.md — explicit, version-controlled, sharable with team. Good for project conventions.Memory — implicit, personal, evolves over time. Good for personal preferences and small recurring facts.Use both. They complement each other.7. The /compact CommandLong sessions accumulate. Every tool call, every file read, every back-and-forth stays in the context window until you start fresh. With Opus this becomes painful fast.Two commands to know:/clear — wipes the session, starts clean. Best practice: use between unrelated tasks./compact — summarizes the conversation so far into a shorter form, keeping the gist while freeing tokens.When to use which:Switching tasks (“now let’s write tests” after debugging something) → /clearSame task is genuinely long but you want to keep going → /compactApproaching the context limit and you can’t stop → /compact is your safety valveDon’t be precious about /clear. Fresh sessions give better answers. Most people use it far less than they should.8. Diagnose Your Context With /contextThe single most useful command for understanding where your tokens go:/contextIt shows a breakdown:System prompt (Claude Code’s built-in instructions)System tools (Read, Edit, Bash, etc.)Memory files (CLAUDE.md)SkillsMCP toolsMessages (the actual conversation)Free spaceRun it occasionally. If something’s eating your context, this is where you’ll see it. After my cleanup, my fresh session shows ~17k tokens used (about 2% of a 1M context). That’s the goal: a healthy starting point that leaves almost everything for actual work.9. Running Claude Code Through AWS Bedrock or Google Vertex AILess-known but useful: you don’t have to use an Anthropic API key directly. Claude Code supports running through:AWS Bedrock — uses your AWS account’s IAM credentials. Useful if your org has Bedrock access and tracks AI spend through AWS billing.Screenshot from Anthropic’s “Claude in Amazon Bedrock” courseGoogle Vertex AI on GCP — same idea, through your GCP project.Screenshot from Anthropic’s “Claude with Google Cloud’s Vertex AI” courseFor a lot of corporate environments where Anthropic-direct billing is hard to set up, but Bedrock or Vertex are already approved, this is the path of least resistance. You configure it via environment variables — Anthropic’s docs cover the exact variables for each provider.This also means: if you have AWS credits, you can effectively run Claude Code on those credits via Bedrock. Same model, different billing path.10. The Stuff I Haven’t Used Yet (But You Might)Two features I’ll mention briefly because they’re powerful, even though I haven’t fully integrated them yet:Hooks. Shell scripts that run automatically on events like PreToolUse or PostToolUse. Examples: auto-run linter after every Edit, block git commit if tests fail, send a Slack notification when a long task finishes. They run outside the context window, so they don't cost tokens. If you have repeatable workflow checkpoints, hooks are how you enforce them.Custom slash-commands. Files in ~/.claude/commands/ (user-level) or /.claude/commands/ (project-level). Each .md file becomes a /command-name. Use them to wrap complex prompts you reuse: /code-review, /explain-pr, /lint-fix. Saves both typing and tokens compared to retyping the same instructions.I haven’t built out an extensive set yet. When I do, I’ll write about it. For now, knowing they exist and that the bar to creating one is low (it’s just a Markdown file) is enough.My Final Configuration in One PlaceFor reference, here’s what my setup looks like after all of the above:~/.claude/settings.json — model, sync disabled, three-tier permissions (shown in section 2)~/.claude/settings.local.json — only personal WebFetch domain allowlist:{ "permissions": { "allow": [ "WebFetch(domain:docs.example.com)", "WebFetch(domain:api.example.com)" ] }}~/.claude/CLAUDE.md — short, ~600 tokens, my universal preferences (logging style, code style preferences I always want)MCP servers: 4 useful ones (Drawio, Excalidraw, Mermaid, Context7), claude.ai sync disabledPer project: a CLAUDE.md with stack, commands, conventions, don'ts. A .claude/settings.json with project-specific script permissions.Total context on session start: about 17k / 1M tokens. Effectively a clean slate.Final ThoughtsClaude Code is a tool, not a magic wand. The defaults are aimed at the median user. If you spend even an hour configuring it deliberately — kill the MCP noise, set up sane permissions, write a useful CLAUDE.md, learn /context and /clear — your daily experience changes substantially.The token savings are real. The friction reduction is real. The peace of mind from knowing Claude won’t read your .env file or push to main with --force is real.None of this is hard. It just requires deciding to do it.Take into account that the information in this article is relevant as of the publication date. Of course, all of these ideas can be further developed, improved, and adapted over time.I also think it is important to remember that many of us have already developed our own best practices, workflows, preferences, and rules for working with AI agents. That is why directly copying someone else’s Skills, CLAUDE.md files, prompts, or configurations is usually not the best approach.These things are highly subjective and personal. You can definitely borrow ideas, patterns, or useful fragments, but a setup that works perfectly for one person may not work equally well for someone else. Each of us has different habits, expectations, domain knowledge, and ways of getting the desired output from an agent.So the real value is not in blindly copying each other’s setups, but in sharing observations, findings, and practical lessons: what worked, what did not, what improved the output, and what made the workflow more efficient.In the end, everyone should decide what to adopt, what to adapt, and what to ignore. Some things can be reused directly, some can inspire better solutions, but the most important part is to build a setup that actually works for your own workflow.So the real value is not in blindly copying each other’s setups, but in sharing observations, findings, and practical lessons: what worked, what did not, what improved the output, and what made the workflow more efficient.In the end, everyone should decide what to adopt, what to adapt, and what to ignore. Some things can be reused directly, some can inspire better solutions, but the most important part is to build a setup that actually works for your own workflow.And that’s a wrap! If you’ve read this far, it probably means you found this article useful or insightful. If that’s the case, consider leaving a few claps or sharing it with your team, please. Thanks for reading! 🚀How I Tamed Claude Code: Setup, Quirks, and What Defaults Get Wrong was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.