home / skills / aaaaqwq / agi-super-skills / claude-optimised

claude-optimised skill

/skills/misc/claude-optimised

This skill helps you craft concise CLAUDE.md files to maximize Claude performance by pruning nonessential rules and emphasizing core guidelines.

This is most likely a fork of the claude-optimised skill from openclaw
npx playbooks add skill aaaaqwq/agi-super-skills --skill claude-optimised

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.5 KB
---
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?"
- If no → delete it
- If Claude already does it correctly → delete it or convert to hook

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

- 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

```markdown
# 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

| 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:
- [ ] 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'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

```markdown
# 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.

Overview

This skill guides writing and optimizing CLAUDE.md files to maximize Claude’s adherence and code-assistant performance. It focuses on concise, high-value instructions that fix real issues and avoid instruction overload. Use the guide to create, review, or prune project CLAUDE.md files for clearer, more reliable agent behavior.

How this skill works

The skill inspects a CLAUDE.md file for verbosity, redundancy, and items Claude already infers, then recommends pruning or restructuring. It highlights essential lines to keep (project context, build/test commands, critical gotchas, non-obvious conventions, domain terms) and flags content to remove. It also recommends placement and minimal structure to ensure rules load in the right scope and maintain impact.

When to use it

  • When creating a new CLAUDE.md for a repository to set project-specific rules
  • When reviewing an existing CLAUDE.md that’s long or ineffective
  • After observing Claude ignore rules or behave unexpectedly
  • During periodic maintenance to prune stale or redundant instructions
  • Before sharing a repo so CLAUDE.md stays under ~50 lines and high-value

Best practices

  • Keep the file terse: aim for under 50 lines and ~15 lines if possible
  • Include only things Claude can’t infer: project context, commands, critical gotchas
  • Use bullet points, clear headings, and short lines to avoid instruction bleed
  • Mark only truly critical items with IMPORTANT/ YOU MUST so they retain weight
  • Avoid general coding advice or long prose; add rules only for real problems encountered
  • Place files by scope: user prefs (~/.claude/), project root (./CLAUDE.md), or subdir as needed

Example use cases

  • Create a minimal CLAUDE.md for a Next.js e-commerce app with Stripe, listing test/build commands and auth gotchas
  • Trim a 200+ line file down to the essential 15–50 lines to restore Claude’s compliance
  • Add a single critical rule after pinpointing a reproducible misbehavior (e.g., never modify auth.ts)
  • Move global preferences to the user-level file and keep project-specific rules in the repo root
  • Run an /init review and iterate: remove lines that don’t change Claude’s behavior

FAQ

How do I know if a line is necessary?

Ask whether removing it would cause Claude to make mistakes; if not, delete it or convert it to a hook.

What should I never include?

Avoid general practices Claude already knows, long explanations, aspirational rules, and duplicate rules across files.