Rules & Configuration Patterns
Claude Code rules, settings, and configuration patterns from building a production environment. Every entry has a date and context.
2026-03: Path-Specific Rules Auto-Load by File Type
Problem: Different file types need different rules — AsciiDoc needs attribute enforcement, Bash needs safety patterns, Lua needs Neovim conventions. Can’t put all rules in CLAUDE.md.
Context: Editing across .adoc, .sh, .lua, .py, .d2 files in 15+ repos.
The Fix:
~/.claude/rules/
├── asciidoc.md # *.adoc, **/docs/**
├── bash-shell.md # *.sh, *.bash, *.zsh, **/bin/*
├── lua-nvim.md # **/nvim/**/*.lua
├── python.md # *.py, **/pyproject.toml
└── d2-diagrams.md # *.d2
Rule: Rules auto-load when you edit a matching file. No manual activation needed. One rule per file type. Keep rules focused and non-overlapping.
2026-03: Permission Model — 107 Allow, 10 Deny
Problem: Claude Code needs access to many tools but should be blocked from secrets, destructive commands, and injection vectors.
Context: dots-quantum settings.json, portable across machines.
The Pattern:
Allow (107 entries):
- All git operations
- Standard Unix tools (ls, find, grep, awk, sed, jq, etc.)
- Build tools (make, npm, cargo)
- Network tools (curl, gh, ssh, dig)
Deny (10 entries):
- .env*, ~/.secrets/*, ~/.age/* (file access)
- age -d:* (decrypt prevention)
- gopass show:* (password store)
- rm -rf /:*, rm -rf ~:*, rm -rf /*:* (destructive)
- bash -c:* (injection vector)
Rule: Allow is additive (list what’s permitted). Deny is protective (list what’s forbidden). Deny always wins over allow. Block injection vectors (bash -c) even if bash is allowed.
2026-03: Output Style — Professional, No Sycophancy
Problem: Default Claude responses include filler phrases ("Great question!"), trailing summaries, and diplomatic hedging.
Context: Senior engineer workflow, paying for education not hand-holding.
The Fix:
# output-styles/professional.md
- No sycophantic openers
- No filler or hedging
- No trailing summaries
- Challenge incorrect assumptions directly
- Verify independently, don't reflexively agree
- Show command first, explain WHY it works
- Suggest harder variation for practice
Rule: Output styles shape EVERY response. Define one that matches how you actually want to work. This is the highest-leverage configuration — it affects every interaction.
2026-03: Stow-Based Global Distribution
Problem: Claude Code configuration needs to be identical across machines (Razer, P16g, future workstations).
Context: dots-quantum stow package, multi-machine deployment.
The Fix:
# In dots-quantum repo:
# claude/.claude/settings.json
# claude/.claude/rules/*.md
# claude/.claude/agents/*.md
# claude/.claude/skills/*.md
# claude/.claude/hooks/*.sh
# claude/.claude/output-styles/*.md
# Deploy to any machine:
stow -t ~ claude
# Result: ~/.claude/ symlinked from dots-quantum
# Changes to config = changes to git repo
# Push dots-quantum → all machines get updated
Rule: Claude Code config IS code. Stow it. Version it. Deploy it. Every machine gets the same environment. Config drift = bug.