vibe-coding
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVibe coding methodology
Vibe coding 方法论
Practical strategies for building software effectively with AI coding assistants.
借助AI代码助手高效开发软件的实用策略。
Planning process
规划流程
Start by working with the AI to write a detailed implementation plan in a markdown file.
Scope management: Review and refine the plan—delete unnecessary items, mark complex features as "won't do," and keep a separate section for ideas to implement later. This prevents scope creep and maintains focus.
Incremental implementation: Work section by section rather than building everything at once. Have the AI mark sections complete after successful implementation, and commit each working section to git before moving to the next.
Track progress visibly: Use todo lists, markdown checklists, or inline status markers so both you and the AI can see what's done and what remains. This prevents re-implementing completed work and keeps sessions focused.
首先与AI协作,在Markdown文件中编写详细的实现规划。
范围管理:审核并优化规划——删除不必要的内容,将复杂功能标记为“暂不实现”,并单独设立板块记录后续待实现的想法。这能防止范围蔓延,保持开发焦点。
增量式实现:分模块逐步开发,而非一次性完成所有内容。在成功实现某个模块后,让AI标记该模块为已完成,并在进入下一个模块前,将可运行的模块提交至Git。
可视化进度追踪:使用待办事项列表、Markdown复选框或内联状态标记,让你和AI都能清晰看到已完成和待完成的工作。这避免重复开发已完成内容,保持会话聚焦。
Version control strategies
版本控制策略
Git is your safety net—don't rely solely on the AI tool's revert functionality.
Clean slate principle: Begin each new feature with a clean git state. When stuck, use if the AI goes down an unproductive path. Multiple failed attempts create layers of bad code that compound problems.
git reset --hard HEADClean implementation: When you finally find a working solution after several attempts, reset to a clean state and implement it fresh. Multiple failed attempts create layers and layers of bad code—don't keep the accumulated mess. A clean re-implementation of a known-good solution is faster and more maintainable than untangling spaghetti.
Git是你的安全保障——不要仅依赖AI工具的撤销功能。
干净状态原则:开发每个新功能前,确保Git处于干净状态。当陷入困境时,如果AI走向了无效方向,使用重置。多次失败尝试会产生大量冗余代码,加剧问题复杂度。
git reset --hard HEAD干净实现:在多次尝试后找到可行方案时,重置到干净状态,重新实现该方案。多次失败尝试会堆积大量糟糕代码——不要保留这些混乱。重新干净实现已验证的可行方案,比梳理混乱代码更快捷、更易维护。
Testing framework
测试框架
Prioritize end-to-end integration tests over unit tests. Focus on simulating user behavior—testing features by simulating someone clicking through the site or app.
Regression prevention: LLMs often make unnecessary changes to unrelated logic. Tests catch these regressions before they compound.
Tests as guardrails: Consider starting with test cases to provide clear boundaries for what the AI should and shouldn't change. Ensure tests pass before moving to the next feature.
优先选择端到端集成测试而非单元测试。重点模拟用户行为——通过模拟用户点击网站或应用的方式测试功能。
回归问题预防:大语言模型(LLM)常对无关逻辑进行不必要的修改。测试能在问题恶化前发现这些回归问题。
测试作为防护机制:可以考虑先编写测试用例,为AI设定清晰的修改边界。确保测试通过后再进入下一个功能的开发。
Effective bug fixing
高效调试方法
Error messages: Simply copy-pasting error messages is often enough context for the AI to identify and fix issues.
Analyze before coding: Ask the AI to consider multiple possible causes before jumping to implementation. This prevents chasing the wrong problem.
Reset after failures: Start with a clean slate after each unsuccessful fix attempt rather than layering fixes on top of broken code.
Strategic logging: Add logging statements to better understand what's happening when bugs are opaque.
Switch models: Try different AI models when one gets stuck on a problem.
错误信息:直接复制粘贴错误信息,通常就为AI提供了足够的上下文来识别并修复问题。
先分析再编码:在开始编码前,让AI考虑多种可能的原因。这避免陷入错误的问题方向。
失败后重置:每次修复尝试失败后,回到干净状态,而非在错误代码上叠加修复。
策略性日志:添加日志语句,以便在问题不明确时更好地了解运行情况。
切换模型:当某个AI模型卡在问题上时,尝试使用其他模型。
AI tool optimization
AI工具优化
Instruction files: Write detailed instructions for your AI in appropriate files (cursor.rules, windsurf.rules, claude.md). These provide project-specific context that improves output quality.
Local documentation: Download API documentation to your project folder. AI tools work more accurately with local docs than trying to recall API details from training.
Multiple tools: Some developers run both Cursor and Windsurf simultaneously on the same project. Cursor tends to be faster for frontend work while Windsurf thinks longer on complex problems.
Compare outputs: Generate multiple solutions and pick the best one rather than accepting the first output.
指令文件:在合适的文件(如cursor.rules、windsurf.rules、claude.md)中为AI编写详细指令。这些文件提供项目特定上下文,能提升输出质量。
本地文档:将API文档下载到项目文件夹中。AI工具使用本地文档比依赖训练数据中的API细节更准确。
多工具协同:部分开发者会在同一项目中同时使用Cursor和Windsurf。Cursor在前端开发中速度更快,而Windsurf在处理复杂问题时思考更深入。
多方案对比:生成多个解决方案并选择最优方案,而非直接接受第一个输出结果。
Complex feature development
复杂功能开发
Standalone prototypes: Build complex features in a clean codebase first, then integrate once working. This isolates problems and makes debugging easier.
Reference implementations: Point the AI to working examples to follow. Existing code patterns provide concrete guidance.
Clear boundaries: Maintain consistent external APIs while allowing internal changes. Service-based architectures with clear boundaries work better than monorepos for AI-assisted development.
独立原型:先在干净的代码库中开发复杂功能,待功能正常运行后再进行集成。这能隔离问题,简化调试。
参考实现:为AI提供可参考的可行示例。现有代码模式能提供具体的指导。
清晰边界:在允许内部修改的同时,保持一致的外部API。具有清晰边界的服务架构比单体仓库更适合AI辅助开发。
Tech stack considerations
技术栈考量
Established frameworks: Ruby on Rails and similar mature frameworks work well due to 20+ years of consistent conventions in training data.
Training data matters: Newer languages like Rust or Elixir may have less training data, leading to more errors or outdated patterns.
Modularity: Small, modular files are easier for both humans and AIs to work with. Avoid files with thousands of lines—they exceed context windows and create confusion.
成熟框架:Ruby on Rails等成熟框架表现出色,因为其在训练数据中拥有20多年的一致约定。
训练数据影响:Rust或Elixir等较新的语言可能训练数据较少,导致更多错误或使用过时模式。
模块化:小巧、模块化的文件对人类和AI都更易处理。避免使用数千行的文件——它们会超出上下文窗口,造成混淆。
Beyond coding
编码之外的应用
AI assistants help with more than writing code:
- DevOps: Configuring servers, DNS, and hosting
- Design: Generating favicons and other design elements
- Documentation: Drafting docs and marketing materials
- Education: Explaining implementations line by line
- Visual input: Share screenshots for UI bugs or design inspiration
- Voice input: Tools like Aqua enable 140 words per minute input
AI助手的作用不止于编写代码:
- DevOps:配置服务器、DNS和托管服务
- 设计:生成图标等设计元素
- 文档:撰写文档和营销材料
- 教育:逐行解释实现逻辑
- 视觉输入:分享截图以排查UI问题或获取设计灵感
- 语音输入:Aqua等工具支持每分钟140词的语音输入
Continuous improvement
持续改进
Regular refactoring: Once tests are in place, refactor frequently. Ask the AI to identify refactoring candidates.
Stay current: Try every new model release. Different models excel at different tasks—experiment to find which works best for your use case.
定期重构:在测试到位后,频繁进行重构。让AI识别需要重构的代码。
保持更新:尝试每个新发布的模型。不同模型擅长不同任务——通过实验找到最适合你使用场景的模型。