刚好最近利用AI(Cursor)重度参与完成了两个出海产品(resumego.ai 和 deskapp.ai)的开发,聊一下我的思考。
在聊之前,明确一下问题。
其实大家想问的是:AI是否能根据我们的要求自动化(或者非常少的人工介入)来完成产品的开发?
以下是我的思考:
首先得把产品归类一下:简单产品和复杂产品。
简单产品为代码逻辑简单或者说产品业务流程简单的产品。
复杂产品为代码逻辑复杂或者说产品业务流程复杂的产品。
为什么这样分类呢,因为产品的复杂度往往决定着项目的上下文规模,这也直接影响着AI解决问题的复杂度。
对于简单产品,AI现在可以做到完全搞定,你只需要把完整上下文丢给他,需求描述清楚。像开发一个待办ios app,或者开发一个1024小游戏,AI太擅长了。
重点说下复杂的产品,其实AI写好不容易,因为复杂的产品往往项目过于庞大,这个已经超出了AI理解的上下文,那么对于复杂的产品,应该怎么做呢?
我的理解主要是四点:
先约束再发散
先整体再局部
先难点再简单
不要Next->Next->Next, 应该Next->Review->Next
一、先约束再发散
先约束
就是我们要把确定性的环境先配置好,这也是AI运行的前置约束条件,这样AI在生成代码时就不会跑偏,也不会引进更多的bug。
我觉得比较重要的几个配置:
1、技术栈和技术栈版本
明确你使用的技术栈,比如我使用的是:Nextjs15+React19+Shadcn+Tailwindcss v3。
一定要明确版本,还有初始化的一些配置,比如nextjs,是否使用了App Router,是否有src目录等。很多生成的代码执行有问题是因为版本问题,ai没有正确识别版本提供了其他的版本的解决方案。
2、UI风格
一个复杂的项目想要通过AI来确保整体风格的一致性也是很难的,配置里也要约束清楚。
比如:
1)UI一致性:所有的页面和组件使用shadcn的内置UI组件,如果shacn没有,需要参考shadcn的风格去生成,需要考虑 light/dark 模式。如果有响应式要求,还需要考虑响应式。
2)所有的字体图标优先使用 @phosphor-icons/react,备选字体图标@radix-ui/react-icons,@lucide-react
3)交互动画采用framer-motion库
3、其他通用设置
比如AI回复始终保持中文,国际化翻译规则等等。
关于如何配置,网上有很多优秀案例,参考:https://cursor.directory/rules。
我是根据自己的项目写的,如下:
# ResumeGO Project Specifications## Technology Stack- **Next.js**: Version 15 with App Router- **React**: Version 19- **UI Component Library**: shadcn/ui- **CSS Framework**: Tailwind CSS v3- **Animation Library**: framer-motion- **Icon Libraries** (in order of preference):1. phosphor-icons/react2. lucide-react3. radix-ui/react-icons## Project Structure- Uses App Router architecture- Has a `src` directory containing the application code- Follows the standard Next.js 15 App Router conventions for routing and layouts## UI/UX Requirements- All UI components should be built using shadcn/ui components when available- Custom components should follow shadcn/ui design patterns and styling conventions- All components must support both light and dark modes- UI should be responsive and accessible- Animations should be implemented using framer-motion with appropriate motion preferences consideration## Internationalization- Uses next-intl for internationalization- Translation files are stored in the `/messages` directory- When adding new text content, translations must be synchronized across all language files- The application supports multiple languages and has a language switcher component## Code Style and Conventions- TypeScript is used throughout the project- Components should be function components with proper typing- Component props should be explicitly typed with TypeScript interfaces- CSS should be implemented using Tailwind's utility classes- Use CSS variables for theming where appropriate- Prefer server components where possible, use client components only when necessary## State Management- Use React's built-in hooks for local state- For global state, prefer React Context or other lightweight solutions- Avoid unnecessary state, leverage React Server Components where possible## API Integration- API routes are created in the app/api directory following Next.js conventions- Use SWR or React Query for data fetching in client components- Server components should fetch data directly## Performance Considerations- Implement proper code splitting and lazy loading- Optimize images using Next.js Image component- Follow best practices for Web Vitals optimization## Accessibility- All components must meet WCAG 2.1 AA standards- Ensure proper keyboard navigation- Provide appropriate ARIA attributes- Maintain sufficient color contrast ratios## Communication with Users- The AI assistant should always respond in Chinese- Code examples should follow the project conventions- Generated components should match the existing design system
再发散
在我们前置规则都设置好之后,在和AI对话的时候一定要保持一定的发散性(开放性),你只需要把需求描述清楚,不需要告诉AI应该怎么做,因为AI可能会给你更好的解决方案。除非他明显跑偏了,再去引导他。
二、先整体后局部
先整体后局部
开发复杂的项目时,因为项目上下文的问题已经超出了AI的理解,所以我们一定要让AI先把整体框架搭好,相当于先搭好骨骼,然后再去填充血肉。因为后面再去填充功能(血肉)时,他已经是拆解的独立模块了。而这个模块就在AI的上下文里面了。同理,独立模块里面可以继续先整体后局部的思路。
三、先难点后简单
先要预测项目中的难点功能,让AI优先解决。如果后解决,项目上下文已经变大了,同时不确定因素也变多了,AI解决的难度就更大了,如果持续迭代,项目可能就朝着不可维护的方向走了。所以一定要做到迭代的过程中同时保持收敛。
比如deskapp的项目,首页可拖动的网格系统是最核心功能,是优先解决的:
四、不要Next->Next->Next, 应该Next->Review->Next
不要过于相信AI的能力,闭眼让AI一直下一步,一旦代码越来越多,项目越来越大,AI出错的概率就会变大。所以每执行一步后需要稍微看下,没大问题再继续下一步。也是为了保证产品不要变得不可维护。
所以我觉得对于复杂的产品,AI已经能提供很大的助力,但是靠其完全自动化完成是不现实的,对于很多没有编程背景的同学更是不可能的。
说到这里,很多没有编程背景的同学会有些悲观,【AI为我打工】的美好愿景破灭了。但是实际也并不是,因为对于个人开发者来说,一个产品能否赚到钱跟产品的复杂度关系并不大,找对场景以及推广可能更重要。而做复杂项目往往是是有着长期主义的创业公司或者大厂的专利。所以我们作为独立开发者还是可以使用AI大展拳脚。
以上是我个人的理解,我有一个很强烈的感觉,AI正在以比我预想的还要快的速度再朝前发展。我也只用出了AI的部分能力,已经大大提升了工作效率。还有很多大神把AI用得非常好,也有很多AI产品已经能做到把一个idea变成上线的网站(简单逻辑的产品)。
希望有朝一日AI真的能替代我们工作,并给我们发工资,期待美好的生活可以到来。
最后安利一波cursor(模型: claude-3.7-sonnect-thinking),在写代码上特别是前端场景,真是无敌的存在。我们在deskapp.ai也集成了这个模型的AI对话,欢迎体验。

