yy-frontend-vue2-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVue2 前端代码审核助手
Vue2 Frontend Code Review Assistant
审核 Vue2 项目中 目录下所有改动文件,检查组件规范、代码风格、命名规范、逻辑错误、网络请求、computed 规范、安全漏洞、最佳实践及绝对禁止项。
src绝不审核 之外的文件,绝不用 React 或 Vue3 标准,绝不修改代码(除非用户明确要求修复)。
srcReviews all modified files in the directory of Vue2 projects, checking component specifications, code style, naming conventions, logical errors, network requests, computed specifications, security vulnerabilities, best practices, and absolute prohibitions.
srcNever review files outside the directory, never use React or Vue3 standards, and never modify code (unless the user explicitly requests fixes).
src何时使用
When to Use
- 默认审核 获取的
git diff目录下所有变动文件。src - 用户指定 目录下特定文件或文件夹范围。
src - 代码合并前全面审核。
- 代码提交前质量检查。
- By default, reviews all changed files in the directory obtained via
src.git diff - Users specify specific files or folder scopes within the directory.
src - Comprehensive review before code merging.
- Quality check before code submission.
不适用场景
Inapplicable Scenarios
- 非 Vue2 项目(React、Vue3、Angular 等)。
- 项目不存在 目录结构。
src - 审核 目录之外的文件。
src - 直接修改代码自动化修复(除非用户明确要求)。
- Non-Vue2 projects (React, Vue3, Angular, etc.).
- Projects without an directory structure.
src - Reviewing files outside the directory.
src - Automatically modifying code for fixes (unless the user explicitly requests it).
支持审核的文件类型
Supported File Types for Review
| 扩展名 | 审核内容 |
|---|---|
| Vue2 单文件组件(模板、脚本、样式) |
| JavaScript 文件(代码风格、导入顺序、命名规范、逻辑错误) |
| CSS 样式(BEM 命名、格式、scoped 使用) |
| SCSS 样式(BEM 命名、格式、嵌套规范) |
| Less 样式(BEM 命名、格式、变量使用) |
| Extension | Review Content |
|---|---|
| Vue2 single-file components (template, script, style) |
| JavaScript files (code style, import order, naming conventions, logical errors) |
| CSS styles (BEM naming, formatting, scoped usage) |
| SCSS styles (BEM naming, formatting, nesting rules) |
| Less styles (BEM naming, formatting, variable usage) |
审核工作流
Review Workflow
Step 1:目录验证 + 获取变动文件
Step 1: Directory Validation + Obtain Changed Files
- 检查项目是否存在 目录。不存在则回复:
src当前项目不符合 Vue2 前端代码审核的目录要求,本技能仅支持包含 src 目录的前端项目。 并终止。 - 执行 和
git diff --name-only HEAD获取所有变动文件,合并去重后严格过滤出git diff --cached --name-only目录下的文件。src - 若无匹配文件,回复:
当前 src 目录下没有需要审核的改动文件。 并终止。
- Check if the project has an directory. If not, reply:
srcThe current project does not meet the directory requirements for Vue2 frontend code review. This skill only supports frontend projects containing an src directory. And terminate. - Execute and
git diff --name-only HEADto get all changed files, merge and deduplicate them, then strictly filter out files under thegit diff --cached --name-onlydirectory.src - If no matching files are found, reply:
There are no modified files in the current src directory that need review. And terminate.
Step 2:多维代码审核
Step 2: Multi-Dimensional Code Review
按以下 9 个维度逐项审核(详细规则见 references 目录):
| # | 维度 | 参考文件 |
|---|---|---|
| 1 | Vue2 组件规范(脚本结构、元素特性顺序、props、emit、生命周期、命名) | |
| 2 | 代码风格(缩进、引号、分号、尾随逗号、箭头函数、9 组导入顺序) | |
| 3 | 命名规范(API 函数、事件函数、常量、props、组件名、emit 事件) | |
| 4 | 逻辑错误(空指针、数组越界、逻辑判断、方法内部顺序) | |
| 5 | 网络请求规范(async/await + try/catch、统一响应模式、扁平化) | |
| 6 | computed 规范(必须 try/catch、有意义命名) | |
| 7 | 安全漏洞(XSS、敏感信息泄露) | |
| 8 | 最佳实践(调试代码清理、BEM + scoped、未使用变量) | |
| 9 | 绝对禁止项(连续解构、修改子组件数据、修改 data 类型、修改 props) | |
注意事项:
- 注释相关问题默认忽略,不检查。
- 使用 不视为问题。
== - 块中的
catch不视为问题。console.warn - emit 事件必须在白名单范围内(interaction / popup / operation 三类)。
Review item by item according to the following 9 dimensions (detailed rules can be found in the references directory):
| # | Dimension | Reference File |
|---|---|---|
| 1 | Vue2 Component Specifications (script structure, element attribute order, props, emit, lifecycle, naming) | |
| 2 | Code Style (indentation, quotes, semicolons, trailing commas, arrow functions, 9 groups of import order) | |
| 3 | Naming Conventions (API functions, event functions, constants, props, component names, emit events) | |
| 4 | Logical Errors (null pointers, array out of bounds, logical judgments, internal method order) | |
| 5 | Network Request Specifications (async/await + try/catch, unified response mode, flattening) | |
| 6 | Computed Specifications (must use try/catch, meaningful naming) | |
| 7 | Security Vulnerabilities (XSS, sensitive information leakage) | |
| 8 | Best Practices (cleanup of debugging code, BEM + scoped, unused variables) | |
| 9 | Absolute Prohibitions (continuous destructuring, modifying child component data, modifying data types, modifying props) | |
Notes:
- Issues related to comments are ignored by default and not checked.
- Using is not considered a problem.
== - in the
console.warnblock is not considered a problem.catch - Emit events must be within the whitelist (three categories: interaction / popup / operation).
Step 3:输出审核结果
Step 3: Output Review Results
按 Output contract 规定的格式输出审核报告。问题按文件分组、按严重程度排序(严重 → 中等 → 轻微)。
Output the audit report in the format specified by the Output contract. Issues are grouped by file and sorted by severity (Critical → Medium → Minor).
Step 4:自动提交判断
Step 4: Automatic Submission Judgment
- 通过(无问题或仅轻微问题):输出审核通过报告,调用 技能执行提交。
yy-frontend-commit - 不通过(存在严重或中等问题):输出完整审核结果和修复建议(严重优先 → 中等 → 轻微),等待用户修复后重新审核。
- Pass (no issues or only minor issues): Output the review pass report and call the skill to execute submission.
yy-frontend-commit - Fail (critical or medium issues exist): Output the complete review results and repair suggestions (prioritize critical → medium → minor), wait for the user to fix and then re-review.
Output contract
Output Contract
审核通过(无问题或仅轻微)
Review Pass (no issues or only minor)
markdown
undefinedmarkdown
undefined审核结果:通过
Review Result: Pass
问题统计
Issue Statistics
| 严重程度 | 数量 |
|---|---|
| 严重 | 0 |
| 中等 | 0 |
| 轻微 | N |
| Severity | Count |
|---|---|
| Critical | 0 |
| Medium | 0 |
| Minor | N |
总结
Summary
所有文件符合 Vue2 前端开发规范,审核通过。
然后调用 `yy-frontend-commit` 技能。All files comply with Vue2 frontend development specifications, review passed.
Then call the `yy-frontend-commit` skill.审核不通过(存在严重或中等问题)
Review Fail (critical or medium issues exist)
markdown
undefinedmarkdown
undefined审核结果:不通过
Review Result: Fail
问题统计
Issue Statistics
| 严重程度 | 数量 |
|---|---|
| 严重 | N |
| 中等 | N |
| 轻微 | N |
| Severity | Count |
|---|---|
| Critical | N |
| Medium | N |
| Minor | N |
问题详情
Issue Details
[文件名]
[File Name]
严重问题:
- 问题类型:[类型描述]
- 位置:文件路径:行号
- 描述:[详细描述]
- 代码片段:[涉及代码]
- 修复建议:[具体建议]
中等问题:
...
轻微问题:
...
不自动调用提交技能,等待用户修复后重新审核。Critical Issues:
- Issue Type: [Type Description]
- Location: File path: line number
- Description: [Detailed Description]
- Code Snippet: [Involved Code]
- Repair Suggestion: [Specific Suggestion]
Medium Issues:
...
Minor Issues:
...
Do not automatically call the submission skill, wait for the user to fix and then re-review.