摘要:今天第 15 次跟 AI 说"我们项目用 React + TypeScript + Antd,状态管理用 Rematch,日期用 dayjs 不要用 moment……" 打完这段话我突然意识到:我每天都在重复教 AI 同一件事。 一个中型项目,光是技术栈+规范+目录结构+接口风格,描述清楚就要 500 字。cursorrules 文件(Kiro 对应 .HTTP Client: [Axios/Fetch] - Date Library: [dayjs] (banned: moment) - Styling: [Less/SCSS/Tailwind] + [CSS Modules/Styled Components]
今天第 15 次跟 AI 说"我们项目用 React + TypeScript + Antd,状态管理用 Rematch,日期用 dayjs 不要用 moment……"
打完这段话我突然意识到:我每天都在重复教 AI 同一件事。
一个中型项目,光是技术栈+规范+目录结构+接口风格,描述清楚就要 500 字。一天对话 20 次,就是重复 20 次。一周就是 100 次。
这不是 AI 的问题,是我的使用方式有问题。
┌─────────────────────────────────────────────┐ │ 你的每次对话 │ │ │ │ ┌──────────┐ ┌──────────┐ │ │ │ 项目上下文 │ + │ 实际需求 │ = 一次 Prompt │ │ │ (500字) │ │ (100字) │ │ │ └──────────┘ └──────────┘ │ │ ↑ │ │ 每次重复! │ └─────────────────────────────────────────────┘
你 80% 的 prompt 在重复描述上下文,只有 20% 在描述真正的需求。
┌─────────────────────────────────────────────┐ │ 配置文件自动加载 │ │ │ │ ┌──────────┐ │ │ │ 项目上下文 │ ← 自动注入,写一次永久生效 │ │ └──────────┘ │ │ │ │ 你只需要写: │ │ ┌──────────┐ │ │ │ 实际需求 │ ← 每次只描述业务差异 │ │ │ (100字) │ │ │ └──────────┘ │ └─────────────────────────────────────────────┘
以 Cursor 为例,在项目根目录创建 .cursorrules 文件(Kiro 对应 .kiro/steering/*.md,Windsurf 对应 .windsurfrules):
.cursorrules
.kiro/steering/*.md
.windsurfrules
# 项目规范 ## 技术栈 - React 17 + TypeScript 4 - Ant Design 5 (ProComponents) - 状态管理:Rematch 2 - 日期库:dayjs(禁止使用 moment) - 样式:Less + CSS Modules(.m.less 后缀) ## 目录规则 - 页面组件放 src/view/<domain>/ - 接口函数放 src/services/<domain>/ - 状态模型放 src/models/<domain>/ - 公共组件放 src/components/ ## 禁止事项 - ❌ 禁止使用 any 类型 - ❌ 禁止使用 moment.js - ❌ 禁止使用 class 组件 - ❌ 禁止使用 function 声明(用箭头函数) - ❌ 禁止在组件内直接调用 axios
之前(每次手动喂上下文):
我:帮我写一个会员列表页面,用 React + TypeScript + Antd, 表格用 ProTable,接口用 axios,函数用箭头函数, 不要用 moment 用 dayjs,样式用 less modules…… (200+ 字的前置描述 + 100 字的实际需求)
之后(配置文件自动加载):
我:写一个会员列表页面,包含姓名、手机号、等级、注册时间字段, 支持按手机号搜索。 (只需要描述业务需求)
生成的代码自动符合项目规范。
# Project Rules ## Tech Stack - Framework: [React/Vue/Angular] + [TypeScript/JavaScript] - UI Library: [Ant Design/Element Plus/MUI] - State Management: [Rematch/Zustand/Pinia/Redux] - HTTP Client: [Axios/Fetch] - Date Library: [dayjs] (banned: moment) - Styling: [Less/SCSS/Tailwind] + [CSS Modules/Styled Components] ## Directory Structure - Pages: src/view/<domain>/ - Services: src/services/<domain>/ - Models/Store: src/models/<domain>/ - Shared Components: src/components/ - Utils: src/lib/ - Constants: src/constant/ - Hooks: src/hooks/ ## Banned Patterns - No any type - No moment.js - No class components - No inline styles - No function declarations (use arrow expressions) - No single file > 250 lines - No direct axios calls in components (use service layer)
复制后改成自己项目的信息,5 分钟搞定。
一句话总结:从"每次教 AI"到"教一次永久生效",这一步的 ROI 是最高的。
💬 你每天跟 AI 重复最多的一句话是什么?评论区说说,看看大家的"重复劳动"有多像。
暂无回复,快来抢沙发吧!
本次需消耗银元:
100
当前账户余额: 0 银元
今天第 15 次跟 AI 说"我们项目用 React + TypeScript + Antd,状态管理用 Rematch,日期用 dayjs 不要用 moment……"
打完这段话我突然意识到:我每天都在重复教 AI 同一件事。
一个中型项目,光是技术栈+规范+目录结构+接口风格,描述清楚就要 500 字。一天对话 20 次,就是重复 20 次。一周就是 100 次。
这不是 AI 的问题,是我的使用方式有问题。
问题的本质
┌─────────────────────────────────────────────┐ │ 你的每次对话 │ │ │ │ ┌──────────┐ ┌──────────┐ │ │ │ 项目上下文 │ + │ 实际需求 │ = 一次 Prompt │ │ │ (500字) │ │ (100字) │ │ │ └──────────┘ └──────────┘ │ │ ↑ │ │ 每次重复! │ └─────────────────────────────────────────────┘你 80% 的 prompt 在重复描述上下文,只有 20% 在描述真正的需求。
解决方案:把上下文固化成配置文件
┌─────────────────────────────────────────────┐ │ 配置文件自动加载 │ │ │ │ ┌──────────┐ │ │ │ 项目上下文 │ ← 自动注入,写一次永久生效 │ │ └──────────┘ │ │ │ │ 你只需要写: │ │ ┌──────────┐ │ │ │ 实际需求 │ ← 每次只描述业务差异 │ │ │ (100字) │ │ │ └──────────┘ │ └─────────────────────────────────────────────┘具体怎么做
以 Cursor 为例,在项目根目录创建
.cursorrules文件(Kiro 对应.kiro/steering/*.md,Windsurf 对应.windsurfrules):# 项目规范 ## 技术栈 - React 17 + TypeScript 4 - Ant Design 5 (ProComponents) - 状态管理:Rematch 2 - 日期库:dayjs(禁止使用 moment) - 样式:Less + CSS Modules(.m.less 后缀) ## 目录规则 - 页面组件放 src/view/<domain>/ - 接口函数放 src/services/<domain>/ - 状态模型放 src/models/<domain>/ - 公共组件放 src/components/ ## 禁止事项 - ❌ 禁止使用 any 类型 - ❌ 禁止使用 moment.js - ❌ 禁止使用 class 组件 - ❌ 禁止使用 function 声明(用箭头函数) - ❌ 禁止在组件内直接调用 axios效果对比
之前(每次手动喂上下文):
之后(配置文件自动加载):
生成的代码自动符合项目规范。
可直接抄走的模板
# Project Rules ## Tech Stack - Framework: [React/Vue/Angular] + [TypeScript/JavaScript] - UI Library: [Ant Design/Element Plus/MUI] - State Management: [Rematch/Zustand/Pinia/Redux] - HTTP Client: [Axios/Fetch] - Date Library: [dayjs] (banned: moment) - Styling: [Less/SCSS/Tailwind] + [CSS Modules/Styled Components] ## Directory Structure - Pages: src/view/<domain>/ - Services: src/services/<domain>/ - Models/Store: src/models/<domain>/ - Shared Components: src/components/ - Utils: src/lib/ - Constants: src/constant/ - Hooks: src/hooks/ ## Banned Patterns - No any type - No moment.js - No class components - No inline styles - No function declarations (use arrow expressions) - No single file > 250 lines - No direct axios calls in components (use service layer)复制后改成自己项目的信息,5 分钟搞定。
一句话总结:从"每次教 AI"到"教一次永久生效",这一步的 ROI 是最高的。
💬 你每天跟 AI 重复最多的一句话是什么?评论区说说,看看大家的"重复劳动"有多像。