Purpose: Common issues and recovery paths when using Claude Code best practices
- CLAUDE.md Issues
- Pattern Overwhelm
- Team Adoption
- Setup Issues
- Hook Problems
- Performance Issues
- External Fetch Errors
Symptom: Started at 50 lines, now 120+ lines after several months
Cause: Adding context without removing, accumulating examples and edge cases
Fix:
-
Apply The Big 3 Audit (from FOUNDATIONAL-PRINCIPLES.md):
- "Would removing this cause mistakes? If not, cut it."
- Every line consumes context in every turn
-
Move examples to separate files:
.claude/ CLAUDE.md (~60 lines) docs/ api-examples.md deployment-guide.md testing-notes.mdReference in CLAUDE.md: "See docs/ for examples"
-
Delete sections Claude never asked about:
- Check your session history - what sections were actually referenced?
- If Claude didn't need it in 10+ sessions, it doesn't belong
-
Target structure (~20 lines core):
- Project purpose: 2 lines
- Commands: 5 lines (only non-standard ones)
- Known gotchas: 10 lines (things that caused 2+ mistakes)
- Current focus: 2 lines
Related: context-engineering.md
Symptom: Following 60-line rule but Claude lacks necessary context
Root causes to check:
-
Missing critical gotchas:
- Are there repeated mistakes? Add those specific gotchas
- Don't preemptively document - add after 2nd occurrence
-
Context should be elsewhere:
- API documentation → Separate docs/ file or inline code comments
- Architecture → ARCHITECTURE.md
- Current work → PLAN.md
- Testing procedures → Inline in test files
-
Commands aren't clear:
- Claude needs actual commands, not descriptions
- Bad: "Run tests - see package.json"
- Good: "
npm test- runs unit tests with coverage"
Principle: CLAUDE.md is for "what Claude needs to avoid mistakes", not comprehensive documentation.
Quick Start Path (3 patterns, 30 minutes reading):
- context-engineering.md - Foundation for everything
- spec-driven-development.md - The methodology (Specify→Plan→Tasks→Implement)
- project-infrastructure.md - Setup patterns (recommended + advanced)
Then choose by need:
- Solo developer working on features → long-running-agent.md
- Team lead setting standards → evidence-tiers.md
- Production/security focus → safety-and-sandboxing.md
- Need more guidance → See PATTERN-LEARNING-PATH.md
Principle: You don't need all 34 patterns. Start with 3, add as needed.
Essential (read first):
- FOUNDATIONAL-PRINCIPLES.md - The Big 3
- spec-driven-development.md - Core methodology
- context-engineering.md - Context over prompts
High-value for most projects:
- project-infrastructure.md - Setup approach
- long-running-agent.md - Multi-session work
- progressive-disclosure.md - Skill architecture
Specialized (use when needed):
- Everything else in patterns/ directory
Rule of thumb: If you haven't hit the problem a pattern solves, you don't need that pattern yet.
Common objections + responses:
Response: The recommended setup takes 15-30 minutes and includes:
- Stop hook (prevents lost work from uncommitted changes)
- CLAUDE.md (~60 lines of project context)
- SessionStart hook (shows git status)
- Permission rules (pre-approved commands)
If even this feels like too much, start with just the Stop hook (5 minutes):
- Add Stop hook to settings.json for uncommitted/unpushed warnings
- Add more when value is proven
Adoption path: Stop hook only → Full recommended setup after 1 week → Advanced features as needed
Response: Use patterns as reference, not mandate
- Patterns document what works - adapt to your context
- Cherry-pick: hooks without skills, CLAUDE.md without presets, etc.
- Framework Selection Guide helps choose orchestration approach
Key: Patterns are descriptive (what works), not prescriptive (what you must do)
Response: Use just the infrastructure without SDD:
- Hooks for quality gates (formatting, linting)
- CLAUDE.md for project context
- settings.json for permissions
- No planning methodology required
Separation: Infrastructure ≠ methodology. Use what helps.
Response: It's evidence-based, not arbitrary:
- Official Anthropic docs: "~60 lines recommended"
- Reason: Context rot - accuracy decreases with token count
- Every line in CLAUDE.md costs context in every turn
- Test it: Try 200-line CLAUDE.md vs 50-line. Measure mistake rate.
Compromise: Start with 100 lines if needed, audit monthly toward 60.
Approach:
-
Start with shared principles (not implementations):
- Share FOUNDATIONAL-PRINCIPLES.md first
- Discuss The Big 3 - get alignment on "why"
- Let implementations vary by project
-
Create team presets (optional):
- Fork presets/coding.md or presets/hybrid.md
- Customize for your stack/tools
- Teams share via internal repo or gist
-
Standardize hooks + permissions (high value):
- Common hooks: Stop (uncommitted warning), PostToolUse (formatting)
- Pre-approved permissions: test/build/lint commands
- These reduce friction without enforcing methodology
-
Let CLAUDE.md vary (it should):
- Every project is different
- CLAUDE.md should be project-specific, not template-driven
- Standardize the audit process, not the content
Template for team docs:
# Our Team's Claude Code Standards
## Required (All Projects)
- Recommended infrastructure (Stop hook, CLAUDE.md, SessionStart, permissions)
- Pre-approved permissions for `npm test`, `npm run build`
## Recommended
- CLAUDE.md under 80 lines (audit monthly)
- Use /plan for features >3 files
## Optional
- Skills (if helpful for your project)
- Presets (starting point, customize as needed)Symptom: External fetch of setup prompt returns 404 error
Common causes:
-
Wrong branch in URL:
- Check URL uses
masterbranch (notmain) - Correct:
...claude-code-project-best-practices/master/...
- Check URL uses
-
File moved or renamed:
- Check repository for current structure
- Prompts are in
prompts/directory
-
Network/GitHub issues:
- Try raw URL:
https://raw.githubusercontent.com/flying-coyote/claude-code-project-best-practices/master/prompts/MAKE-PROJECT-RECOMMENDATIONS.md - If GitHub is down, clone repo locally and use file:// path
- Try raw URL:
Workaround: Clone repository locally:
git clone https://github.com/flying-coyote/claude-code-project-best-practices.git
cd claude-code-project-best-practices
# Use local filesSymptom: Configured hooks in settings.json but they don't execute
Check list:
-
File location - Must be exactly
.claude/settings.json:your-project/ .claude/ settings.json ← here CLAUDE.md -
JSON syntax - Validate with
cat .claude/settings.json | jq .:- Common errors: trailing commas, unquoted keys, wrong brackets
- Use templates/settings.json.template as reference
-
Schema version - Use current schema:
{ "permissions": { ... }, "hooks": { ... } }NOT old schema:
{ "allowedTools": ... }(deprecated) -
Matcher syntax:
- Matchers use glob patterns
- Stop hook:
"matcher": ""(empty = always) - Specific tools:
"matcher": "Bash(git commit*)"or"matcher": "Write(**/*.ts)"
-
Claude Code version - Hooks require Claude Code v2.0+:
- Check version:
claude --version - Update if needed
- Check version:
Test hooks:
# Make uncommitted change
echo "test" >> README.md
# Stop session - should see warning
# (Ctrl+C or /exit in Claude Code)Symptom: Constantly prompted for permission despite pre-approving
Causes + fixes:
-
Pattern too narrow:
- Bad:
"Bash(npm test)"(only exact command) - Good:
"Bash(npm test*)"(includes flags/args) - Better:
"Bash(npm run test*)"(all test scripts)
- Bad:
-
Missing tool categories:
- Pre-approve common patterns:
"permissions": { "allow": [ "Bash(git status*)", "Bash(git diff*)", "Bash(git log*)", "Bash(npm run test*)", "Bash(npm run build*)", "Bash(npm run lint*)" ] }
-
Destructive operations (by design):
git push,rm -rf, file deletions → Always prompt- This is a security feature - don't override
- Pre-approve read operations, prompt for writes
Balance: Pre-approve frequent operations, keep prompts for destructive ones.
Symptom: Hook rejects operation you want to allow
Debug approach:
-
Check hook logs - See what matched:
- Hook output shows matcher that triggered
- Verify the hook is catching what you intended
-
Refine matcher:
- Too broad:
"matcher": "Bash(*)"→ blocks everything - Better:
"matcher": "Bash(rm*)"→ blocks only rm commands - Exceptions: Use multiple hooks with specific matchers
- Too broad:
-
Add escape hatch:
{ "matcher": "Bash(rm -rf*)", "hooks": [{ "type": "command", "command": "echo '⚠️ Destructive operation - confirm first (y/n):'; read confirm; [ \"$confirm\" = \"y\" ]" }] }This prompts instead of blocking outright.
Related: advanced-hooks.md
Symptom: Every tool call takes extra time due to hook execution
Optimization:
-
Make hooks fast:
- Bad:
npm run lint(runs full lint on every write) - Good:
npx eslint --fix "$FILE"(only file that changed)
- Bad:
-
Use targeted matchers:
- Bad:
"matcher": "Write(*)"→ runs on every file write - Good:
"matcher": "Write(**/*.{ts,tsx})"→ only TypeScript files
- Bad:
-
Async where possible:
- Formatting: sync (user expects formatted file)
- Linting: can be async background job
-
Consider removing hook:
- If faster to manually run
npm run formatafter session - PostToolUse hooks best for auto-fixable issues (format, import sort)
- If faster to manually run
Rule: Hooks should be <200ms. If slower, make async or remove.
Common causes:
-
MCP server latency - MCP adds 300-800ms per call:
- Fix: Use native tools where possible
- Read files: Native Read tool (fast) vs MCP file server (slow)
- See mcp-vs-skills-economics.md
-
Bloated CLAUDE.md - Large context = slower processing:
- Fix: Audit CLAUDE.md, target <60 lines
- Use progressive-disclosure.md for skills
-
Too many skills loaded:
- Fix: Skills consume context when loaded
- Remove unused skills from .claude/skills/
- Use multi-workflow pattern for large skills
-
Large file operations:
- Fix: Use pagination for large files
- Read specific line ranges instead of full file
Symptom: Claude says "I've run out of context" or quality degrades
Recovery:
-
One feature at a time (Principle #8):
- Stop, commit current work
- Start new session for next feature
- External artifacts (git, specs) bridge sessions
-
Externalize state:
- Move progress to PLAN.md or TODO.md
- Commit work-in-progress to branch
- New session can load state from files
-
Reduce context overhead:
- Audit CLAUDE.md (trim to essentials)
- Remove large skills not used this session
- Close unrelated files
Prevention: Use long-running-agent.md pattern
Symptom: External fetch returns 404 for pattern files
Checklist:
-
Verify branch name: Use
masternotmain- Correct:
.../master/patterns/...
- Correct:
-
Check file name case: Filenames are case-sensitive
- Correct:
spec-driven-development.md - Wrong:
Spec-Driven-Development.md
- Correct:
-
Use raw.githubusercontent.com for content:
- Correct:
https://raw.githubusercontent.com/flying-coyote/claude-code-project-best-practices/master/patterns/spec-driven-development.md - Wrong:
https://github.com/.../blob/master/...(HTML page, not raw)
- Correct:
-
Check repository status: Visit repo to confirm file exists
Alternative: Clone repo locally and use local paths (most reliable)
-
Search existing patterns - Problem might be documented:
- Use INDEX.md or grep through patterns/ directory
- Check PATTERN-LEARNING-PATH.md
-
Check FOUNDATIONAL-PRINCIPLES.md - Most issues trace to violating The Big 3
-
Review examples/ - See complete working implementations:
-
File an issue - If problem isn't covered:
- Repository: https://github.com/flying-coyote/claude-code-project-best-practices/issues
- Include: Symptom, what you tried, your setup
Last Updated: February 2026