OpenClaw Optimised
by @hexnickk
Guide for writing and optimizing CLAUDE.md files for maximum Claude Code performance. Use when creating new CLAUDE.md, reviewing existing ones, or when user asks about CLAUDE.md best practices. Covers structure, content, pruning, and common mistakes.
clawhub install claude-optimisedπ About This Skill
name: claude-optimised description: Guide for writing and optimizing CLAUDE.md files for maximum Claude Code performance. Use when creating new CLAUDE.md, reviewing existing ones, or when user asks about CLAUDE.md best practices. Covers structure, content, pruning, and common mistakes.
CLAUDE.md Optimization Guide
Write CLAUDE.md files that maximize Claude's adherence and performance.
Core Principle: Less Is More
Long CLAUDE.md = Claude ignores half of it. Critical rules get lost in noise.
For each line ask: "Would removing this cause Claude to make mistakes?"
What to Include
Essential (High Value)
| Section | Example |
|---------|---------|
| Project context | "Next.js e-commerce app with Stripe" (1 line) |
| Build/test commands | npm run test, pnpm build |
| Critical gotchas | "Never modify auth.ts directly" |
| Non-obvious conventions | "Use vi for state, not useState" |
| Domain terminology | "PO = Purchase Order, not Product Owner" |
Include Only If Non-Standard
feature/, fix/)Do NOT Include
Structure
# Project NameOne-line description.
Commands
Test: npm test
Build: npm run build
Lint: npm run lint Code Style
[Only non-obvious conventions] Architecture
[Brief, only if complex] IMPORTANT
[Critical warnings - use sparingly]
Formatting Rules
File Placement
| Location | Scope |
|----------|-------|
| ~/.claude/CLAUDE.md | All sessions (user prefs) |
| ./CLAUDE.md | Project root (share via git) |
| ./subdir/CLAUDE.md | Loaded when working in subdir |
| .claude/rules/*.md | Auto-loaded as project memory |
Optimization Checklist
Before finalizing:
Maintenance
/init as starting point, then prune aggressivelyAnti-Patterns
| Don't | Why | |-------|-----| | 200+ line CLAUDE.md | Gets ignored | | "Write clean code" | Claude knows this | | Duplicate rules across files | Wastes tokens, conflicts | | Theoretical concerns | Only add for real problems | | Long prose explanations | Use bullet points |
Example: Minimal Effective CLAUDE.md
# MyAppReact Native app with Expo. Backend is Supabase.
Commands
pnpm test - run tests
pnpm ios - run iOS simulatorStyle
Prefer Zustand over Context
Use clsx for conditional classes IMPORTANT
NEVER commit .env files
Auth logic lives in src/lib/auth.ts only
~15 lines. Covers what Claude can't infer. Nothing more.