第10章 Vibe Coding — 用自然语言构建AI产品
你可能会想:我不懂代码,怎么做AI产品?
2026年的答案是:你不需要懂代码。
Vibe Coding是一种新的开发方式:你用自然语言告诉AI你想要什么,AI帮你写代码。你看一眼,觉得差不多,就接受了。如果哪里不对,你说一句,AI改。
整个过程中,你可能一行代码都没写。你在”vibe”——凭感觉指挥AI干活。
10.1 从一个真实的故事说起
我会用自然语言提速,但关键路径仍要人工过一遍。
一个产品经理,完全不会编程。他想做一个个人知识库——能存笔记、能搜索、能问答。
他打开Claude Code,用中文描述:“我要做一个桌面应用,用Tauri框架,前端用原生JS,Python做后端。功能是知识库管理、搜索、RAG流水线。”
Claude Code生成了项目结构和基础代码。他运行了一下,能跑。然后逐步添加功能——知识库管理、搜索、RAG流水线、向量数据库。每个功能都是用自然语言描述,AI实现。
最终,这个项目有28000行代码,109次提交。他一行代码都没写。
这就是Vibe Coding。
10.2 工作原理
第一步:表达意图
你用自然语言描述需求。可以很模糊:“做一个博客网站”。也可以很具体:“用Next.js做一个博客,支持Markdown,有标签分类,首页展示最新5篇文章”。
AI会根据你的描述生成代码。描述越具体,生成的代码越接近你想要的。
第二步:AI生成代码
AI分析你的需求,选择技术栈,设计架构,写代码。
它不只是翻译你的文字——它会做设计决策。你没说用什么数据库,它会根据场景选择。你没说用什么UI框架,它会根据需求推荐。
Vibe Coding 实战:启动Claude Code后,用自然语言描述需求(如”帮我创建一个FastAPI后端服务,包含用户注册/登录、文章CRUD接口”)。AI会自动创建项目结构、生成代码文件,并运行测试确保能启动。
第三步:迭代修改
你看代码运行的结果,不满意就告诉AI怎么改。
“登录按钮太小了,放大一点。""搜索功能太慢了,优化一下。""这个页面的布局改成左右分栏。”
AI理解你的反馈,修改代码。你再看,再反馈。几轮下来,产品就成型了。
迭代示例:AI分析性能问题后,可能会添加数据库索引、实现缓存、添加分页、优化查询语句。
10.3 2026年的工具选型
Cursor AI
基于VS Code的AI编程IDE。
2026年的Agent Mode:Cursor的Agent Mode可以自主完成多文件编辑、运行终端命令、自我修复错误。你描述一个功能,它自己写代码、自己测试、自己修bug。
Background Agents(2025末/2026初发布):可以并行运行多个自主编程任务。你让一个Agent写前端,另一个写后端,同时进行。
适合:完全不懂编程的用户。图形界面最友好。
Claude Code
Anthropic出品。命令行工具,在终端里运行。
2026年的新功能:
- Dreaming:会话间记忆处理。Agent在你不用的时候自动复盘,积累经验。
- Auto Mode:安全管理Agent权限。自动判断哪些操作需要你确认,哪些可以自行执行。
- 多Agent编排:可以在一个项目中同时运行多个Agent,各司其职。
适合:有一定技术基础的用户。或者愿意在终端里工作的用户。
GitHub Copilot
GitHub出品,集成在VS Code中。
2026年的Agent模式:可以自主完成任务,不只是代码补全。和GitHub生态深度集成。
适合:已经在用VS Code和GitHub的用户。
怎么选
| 工具 | 适合人群 | 优势 | 劣势 | 价格(2026) |
|---|---|---|---|---|
| Cursor | 零基础用户 | 图形界面友好,Agent Mode强大 | 功能相对封闭 | $20/月 |
| Claude Code | 有技术基础 | Dreaming记忆,多Agent编排 | 命令行学习成本 | $30/月 |
| GitHub Copilot | VS Code用户 | 生态集成好,代码补全强 | Agent能力相对弱 | $19/月 |
| Windsurf | 追求速度 | 响应快,Cascade编辑强 | 社区较小 | $15/月 |
零基础→Cursor。图形界面最友好。 有基础、大项目→Claude Code。命令行更灵活,Dreaming功能让Agent越用越好。 已有VS Code环境→GitHub Copilot。无缝集成。
10.4 一个案例:从零开始做一个App
背景
一个非程序员用 Vibe Coding 开发了一个桌面知识库应用。
过程
第一阶段:搭框架。告诉AI”我要做一个Tauri桌面应用,前端用原生JS,Python做后端”。AI生成了项目结构和基础代码。
第二阶段:加功能。逐步添加功能——知识库管理、搜索、RAG流水线、向量数据库。每个功能都是用自然语言描述,AI实现。
第三阶段:迭代优化。发现搜索太慢,告诉AI优化。发现界面不好看,告诉AI重新设计。发现内存占用太高,告诉AI优化。
第四阶段:打磨。修bug、加细节、优化体验。这个阶段的对话最多——“这个按钮的位置不对""搜索结果排序逻辑要改""加一个快捷键”。
经验
描述要具体。“做一个搜索功能”和”做一个支持模糊匹配、拼音搜索、按标签过滤的搜索功能”,得到的结果完全不同。
分步实现。不要一次描述太多功能。先做核心功能,确认没问题后再加下一个。
及时纠错。发现AI走偏了,立刻纠正。不要等它走远了再说,那时候修改成本更高。
10.5 Vibe Coding的边界
什么时候会翻车
复杂业务逻辑。如果业务规则非常复杂(比如金融衍生品定价),AI可能理解不全,生成的代码有隐藏bug。
性能要求极高。AI生成的代码通常不是最优的。对于需要极致性能的场景,AI生成的代码可能达不到要求。
安全敏感。涉及密码学、权限控制的代码,AI可能犯安全错误。这些错误不容易被发现,但后果严重。
怎么应对
关键代码人工审核。安全相关、业务核心逻辑,让懂代码的人审核一遍。
自动化测试。写充分的测试用例。AI改了代码后,跑测试看有没有破坏已有功能。
分模块隔离。把系统拆成独立的模块。每个模块用Vibe Coding开发,模块之间用清晰的接口连接。
本章小结
Vibe Coding是用自然语言构建AI产品的方式。核心要点:
- 表达意图就行:不需要会写代码,只需要知道自己想要什么。
- 2026工具选型:Cursor(零基础)、Claude Code(有基础)、Copilot(已有VS Code)。
- 分步实现:先做核心功能,逐步迭代。不要一次描述太多。
- 边界:复杂业务逻辑、性能敏感、安全敏感的场景需要人工审核。
下一章讲AI框架与平台选型。
Ch10 Vibe Coding — Building AI Products with Natural Language
You might think: I don’t know how to code, how can I build an AI product?
The answer for 2026 is: You don’t need to know how to code.
Vibe Coding is a new way of developing: you tell the AI what you want in natural language, and the AI writes the code for you. You take a look, think it’s about right, and accept it. If something’s not right, you say a sentence, and the AI revises it.
Throughout the whole process, you might not have written a single line of code. You’re “vibing” — directing the AI to work based on feeling.
10.1 Starting with a Real Story
A product manager, who couldn’t program at all, wanted to build a personal knowledge base — something that could store notes, search them, and do Q&A.
He opened Claude Code and described in Chinese: “I want to make a desktop app using the Tauri framework, with native JS for the frontend and Python for the backend. Features should include knowledge base management, search, and a RAG pipeline.”
Claude Code generated the project structure and basic code. He ran it, and it worked. Then he gradually added features — knowledge base management, search, RAG pipeline, vector database. Each feature was described in natural language, with the AI implementing it.
In the end, this project had 28,000 lines of code and 109 commits. He didn’t write a single line of code.
This is Vibe Coding.
10.2 How it Works
Step 1: Express Intent
You describe your requirements in natural language. It can be vague: “Build a blog website”. It can also be specific: “Build a blog with Next.js, support Markdown, have tag categories, and show the 5 most recent articles on the homepage”.
The AI will generate code based on your description. The more specific the description, the closer the generated code will be to what you want.
Step 2: AI Generates Code
The AI analyzes your requirements, chooses the tech stack, designs the architecture, and writes the code.
It doesn’t just translate your words — it makes design decisions. You didn’t specify which database to use, it will choose based on the scenario. You didn’t specify which UI framework to use, it will recommend based on the requirements.
Vibe Coding in Action (Claude Code Style): After launching Claude Code, describe your requirements in natural language (e.g., “Help me create a FastAPI backend service with user registration/login and article CRUD interfaces”). The AI will automatically create the project structure, generate code files, and run tests to ensure it starts up.
Step 3: Iterative Modification
You look at the result of the code execution. If you’re not satisfied, you tell the AI how to fix it.
” The login button is too small, make it bigger.” “The search feature is too slow, optimize it.” “Change this page’s layout to a left-right split.”
The AI understands your feedback, modifies the code. You look again, give more feedback. After a few rounds, the product takes shape.
Iteration Example: After AI analyzes performance issues, it might: (1) add database indexes, (2) implement search result caching, (3) add pagination, (4) optimize query statements.
10.3 2026 Tool Selection
Cursor AI
An AI programming IDE based on VS Code.
2026’s Agent Mode: Cursor’s Agent Mode can autonomously complete multi-file edits, run terminal commands, and fix errors itself. You describe a feature, and it writes the code, tests it, and fixes bugs itself.
Background Agents (released late 2025/early 2026): Can run multiple autonomous programming tasks in parallel. You have one Agent write the frontend, another write the backend, simultaneously.
Suitable for: Users with no programming background. The GUI is the most user-friendly.
Claude Code
From Anthropic. A command-line tool that runs in the terminal.
2026’s New Features:
- Dreaming: Inter-session memory processing. The Agent automatically reviews and accumulates experience when you’re not using it.
- Auto Mode: Securely manages Agent permissions. Automatically determines which operations need your confirmation and which can be executed on its own.
- Multi-Agent Orchestration: Can run multiple Agents simultaneously within one project, each with its own role.
Suitable for: Users with some technical foundation. Or users willing to work in the terminal.
GitHub Copilot
From GitHub, integrated within VS Code.
2026’s Agent Mode: Can autonomously complete tasks, not just code completion. Deeply integrated with the GitHub ecosystem.
Suitable for: Users already using VS Code and GitHub.
How to Choose
| Tool | Suitable For | Advantages | Disadvantages | Price (2026) |
|---|---|---|---|---|
| Cursor | Beginners | Friendly GUI, powerful Agent Mode | Relatively closed ecosystem | $20/month |
| Claude Code | Technical users | Dreaming memory, multi-Agent orchestration | Command-line learning curve | $30/month |
| GitHub Copilot | VS Code users | Good ecosystem integration, strong code completion | Relatively weak Agent capabilities | $19/month |
| Windsurf | Speed seekers | Fast response, strong Cascade editing | Smaller community | $15/month |
No foundation → Cursor. The GUI is the most user-friendly.
Have foundation, large projects → Claude Code. The command line is more flexible, and the Dreaming feature makes the Agent improve the more you use it.
Already have VS Code environment → GitHub Copilot. Seamless integration.
10.4 A Case Study: Building an App from Scratch
Background
A non-programmer developed a desktop knowledge-base app using Vibe Coding.
Process
Phase 1: Framework Setup. Told the AI “I want to make a Tauri desktop app with native JS for the frontend and Python for the backend”. The AI generated the project structure and basic code.
Phase 2: Adding Features. Gradually added features — knowledge base management, search, RAG pipeline, vector database. Each feature was described in natural language, with the AI implementing it.
Phase 3: Iterative Optimization. Discovered search was too slow, told the AI to optimize it. Discovered the interface didn’t look good, told the AI to redesign it. Discovered memory usage was too high, told the AI to optimize it.
Phase 4: Polishing. Fixing bugs, adding details, optimizing the experience. This phase had the most dialogue — “This button’s position is wrong”, “The search result sorting logic needs to be changed”, “Add a keyboard shortcut”.
Lessons Learned
Be specific in descriptions. “Add a search feature” and “Add a search feature that supports fuzzy matching, pinyin search, and filtering by tags” will yield completely different results.
Implement step by step. Don’t describe too many features at once. Do the core features first, confirm there are no problems, then add the next one.
Correct mistakes promptly. If you discover the AI is going off track, correct it immediately. Don’t wait until it’s gone too far, because by then the cost of modification will be higher.
10.5 The Boundaries of Vibe Coding
When it Might Fail
Complex business logic. If the business rules are very complex (like financial derivatives pricing), the AI might not fully understand, and the generated code might have hidden bugs.
Extremely high performance requirements. Code generated by AI is usually not optimal. For scenarios requiring extreme performance, the AI-generated code might not meet the requirements.
Security-sensitive. Code involving cryptography, access control, etc., the AI might make security mistakes. These mistakes are not easy to discover, but the consequences are severe.
How to Cope
Manual review of critical code. For security-related and business-critical logic, have someone who understands code review it.
Automated testing. Write sufficient test cases. After the AI modifies the code, run the tests to see if any existing functionality was broken.
Isolate modules. Split the system into independent modules. Each module is developed using Vibe Coding, with clear interfaces between modules.
Chapter Summary
Vibe Coding is a way to build AI products using natural language. Key points:
- Just express your intent: No need to know how to write code, only need to know what you want.
- 2026 Tool Selection: Cursor (beginners), Claude Code (with foundation), Copilot (already have VS Code).
- Step-by-step implementation: Do core features first, then iterate gradually. Don’t describe too much at once.
- Boundaries: Scenarios with complex business logic, performance-sensitive, security-sensitive need manual review.
The next chapter covers AI framework and platform selection.