GitLab MR Review
This skill performs code reviews on GitLab merge requests using a standardized template.
Trigger
When user says something like:
- - "帮我review这个mr: ${url}"
- "review this mr: ${url}"
- "帮我审查这个mr: ${url}"
Workflow
Step 1: Extract MR URL and Project Info
Parse the MR URL to extract:
- - GitLab host (e.g., gitlab.snowballtech.com)
- Project path (e.g., bp/iot-admin-arco)
- MR IID (e.g., 1321)
Step 2: Configure glab for the GitLab instance
CODEBLOCK0
Step 3: Fetch MR Information
CODEBLOCK1
Step 4: Fetch MR Changes (Diff)
CODEBLOCK2
Step 5: Analyze the Diff
Read the review template at code-review-template.md and analyze the diff for:
- - TODO/FIXME comments
- Unfinished code
- Hardcoded values
- Potential bugs
- Security issues
- Code style issues
- Missing error handling
Step 6: Generate Review Comment
Fill in the template with your analysis:
- - 概述: Brief summary of what the MR does
- 优点: What went well
- 建议: Specific suggestions with file paths and line numbers
- 问题: Issues that need fixing
- 结论: Action items (checkboxes)
Step 7: Post Comment to MR
CODEBLOCK3
Or use inline with INLINECODE1
Tips
- - Use emoji to highlight severity (🔴 for critical, 🟡 for warnings, ✅ for good)
- Be specific: include file paths and line numbers
- Provide actionable feedback
- Balance praise with constructive criticism
GitLab MR 审查
本技能使用标准化模板对GitLab合并请求进行代码审查。
触发条件
当用户说出类似以下内容时:
- - 帮我review这个mr: ${url}
- review this mr: ${url}
- 帮我审查这个mr: ${url}
工作流程
步骤1:提取MR URL和项目信息
解析MR URL以提取:
- - GitLab主机地址(例如:gitlab.snowballtech.com)
- 项目路径(例如:bp/iot-admin-arco)
- MR IID(例如:1321)
步骤2:为GitLab实例配置glab
bash
glab config set host https://<主机名>
步骤3:获取MR信息
bash
glab api projects/<项目>/merge_requests/
步骤4:获取MR变更(差异对比)
bash
glab api projects/<项目>/merge_requests//changes
步骤5:分析差异对比
读取code-review-template.md审查模板,分析差异对比中的以下内容:
- - TODO/FIXME注释
- 未完成的代码
- 硬编码值
- 潜在缺陷
- 安全问题
- 代码风格问题
- 缺失的错误处理
步骤6:生成审查评论
使用分析结果填写模板:
- - 概述:MR所做内容的简要总结
- 优点:做得好的地方
- 建议:包含文件路径和行号的具体建议
- 问题:需要修复的问题
- 结论:待办事项(复选框)
步骤7:将评论发布到MR
bash
glab api projects/<项目>/merge_requests//notes --method POST \
--raw-field body=$(cat review-comment.md)
或使用内联方式 --raw-field body=<内容>
提示
- - 使用表情符号突出严重程度(🔴 表示严重,🟡 表示警告,✅ 表示良好)
- 具体明确:包含文件路径和行号
- 提供可操作的反馈
- 在表扬与建设性批评之间保持平衡