Get the FREE Ultimate OpenClaw Setup Guide →
h

OpenClaw Optimised

Verified

@hexnickk

npx machina-cli add skill @hexnickk/claude-optimised --openclaw
Files (1)
SKILL.md
3.5 KB

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?"

  • If no → delete it
  • If Claude already does it correctly → delete it or convert to hook

What to Include

Essential (High Value)

SectionExample
Project context"Next.js e-commerce app with Stripe" (1 line)
Build/test commandsnpm 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

  • Branch naming (if not feature/, fix/)
  • Commit format (if not conventional commits)
  • File boundaries (sensitive files to avoid)

Do NOT Include

  • Things Claude already knows (general coding practices)
  • Obvious patterns (detectable from existing code)
  • Lengthy explanations (be terse)
  • Aspirational rules (only real problems you've hit)

Structure

# Project Name

One-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

  • Bullet points over paragraphs
  • Markdown headings to separate modules (prevents instruction bleed)
  • Specific over vague: "2-space indent" not "format properly"
  • IMPORTANT/YOU MUST for critical rules (use sparingly or loses effect)

File Placement

LocationScope
~/.claude/CLAUDE.mdAll sessions (user prefs)
./CLAUDE.mdProject root (share via git)
./subdir/CLAUDE.mdLoaded when working in subdir
.claude/rules/*.mdAuto-loaded as project memory

Optimization Checklist

Before finalizing:

  • Under 50 lines? (ideal target)
  • Every line solves a real problem you've encountered?
  • No redundancy with other CLAUDE.md locations?
  • No instructions Claude follows by default?
  • Tested by observing if Claude's behavior changes?

Maintenance

  • Run /init as starting point, then prune aggressively
  • Every few weeks: "Review this CLAUDE.md and suggest removals"
  • When Claude misbehaves: add specific rule
  • When Claude ignores rules: file too long, prune other content

Anti-Patterns

Don'tWhy
200+ line CLAUDE.mdGets ignored
"Write clean code"Claude knows this
Duplicate rules across filesWastes tokens, conflicts
Theoretical concernsOnly add for real problems
Long prose explanationsUse bullet points

Example: Minimal Effective CLAUDE.md

# MyApp

React Native app with Expo. Backend is Supabase.

## Commands
- `pnpm test` - run tests
- `pnpm ios` - run iOS simulator

## Style
- 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.

Source

git clone https://clawhub.ai/hexnickk/claude-optimisedView on GitHub

Overview

OpenClaw Optimised provides a practical guide for crafting CLAUDE.md files to maximize Claude Code performance and adherence. It emphasizes pruning, structure, and avoiding redundancy, and offers a structured template, checklists, and maintenance guidance.

How This Skill Works

It starts from the core principle that less is more, pruning lines that do not prevent mistakes. For each line, ask if removing it would cause Claude to err; if not, delete it. Then it enforces a structured, bullet-driven format with Markdown headings and an IMPORTANT section for critical warnings, plus a maintenance routine to prune over time.

When to Use It

  • Creating a new CLAUDE.md for a project
  • Reviewing or pruning an existing CLAUDE.md
  • Asking for CLAUDE.md best practices (guidance)
  • Optimizing CLAUDE.md to improve Claude Code performance
  • Maintaining CLAUDE.md and addressing Claude misbehavior or outdated rules

Quick Start

  1. Step 1: Create CLAUDE.md at the project root or relevant subdir
  2. Step 2: Include essential sections (Project context, Commands, Code Style, Architecture, IMPORTANT) and prune aggressively
  3. Step 3: Review periodically and run the maintenance checklist to prune further

Best Practices

  • Prioritize essential high-value sections like context, commands, and critical gotchas
  • Keep CLAUDE.md under about 50 lines whenever possible
  • Use bullet points and Markdown headings instead of long prose
  • Place critical warnings in an IMPORTANT section and use sparingly
  • Avoid duplicating rules across files and minimize nonstandard or nonessential content

Example Use Cases

  • Minimal Effective CLAUDE.md example with a project header, a Commands section, a concise Style section, and an IMPORTANT note
  • A Next.js e commerce CLAUDE.md sample including project context and typical commands
  • Example showing a Commands block with run/test/build commands
  • A Style note recommending a non-obvious convention such as Zustand over Context
  • An IMPORTANT rule like never commit environment files and centralize auth logic

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers