当前位置: 首页 > news >正文

2个高星CLAUDE.md范例,直接复制能用(Claude Code实用指南)

用Claude Code写代码,一个好用的CLAUDE.md文件能直接提效、保质量,这点不用多说。

网上讲写法的文章不少,但大多是纯方法论,说要简洁、少写多余指令,看再多不如直接看实战范例。

下面分享2个GitHub高星、有代表性的CLAUDE.md真实范例,一个适合个人用,一个适合团队用,可直接复制、改写,省去自己摸索的时间。

一、andrej-karpathy-skills(18.3K星)
该项目是作者基于AI界传奇人物Andrej Karpathy(曾担任特斯拉AI高级总监)的核心观点,总结出的利用LLM写代码的高频坑点,风格极简、纪律性极强,特别适合个人项目。

核心亮点:
极简严要求,完全贴合Karpathy的工程风格;

只写必守规则,没有一句废话;

明确禁止行为,精准规避LLM坑点;

适用场景:个人项目
CLAUDE.md原文(可直接复制使用):
CLAUDE.md
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.

Tradeoff: These guidelines bias toward caution over speed. For trivial tasks, use judgment.

  1. Think Before Coding
    Don't assume. Don't hide confusion. Surface tradeoffs.

Before implementing:

•State your assumptions explicitly. If uncertain, ask.
•If multiple interpretations exist, present them - don't pick silently.
•If a simpler approach exists, say so. Push back when warranted.
•If something is unclear, stop. Name what's confusing. Ask.

  1. Simplicity First
    Minimum code that solves the problem. Nothing speculative.

•No features beyond what was asked.
•No abstractions for single-use code.
•No "flexibility" or "configurability" that wasn't requested.
•No error handling for impossible scenarios.
•If you write 200 lines and it could be 50, rewrite it.

Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.

  1. Surgical Changes
    Touch only what you must. Clean up only your own mess.

When editing existing code:

•Don't "improve" adjacent code, comments, or formatting.
•Don't refactor things that aren't broken.
•Match existing style, even if you'd do it differently.
•If you notice unrelated dead code, mention it - don't delete it.

When your changes create orphans:

•Remove imports/variables/functions that YOUR changes made unused.
•Don't remove pre-existing dead code unless asked.

The test: Every changed line should trace directly to the user's request.

  1. Goal-Driven Execution
    Define success criteria. Loop until verified.

Transform tasks into verifiable goals:

•"Add validation" → "Write tests for invalid inputs, then make them pass"
•"Fix the bug" → "Write a test that reproduces it, then make it pass"
•"Refactor X" → "Ensure tests pass before and after"

For multi-step tasks, state a brief plan:

  1. [Step] → verify: [check]
  2. [Step] → verify: [check]
  3. [Step] → verify: [check]
    Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.

These guidelines are working if: fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.

二、Everything Claude Code(153K星)
该项目是来自Anthropic黑客马拉松获胜者的实战配置集合,项目是一整套可直接用于生产环境的系统,经过10个多月实战打磨,支持多AI智能体框架,适合团队/企业项目。

核心亮点:
企业级标准,全流程覆盖,可直接用于团队协作;

分模块清晰:包括测试、架构、关键指令、开发、技能多个模块;

可作为团队协作项目的手册,只需微调即可。

适用场景:团队/企业项目
CLAUDE.md原文(可根据项目情况修改后使用):
Cloud.md原文
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview
This is a Claude Code plugin - a collection of production-ready agents, skills, hooks, commands, rules, and MCP configurations. The project provides battle-tested workflows for software development using Claude Code.

Running Tests

*Run all tests node tests/run-all.js

*Run individual test files node
tests/lib/utils.test.js node
tests/lib/package-manager.test.js node
tests/hooks/hooks.test.js

Architecture
The project is organized into several core components:

•agents/ - Specialized subagents for delegation (planner, code-reviewer, tdd-guide, etc.)
•skills/ - Workflow definitions and domain knowledge (coding standards, patterns, testing)
•commands/ - Slash commands invoked by users (/tdd, /plan, /e2e, etc.)
•hooks/ - Trigger-based automations (session persistence, pre/post-tool hooks)
•rules/ - Always-follow guidelines (security, coding style, testing requirements)
•mcp-configs/ - MCP server configurations for external integrations
•scripts/ - Cross-platform Node.js utilities for hooks and setup
•tests/ - Test suite for scripts and utilities

Key Commands
•/tdd - Test-driven development workflow
•/plan - Implementation planning
•/e2e - Generate and run E2E tests
•/code-review - Quality review
•/build-fix - Fix build errors
•/learn - Extract patterns from sessions
•/skill-create - Generate skills from git history
Development Notes
•Package manager detection: npm, pnpm, yarn, bun (configurable via CLAUDE_PACKAGE_MANAGER env var or project config)
•Cross-platform: Windows, macOS, Linux support via Node.js scripts
•Agent format: Markdown with YAML frontmatter (name, description, tools, model)
•Skill format: Markdown with clear sections for when to use, how it works, examples
•Skill placement: Curated in skills/; generated/imported under ~/.claude/skills/. See docs/SKILL-PLACEMENT-POLICY.md
•Hook format: JSON with matcher conditions and command/notification hooks
Contributing
Follow the formats in CONTRIBUTING.md:
•Agents: Markdown with frontmatter (name, description, tools, model)
•Skills: Clear sections (When to Use, How It Works, Examples)
•Commands: Markdown with description frontmatter
•Hooks: JSON with matcher and hooks array File naming: lowercase with hyphens (e.g., python-reviewer.md, tdd-workflow.md)
Skills
Use the following skills when working on related files:
File(s) |Skill
README.md |readme
.github/workflows/*.yml | ci-workflow
When spawning subagents, always pass conventions from the respective skill into the agent's prompt.

最后补充一句:个人用选第一个,极简高效避坑;团队用选第二个,规范全面可直接落地。复制过去根据自己的项目微调,比自己从零写省心太多。

http://www.jsqmd.com/news/647209/

相关文章:

  • 十年信任崩塌:Backblaze为何悄悄停止备份你的云端数据?
  • CSS如何使得下拉选择框不受外层容器的overflow裁剪_只能将下拉框放在body下并使用JS结合绝对定位计算位置
  • 伯明翰大学发布诗歌生成新标准:AI能否成为下一个莎士比亚?
  • Linux 性能分析:CPU/内存/IO/网络,一套工具全搞定
  • LPC1114 PWM呼吸灯进阶:如何用MR3寄存器精准控制频率与平滑度?
  • 终极ComfyUI-Crystools完全指南:20+强大工具节点提升AI绘画工作流效率
  • 利用ArcGIS实现SHP文件边界坐标批量导出为TXT格式
  • 2026广州注册公司代办机构实测测评|4家靠谱机构对比,避坑指南+首选推荐 - 企业推荐官【官方】
  • Windows乱码终结者:3步学会用Locale Emulator运行多语言软件
  • [Tools] Laragon 本地集成开发环境
  • 6.2 组合优化:考虑换手、成本、约束下的均值-方差优化
  • 2026年想找专业长沙美缝施工团队?哪家才是你的最佳之选? - 企业推荐官【官方】
  • 在Ubuntu 22.04上,用Python3和pysoem库搞定EtherCAT电机回零与位置控制的保姆级避坑指南
  • 对齐不准、融合失焦、推理崩塌?多模态大模型上线前必须完成的7项融合健康检查,漏一项即致A/B测试失败
  • 联易融5000亿之后:供应链金融科技龙头如何讲AI出海新故事
  • 别再只盯着CNN了!用PyTorch Geometric从零搭建GCN,实战Cora文献分类(附完整代码)
  • c语言
  • Credo同意收购DustPhotonics,加快进军硅光子领域,推动下一代光互连业务拓展
  • virt基础-bar模拟调用流程
  • MySQL 查询:按2017年平均成绩降序列出所有学生姓名及均分
  • 全文降AI的好处你知道吗?这3款工具帮你省时省力
  • Halcon点云降噪实战:用`get_object_model_3d_params`和`select_points_object_model_3d`搞定稀疏离群点
  • Claude Code Routines:如何让AI编程助手实现全自动工作流?
  • PHP怎么使用外键映射模式_PHP关联关系处理方法【指南】
  • 从原理到实战:用Qt和C++手搓一个带容错的二维码生成器
  • static静态变量
  • 大麦网自动抢票脚本技术解决方案:告别手动抢票的低效率困境
  • Linux服务器宝塔面板故障排查:SSH可连接但面板无法访问的解决方案
  • 从Nucleo到BluePill:一份超详细的STM32F103 BSP移植实战记录(附避坑点)
  • 树莓派+SocketCAN实战:手把手教你用CanFestival控制伺服电机(保姆级避坑指南)