Vibe Coding 方法论
先计划再实施,先思考再动手。
核心原则
对于 Vibe Coding 的方法论,最重要的是先计划再实施,先思考再动手。这不仅是对模型的要求,也是对使用者的要求。
核心原则
- 简单任务:现在的 Agentic Coding Tools 能够很好地理解自然语言背后的意思,它甚至能够帮你完善一些不曾想过的逻辑漏洞或方法缺陷。
- 大型项目:因为模型上下文的限制,它可能不能记住太多本该需要记住的内容,因此会因为幻觉问题导致错上加错——为了修复一些问题而引入更多的问题。
关键实践
分步骤编码:一小块功能一小块功能地进行实现,如果需要最后对接,再让它单独处理对接的问题。不要寄希望于它能够完全基于自然语言理解和遵循你的想法和预期。
善用 .claude.md:
- 一方面能够将大模型的记忆 offload 到本地磁盘,而不过分占用它的上下文空间
- 另一方面,用户可以在其中以规范化表达的方式对模型进行持续的提示和约束,以增强模型表现的一致性
.claude.md 模板参考
以下是一个推荐的 Claude Code 初始化提示模板,大家可以在此基础上进行修改和适配:
Analyze this codebase and create a CLAUDE.md file following these principles:
1. Keep it under 150 lines total - focus only on universally applicable information
2. Cover the essentials: WHAT (tech stack, project structure), WHY (purpose),
and HOW (build/test commands)
3. Use Progressive Disclosure: instead of including all instructions, create a
brief index pointing to other markdown files in .claude/docs/ for specialized topics
4. Include file:line references instead of code snippets
5. Assume I'll use linters for code style - don't include formatting guidelines
Structure it as: project overview, tech stack, key directories/their purposes,
essential build/test commands, and a list of additional documentation files
Claude should check when relevant.
Additionally, extract patterns you observe into separate files:
- .claude/docs/architectural_patterns.md - document the architectural patterns,
design decisions, and conventions used (e.g., dependency injection, state management,
API design patterns). Make sure these are patterns that appear in multiple files.