How this skill is triggered — by the user, by Claude, or both
Slash command
/fe-dev:code-reviewThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
> 审查规则: `<skill-path>/references/code-review-rules.md`
审查规则:
<skill-path>/references/code-review-rules.md
两阶段审查:先用 ast-lint 做确定性静态分析(如已安装),再用语义审查补充逻辑/设计问题。
<scope>: 可选,审查范围
--staged — 仅审查已暂存的变更<file path> — 仅审查指定文件/fe-dev:code-review
/fe-dev:code-review --staged
/fe-dev:code-review src/components/Login.vue
根据 scope 参数:
git diff --name-only
git diff --cached --name-only
--staged:git diff --cached --name-only
无变更文件 → 提示「没有需要审查的变更」,退出。
尝试调用 mcp__ast-lint__analyze_code 做一次探测:
参数:
code: "const x = 1;"
filePath: "test.ts"
💡 提示: 未检测到 ast-lint MCP,跳过静态分析阶段。
安装后可获得 37 条 AST 规则的确定性检查,详见: https://www.npmjs.com/package/ast-lint-mcp
根据 scope 调用对应的 MCP 工具:
mcp__ast-lint__analyze_git_diff参数:
base: "HEAD" # 对比基准
onlyChanged: true # 只分析变更行
format: "detailed" # 详细输出
mcp__ast-lint__analyze_file参数:
filePath: "<绝对路径>"
收集 ast-lint 报告的所有问题,按严重级别分类(error / warning / info)。
读取 <skill-path>/references/code-review-rules.md,获取变更的 diff 和完整文件内容。
按规则清单审查。如果第一阶段已执行,跳过 ast-lint 已覆盖的检查项:
ast-lint 已覆盖(有 ast-lint 时跳过):
无 ast-lint 时:按 code-review-rules.md 全部规则审查,不跳过任何项。
Claude 语义审查聚焦(code-review-rules.md 中 ast-lint 未覆盖的部分):
只报告有把握的问题(置信度 >= 80%),不要猜测。
## 代码审核报告
### 总结
- 审查文件数: N
- 严重: N 个(ast-lint: N, 语义审查: N)
- 重要: N 个(ast-lint: N, 语义审查: N)
- 建议: N 个(ast-lint: N, 语义审查: N)
---
### 第一阶段:静态分析(ast-lint)
#### src/components/Login.vue
- [error] L42 `security/no-inner-html`: innerHTML 赋值,存在 XSS 风险
- [warning] L78 `maintainability/magic-number`: 魔法数字 3000
#### src/utils/format.ts
- ✅ 无问题
---
### 第二阶段:语义审查
#### src/components/Login.vue
- [严重] L35: `formData` 使用 `as any` 绕过类型检查,应定义接口
- [重要] L60: watch 监听 `formData.type` 缺少 getter 函数,只会触发一次
#### src/pages/index.vue
- [重要] L12: `useFetch` 缺少 key 参数,可能导致 SSR 缓存冲突
---
### 亮点
- 做得好的地方
### 审核结果
✅ 审核通过 | ⚠️ 有告警 (N 条) | ❌ 未通过 (N 严重, N 重要)
## 代码审核报告
> 💡 未检测到 ast-lint MCP,仅执行语义审查。安装后可增强静态分析能力。
### 总结
- 审查文件数: N
- 严重: N 个
- 重要: N 个
- 建议: N 个
### 问题
#### 严重(必须修复)
- [文件:行号] 问题描述 + 修复建议
#### 重要(建议修复)
- [文件:行号] 问题描述 + 修复建议
#### 建议(锦上添花)
- [文件:行号] 问题描述
### 亮点
- 做得好的地方
### 审核结果
✅ 审核通过 | ⚠️ 有告警 (N 条) | ❌ 未通过 (N 严重, N 重要)
严重级别映射:
error + 语义审查「严重」 → 严重(阻断提交)warning + 语义审查「重要」 → 重要(告警)info + 语义审查「建议」 → 建议(不阻断)最终结果:
❌ 未通过⚠️ 有告警✅ 审核通过npx claudepluginhub twoer/skills --plugin fe-devGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.