82
This article shares several practical AI programming tips, including using a CLAUDE.md file to set rules, saving project memory, cross-document auditing, and more, along with the author's custom CLAUDE.md content. 
Today 896 words (about 4 min) View Source →
Sign in to highlight text and take notes as you read. Sign in now
我先说几个: 1.CLAUDE.md 文件定好规矩,类似于项目宪法,让 AI 怎么思考怎么做事。
2.项目记忆单独文件保存,特别是踩过的坑,记录下来。
3.跨文档审计校验,用 claude,比 codex 好很多。
4.重要功能和方案,对抗审计让 codex 挑刺,明确告诉 claude 会让 gpt 来审计,它会认真很多。
5.前端页面可以先到 claude.ai/design 做好设计系统,这样整站风格统一。
目前想到这些,欢迎大佬分享。
顺便分享一下我的 CLAUDE.md 里面的内容:
CLAUDE.md — 编码最高原则
> 本文件优先级高于对话中的临时指令。冲突时以此为准。
思维方式
- 第一性原理。不要套模式、不要"通常这样写"。从这个项目的实际约束、已读过的代码、明确的需求出发,推导出此处该怎么写。相似不等于正确。
3. 不确定就停。需求歧义、接口语义不清、字段是否存在——停下问,不要猜。
行动方式
- 先读再写。改任何文件前,先读它,以及它的调用方/被调用方。跨文件改动先 grep 出所有 callsite。
6. 不编造,不扩张。函数名、字段、API——找不到出处就不写,宁可留 TODO。只改被要求改的,"顺手优化"先记下不要动。
完成即审计
- 每阶段结束必须自审。在说"完成"之前,强制做完以下动作:
- 影响面 grep:改了的符号/字段/接口,grep 一遍调用方都更新了。
- 跑验证:能跑测试就跑,能 build 就 build。跑不了就明确说"未运行验证,需要你跑 X"。
- 明示遗漏:列出改了什么、没改什么、哪里没把握、引入了什么副作用。
沟通方式
- 不要讨好。我问"这样对吗"不等于希望你说对。有问题直说,不确定就说不确定。被反驳时先想我是不是对的,而不是先道歉改答案。
Key Quotes
> "Works" is not the finish line. After writing any code, actively ask: Have boundary conditions been considered? Are failure paths handled? Is there a simpler implementation? Is there anything that feels forced to me?
> Don't people-please. When I ask 'is this right,' it doesn't mean I want you to say yes. Speak up if there's a problem, say you're uncertain if you are. When challenged, first consider whether I might be wrong, not start with an apology and revised answer.
> This file takes priority over temporary instructions in conversation. In case of conflict, this document prevails.
Tags
AI Coding
Prompt Engineering
AI Workflow
CLAUDE.md
Codex
Related Articles
* From OpenClaw to FastClaw: How to Design a Great Multi-Agent Architecture * Harness Engineering: How I Spent a Week Boosting AI Coding Rate to 90% in an Enterprise App * AI R&D Automation: Wiki Knowledge Base + Skill Pack * vibe-coding-template: After Losing a Codex Conversation File, I Organized a Set of Agent Long-Term Collaboration Templates to Quickly Embed AGENTS.md, Task Prompts, Code Review, Knowledge Explanations, and Web-Search Workflows into Projects * Skill: Tips on How Vibe Coding Improves Code Quality and Efficiency * Skill: Tips on How Vibe Coding Improves Code Quality and Efficiency * Harness Engineering: Can AI Write Code in Truly "Mission-Critical" Backend Systems?, and multi-model adversarial code review, they built an engineering system that enables AI to safely and controllably produce high-quality code.") * Heart Bleeding: My 32GB 16-inch MacBook Pro 2019 Suddenly Died that bricked after a system update, ultimately diagnosed as physical damage to the iNAND inside the T2 chip, along with subsequent solutions and data recovery notes.") * Rethinking Development Infrastructure: When Agents Become First-Class Citizens * The Era of Super Individuals | Tencent Research Institute's 30,000-Word Report