-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add Vibe-Coding SOP (5-stage AI coding workflow rule) #342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
youngcintj
wants to merge
2
commits into
PatrickJS:main
Choose a base branch
from
youngcintj:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+102
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| --- | ||
| description: A 5-stage vibe-coding standard operating procedure (SOP) for Cursor — requirements → tech eval → development → testing → review. Includes a safety gate that blocks file writes until the plan is approved by the human, and produces a reusable design system so generated UI stays consistent instead of "AI slop". | ||
| globs: | ||
| alwaysApply: false | ||
| --- | ||
|
|
||
| # Vibe-Coding SOP v1 — Cursor Rules | ||
|
|
||
| 自动加载,适用整个项目。完整文档: https://github.com/youngcintj/vibe-coding-sop | ||
|
|
||
| ## 工作流:5 阶段 + 4 横向 + 6 维 | ||
|
|
||
| 任何"写代码"任务(后端/前端/全栈/脚本),按这个流程走: | ||
|
|
||
| ### 阶段 1:需求确认 | ||
| - 不要一上来就写代码。先问清楚:需求边界(不做什么)、验收标准(用户用得顺的具体行为)、优先级(MVP vs 完整) | ||
| - 必产出:需求规格 + 风险点 + 后续建议 | ||
| - 拍板:边界 / 验收标准 / 优先级 | ||
|
Comment on lines
+13
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Enforce the advertised approval gate before claiming it. The SOP and README promise that file writes are blocked until human approval, but the rule currently lacks an explicit no-mutation constraint.
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
| ### 阶段 2:技术评估 | ||
| - 关键技术选型走 6 维评估矩阵: | ||
| | 维度 | 权重 | | ||
| |---|---| | ||
| | 功能匹配 | 30% | | ||
| | 团队熟悉度 | 20% | | ||
| | 性能/可扩展 | 15% | | ||
| | 维护性 | 15% | | ||
| | 生态/集成 | 10% | | ||
| | 长期成本 | 10% | | ||
| - 输出:推荐方案 + 1-2 备选 + 各自优劣 | ||
| - 拍板:技术选型 | ||
|
|
||
| ### 阶段 3:开发 | ||
| **第一件事:Git 初始化** | ||
| - 项目第一天:`git init` + 写 `.gitignore`(.env / .bak / __pycache__ / node_modules 必 ignore) | ||
| - 大变更必打 tag(semver v0.X.0 / v0.X.Y) | ||
| - 回滚优先 `git checkout <tag> -- <path>`,不靠文件备份 + regex 删 | ||
| - 删文件用可恢复删除工具(`mavis-trash` Mavis 生态 / `trash-cli` npm i -g trash-cli / 系统回收站),绝不 `rm -rf` | ||
|
|
||
| **后端开发**: | ||
| - API 设计要稳(类型契约清晰,边界明确) | ||
| - 凭记忆编码前先看官方文档 | ||
| - 安全审查(输入验证/认证/数据存储) | ||
|
|
||
| **前端开发**: | ||
| - 抗 AI slop,审美在线(参考设计系统,不是凭感觉) | ||
| - 第一个功能必出 `docs/design-system.md`(配色/字号/间距/圆角/组件/动效) | ||
| - 改设计规范要 PM 拍板 | ||
|
|
||
| **增量交付**: | ||
| - 每完成小功能就 commit,不要攒一堆一起提交 | ||
| - 大变更(影响 ≥3 文件)前先报告 PM | ||
|
|
||
| ### 阶段 4:测试 | ||
| - 必出测试计划(覆盖功能/性能/兼容性/异常路径) | ||
| - **必出串行测试用例**:用户按顺序点完一遍,快速确认主功能 | ||
| - 不靠 LLM 自检完成度,用 Playwright / curl 实测验证 | ||
|
|
||
| ### 阶段 5:定期代码审查 | ||
| - 触发:累计 commit ≥ 20 / 大版本前 / 用户主动 | ||
| - 报告三件套: | ||
| 1. 优化点(明确推荐改) | ||
| 2. 没把握的地方(我担心,你来定) | ||
| 3. 风险点(知道但暂时没解) | ||
| - PM 拍板:全部修 / 部分修 / 暂不修 / 改设计规范 | ||
|
|
||
| ## 4 个横向要求(每步必走) | ||
|
|
||
| - **A. 执行思路**:做了什么 / 怎么做的 / 关键决策 | ||
| - **B. 风险点**:可能踩的坑 / 边界情况 / 已知问题 | ||
| - **C. 后续建议**:下一步 / 类似项目借鉴 | ||
| - **D. 强制 Git**:见上方 | ||
|
|
||
| ## 报告格式(每步必给) | ||
|
|
||
| ``` | ||
| ## [阶段 X] 执行报告 | ||
|
|
||
| ### 执行思路 | ||
| - ... | ||
|
|
||
| ### 风险点 | ||
| - ... | ||
|
|
||
| ### 后续建议 | ||
| - ... | ||
| ``` | ||
|
|
||
| ## 必拍板点(任何阶段遇到都要问,不擅自做主) | ||
|
|
||
| - 需求边界 / 验收标准 / 优先级 | ||
| - 技术选型 / 库 / 方案 | ||
| - 改 schema / 业务阈值 / LLM prompt persona / UI 重要位置 | ||
| - 设计规范变更 | ||
| - 代码审查后的修缮决策 | ||
|
|
||
| ## 不适用场景(可跳过部分流程) | ||
|
|
||
| - **PoC 一次性**:可跳过 Git 强制 + 评估矩阵 | ||
| - **用户明确说"你随便改"**:可跳过拍板环节 | ||
| - **小修改(typo / 文案 / 颜色)**:自动处理 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: PatrickJS/awesome-cursorrules
Length of output: 258
🌐 Web query:
Cursor context rules yml md frontmatter alwaysApply globs documentation💡 Result:
Cursor has transitioned to a directory-based system for managing AI instructions, using.mdc files within a.cursor/rules/ folder [1][2]. While the legacy.cursorrules file in the project root is still supported for backward compatibility, it is recommended to migrate to the new format for better scoping and organization [3][4][5]. ### Modern.mdc Rules System Project rules are now defined as.mdc (Markdown + metadata) files located in the.cursor/rules/ directory [1][4]. These files use YAML frontmatter to control their activation and scope [2][6]. ### Frontmatter Configuration Each.mdc file should contain a YAML frontmatter block at the top [2][7]. The three primary fields used to control rule application are: * description: A one-line summary that helps Cursor's agent decide whether the rule is relevant to the current task [1][4][6]. * globs: A list of file patterns (e.g., ["src//.ts", "styles/.css"]) that trigger the rule automatically when a matching file is in context [2][4]. * alwaysApply: A boolean flag [1][7]. * When true: The rule is always included in every chat session, and the globs/description fields are ignored [1][4]. * When false: The rule is applied conditionally based on matching globs or agent relevance [1][7]. ### Rule Activation Modes Based on these settings, rules generally fall into four activation categories [4][7]: 1. Always Apply: alwaysApply: true. Included in every request [4][7]. 2. Auto-attached: alwaysApply: false with globs provided. Activates when a file matching the glob is in context [1][4]. 3. Agent-requested: alwaysApply: false with a description provided (but no globs). The agent reads the description and determines if it is relevant [1][6][7]. 4. Manual: alwaysApply: false with no globs or description. The rule only activates when explicitly referenced (e.g.,
@-mentioningthe rule in chat) [4][7]. Note: Plain.md files in the.cursor/rules/ folder are ignored by the rules system because they lack the required frontmatter [1][4]. If you prefer plain markdown without frontmatter, you can use AGENTS.md instead [1].Citations:
Make the rule activate reliably across coding tasks.
With
alwaysApply: falseandglobs:empty, the rule is agent-relevance/manual rather than project-wide. SetalwaysApply: true, or add explicit matching globs if this SOP should auto-attach only for certain task contexts.🤖 Prompt for AI Agents