⚡

精简直觉,释放 Claude 全力

OpenClaw Optimised · v1.0.1
入口已确认,内容待校验 文件树里有 SKILL.md,但正文还没采回,frontmatter 未核对。
专业技能 安全 S+ 级 作者 hexnickk 公开目录收录
4.6k 下载 9 安装 10.2k 收藏 27 浏览

简介

编写优化 CLAUDE.md 配置文件的权威指南,帮助开发者通过精简高价值规则最大化 Claude Code 的性能与指令遵循度。

原始描述

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.

通过你的 Agent 添加

安装目录:openclaw-optimised/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/openclaw-optimised/
Codex CLI~/.codex/skills/openclaw-optimised/
DeepSeek Harness~/.agents/skills/openclaw-optimised/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心功能

claude-optimised 是一个纯文档型 Skill,专注于指导开发者如何编写和优化 CLAUDE.md 文件,以最大化 Claude Code 的性能表现。其核心方法论是"Less Is More"——过长的配置文档会导致关键规则被忽略。

核心用法

该 Skill 适用于三种场景:

  1. 创建新的 CLAUDE.md 时作为结构参考
  2. 审查现有 CLAUDE.md 时进行优化建议
  3. 用户询问最佳实践 时提供权威指导

关键原则包括:

  • 每行配置必须回答"删除它会导致 Claude 犯错吗?"
  • 仅包含非标准信息(Claude 无法从代码中推断的)
  • 使用项目特定的命令、关键陷阱、领域术语
  • 明确排除 Claude 已知的通用编程实践

推荐的 CLAUDE.md 结构

# Project Name
一句话描述

## Commands
- 测试/构建/开发命令

## Code Style
- 仅非显而易见的约定

## Architecture
- 仅复杂架构简述

## IMPORTANT
- 关键警告(极少使用)

理想目标:50 行以内,示例文档仅 15 行。

显著优点

  1. 权威方法论:基于 Anthropic 官方推荐的 CLAUDE.md 实践,经过实际验证
  2. 极致精简:提供清晰的"包含/排除"决策框架,避免配置膨胀
  3. 具体可操作:包含格式规则、文件放置位置、优化检查清单
  4. 维护指导:提供定期审查策略和反模式警示
  5. 多层级支持:支持用户级、项目级、子目录级配置

潜在局限

  1. 需人工判断:"显而易见"vs"非显而易见"的界限需要开发者经验判断
  2. 项目特异性:建议高度依赖具体技术栈(Next.js、Supabase、Zustand 等示例),需要使用者自行替换
  3. 无自动化:纯指南性质,不提供自动格式化或验证工具
  4. 团队推广成本:需要团队成员统一理解"Less Is More"原则

适合人群

  • 使用 Claude Code 进行开发的工程师
  • 需要为团队建立统一 AI 辅助开发规范的 Tech Lead
  • 发现 Claude 频繁"忽略规则"而需要优化配置的用户
  • 追求高效 token 利用率的成本敏感团队

风险与注意事项

风险类型 说明
过度精简 删除真正必要的上下文,导致 Claude 理解偏差
版本漂移 项目演进后 CLAUDE.md 未及时更新
团队不一致 不同成员对"显而易见"定义不同
多文件冲突 ~/.claude/、./CLAUDE.md、.claude/rules/ 内容重复或矛盾

建议配合 /init 命令使用,并每几周审查一次配置有效性。

技能正文


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

# 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

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

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

claude-codeprompt-engineeringdeveloper-productivityconfigurationai-assisted-coding

同类 Skill