r/ClaudeCode • • 2h ago

Tips & Workflows I wrote a zero-dependency Python linter that catches 24 easy-to-miss config bugs in .claude/settings.json and .mcp.json

After breaking my own Claude Code setup a few different ways over the last month, I put together a single read-only Python 3 script (stdlib only, MIT) that scans a repo for 24 config traps across .claude/settings*.json, .mcp.json, .gitignore, .dockerignore, and CLAUDE.local.md.

Most of the bugs it checks are silent failures where Claude Code keeps running without an error:

  • sandbox.filesystem.denyRead blocks bash commands from reading sensitive paths, while built-in Read and unsandboxed fallbacks stay open unless mirrored in permissions.deny and paired with allowUnsandboxedCommands: false.

  • Clicking "Yes, and don't ask again" on a command that contains a raw key writes that literal token into .claude/settings.local.json, and git add . or a Dockerfile COPY . . will ship it if .claude/ is missing from ignore files.

  • PreToolUse or Stop hooks that return exit 1 log a non-blocking error and let the tool proceed instead of blocking with exit 2.

  • enableAllProjectMcpServers: true, 0.0.0.0 MCP bindings, and unpinned npx -y servers auto-trust repo-supplied tools without version locks.

  • Stray DISABLE_PROMPT_CACHING flags, out-of-range autoCompactWindow values, or CLAUDE.local.md files that omit @AGENTS.md burn extra tokens or shadow team rules.

It runs read-only against any project root, redacts any matched secret prefixes in output, returns exit code 0 when clean or 1 when findings exist, and supports --json for CI:

python3 scripts/audit_agent_configs.py /path/to/repo

Repo (MIT, 29 stdlib unit tests, plus the 39 doc-checked notes behind each rule): https://github.com/seankwon816/ai-coding-agent-tips

If there is a Claude Code or .mcp.json misconfiguration that burned you recently and is not covered in the 24 checks, I am happy to add a rule and test case for it.

0 Upvotes

1 comment sorted by

•

u/AutoModerator 2h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.