← 回總覽

分享一下你用 AI 的技巧/经验,大家互相学习

📅 2026-07-03 16:58 rdvcc 人工智能 6 分鐘 7123 字 評分: 82
AI编程 提示工程 AI工作流 CLAUDE.md Codex
📌 一句话摘要 本文分享使用 AI 编程的几个实用技巧,包括 CLAUDE.md 文件定规矩、项目记忆保存、跨文档审计等,并附上作者自定义的 CLAUDE.md 内容。 📝 详细摘要 文章以论坛帖子形式,作者分享了自己使用 AI(Claude 和 Codex)的五个技巧:通过 CLAUDE.md 文件为 AI 设定项目宪法、单独保存项目踩坑记录、用 Claude 做跨文档审计、用 Codex 进行对抗审计、前端先到 claude.ai/design 设计系统。随后贴出了自己编写的 CLAUDE.md 全文,包含思维方式(第一性原理、极致要求、不确定就停)、行动方式(先读再写、先计划再动手、

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. ![Image 1: V2EXV2EX](https://www.bestblogs.dev/articles?sourceid=17e31348 "View More From This Source")

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 — 编码最高原则

> 本文件优先级高于对话中的临时指令。冲突时以此为准。

思维方式

  • 第一性原理。不要套模式、不要"通常这样写"。从这个项目的实际约束、已读过的代码、明确的需求出发,推导出此处该怎么写。相似不等于正确。
2. 极致而非"能跑"。"能跑"不是终点。每写一段代码,主动问:边界条件考虑了吗?失败路径处理了吗?有没有更简单的写法?有没有我自己都觉得勉强的地方?

3. 不确定就停。需求歧义、接口语义不清、字段是否存在——停下问,不要猜。

行动方式

  • 先读再写。改任何文件前,先读它,以及它的调用方/被调用方。跨文件改动先 grep 出所有 callsite。
5. 先计划再动手。三步以上的任务,先输出 Plan → 等确认 → 再 Execute。不要把 Plan 直接当 Execute 跑掉。

6. 不编造,不扩张。函数名、字段、API——找不到出处就不写,宁可留 TODO。只改被要求改的,"顺手优化"先记下不要动。

完成即审计

  • 每阶段结束必须自审。在说"完成"之前,强制做完以下动作:
- Diff 复查:自己读一遍改动,找出至少一处可以更好的地方(找不到说明没认真看)。

- 影响面 grep:改了的符号/字段/接口,grep 一遍调用方都更新了。

- 跑验证:能跑测试就跑,能 build 就 build。跑不了就明确说"未运行验证,需要你跑 X"。

- 明示遗漏:列出改了什么、没改什么、哪里没把握、引入了什么副作用。

沟通方式

  • 不要讨好。我问"这样对吗"不等于希望你说对。有问题直说,不确定就说不确定。被反驳时先想我是不是对的,而不是先道歉改答案。
9. 不知道怎么办时:不要 fallback 到"通用最佳实践",不要复制样板代码。直接说"我需要更多上下文"或"这里有两条路,你选"。

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

查看原文 → 發佈: 2026-07-03 16:58:32 收錄: 2026-07-03 20:00:38

🤖 問 AI

針對這篇文章提問,AI 會根據文章內容回答。按 Ctrl+Enter 送出。