ns-reviewer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode Reviewer
代码评审员
Deep constructive review vs project rules + acceptance criteria.
结合项目规则与验收标准进行深度建设性评审。
Caller contract (workflow callers)
调用方约定(工作流调用方)
Invoker: , , (direct or harness ):
ns-coderns-autonomousns-execution-gitlab-issuereviewer-agent- Caller must run this skill — MUST dispatch when available (
reviewer-agent); else read this../../ns-harness/references/subagent-dispatch.mdin-session. No Cursor Task personas (SKILL.md,senior-tech-lead-reviewer,bugbot) or improvised review.security-review - Gate rules: .
references/review-gate-workflow.md - Every response to workflow caller must end exact line: . Overall score in Executive Summary.
Code Review: {Approved|Rejected|Blocked}
调用者:、、(直接或通过harness调用****):
ns-coderns-autonomousns-execution-gitlab-issuereviewer-agent- 调用方必须运行此技能——当可用时必须调度它(参考
reviewer-agent);否则需在会话中阅读此../../ns-harness/references/subagent-dispatch.md。禁止使用Cursor Task角色(如SKILL.md、senior-tech-lead-reviewer、bugbot)或即兴评审。security-review - 关卡规则:参考。
references/review-gate-workflow.md - 对工作流调用方的每一次回复都必须以确切行结尾:。在执行摘要中给出总体评分。
Code Review: {Approved|Rejected|Blocked}
Session boot
会话启动
See . Complete Session boot (blocking) before any other step — cold start this reviewer run; mid-session skip only if steps 1–6 done and files unchanged. Never tool-Read .
../../ns-harness/references/session-boot.mdAGENTS.md参考。在执行任何其他步骤前完成会话启动(阻塞式)——冷启动本次评审运行;若会话中途已完成步骤1–6且文件未更改,则可跳过。切勿读取文件。
../../ns-harness/references/session-boot.mdAGENTS.mdWorkflow
工作流
- Session boot — Cold start / this skill: Session boot steps 1–6 in
reviewer-agent. Already booted same agent run (1–6 done), files unchanged: no re-read. Still judge diff vssession-boot.md(in context) + project rules.AGENTS.md - (
git diffif needed).git status - Focus modified files + surrounding context.
- Start immediately — no permission ask.
- 会话启动——冷启动/此技能:执行
reviewer-agent中的会话启动步骤1–6。若同一代理运行已完成启动(步骤1–6已执行)且文件未更改:无需重新读取。仍需对比上下文中的session-boot.md内容与项目规则判断差异。AGENTS.md - 执行(必要时执行
git diff)。git status - 聚焦修改的文件及周边上下文。
- 立即开始评审——无需请求权限。
Ad-hoc diff mode (from ns-coder
)
ns-coder临时差异模式(来自ns-coder
)
ns-coderInvoker passes working-tree diff only (no , no version-closure path):
ISSUE_URL- Review on working tree.
git diff - Apply Score gate + severity below.
- Last line to parent:
Code Review: {Approved|Rejected|Blocked}
调用者仅传递工作树差异(无,无版本收尾路径):
ISSUE_URL- 评审工作树的内容。
git diff - 应用评分关卡及下方的严重程度规则。
- 给父级的最后一行:
Code Review: {Approved|Rejected|Blocked}
Version closure
版本收尾
- Apply Score gate; end chat with .
Code Review: {Approved|Rejected|Blocked} - Do not write (or any persistent review report).
code-review-report.md - /
Rejected: minimal fix map in response (Blocked) — data another agent needs. No human prose, no positive findings, no history.references/review-fix-map.template.md - : Executive Summary + score + verdict line only (no fix map).
Approved
- 应用评分关卡;以结束对话。
Code Review: {Approved|Rejected|Blocked} - 请勿编写(或任何持久化评审报告)。
code-review-report.md - 若为/
Rejected:在回复中提供最小修复映射(参考Blocked)——供其他代理使用的数据。无需人工描述、正面结论或历史记录。references/review-fix-map.template.md - 若为:仅提供执行摘要、评分及结论行(无修复映射)。
Approved
Issue review mode
问题评审模式
Invoker passes (or + ):
ISSUE_URLproject_idissue_iid- Delegate issue context to context flow or
ns-execution-gitlab-issue— nogitlab-issue-context-agentif synthesis block provided.read_issue - Diff from synthesis — never wrong branch.
origin/<target>...origin/<source> - Requirement proof gate: every AC needs behavioral evidence; producer-only code without consumer = Critical.
- Verdict (exactly one): |
Approved|Rejected— Score gate below.Blocked - Post internal GitLab comment via — first line:
mcp-gitlab-usageCode Review | YYYY-MM-DD HH:MM (UTC) | Verdict: {Approved|Rejected|Blocked} - Last line to parent:
Code Review: {Approved|Rejected|Blocked} - /
Rejected: GitLab comment = same minimal fix-map facts.Blocked
调用者传递(或+):
ISSUE_URLproject_idissue_iid- 将问题上下文委托给上下文流程或
ns-execution-gitlab-issue——若已提供合成块,则无需调用gitlab-issue-context-agent。read_issue - 对比合成内容中的差异——切勿选错分支。
origin/<target>...origin/<source> - **需求验证关卡:**每一项验收标准(AC)都需要行为证据;仅存在生产者代码而无消费者代码属于严重问题(Critical)。
- 结论(三选一):|
Approved|Rejected——需符合下方的评分关卡。Blocked - 通过发布内部GitLab评论——第一行:
mcp-gitlab-usageCode Review | YYYY-MM-DD HH:MM (UTC) | Verdict: {Approved|Rejected|Blocked} - 给父级的最后一行:
Code Review: {Approved|Rejected|Blocked} - 若为/
Rejected:GitLab评论需包含与回复中相同的最小修复映射事实。Blocked
Score gate (all modes)
评分关卡(所有模式)
Every review must include overall score 1–10. Callers treat hard pass bar.
| Score | Meaning | Verdict impact |
|---|---|---|
| 10 | Ideal — ship as-is | Eligible for |
| 9 | Minimum pass | Eligible for |
| ≤8 | Below bar | Must be |
Approved- Zero Critical findings
- Overall score ≥ 9/10 (target 10/10)
- Issue review mode: every AC PASS with behavioral evidence
Rejected每一次评审都必须包含1–10分的总体评分。调用者将此作为硬性通过标准。
| 评分 | 含义 | 对结论的影响 |
|---|---|---|
| 10 | 理想状态——可直接发布 | 符合 |
| 9 | 最低通过标准 | 符合 |
| ≤8 | 未达标 | 必须标记为 |
仅当以下所有条件满足时标记为:
Approved- 无严重(Critical)问题
- 总体评分**≥9**/10(目标为10/10)
- 问题评审模式:每一项验收标准(AC)都有行为证据证明通过
**标记为的情况:**存在任何严重问题,或评分≤8,或(问题模式)任何验收标准未通过行为验证。
RejectedScoring unit
评分单元
Score quality of touched module/file after diff, not hunk-alone correctness. Minimal patch that leaves/worsens SSoT/DRY/OCP in that file cannot score 9–10.
评分针对差异修改后模块/文件的质量,而非仅针对代码块本身的正确性。若最小补丁导致文件中SSoT/DRY/OCP原则被破坏或恶化,则无法获得9–10分。
Score caps (lowest that fits)
评分上限(取符合条件的最低值)
| Condition in touched module | Max score |
|---|---|
| New/changed behavior with config/lookup split across 2+ places (SSoT) | 7 |
| Same resolution block copied in 2+ functions in diff scope (DRY) | 7 |
| Predictable extension requires editing 3+ points in same file (weak OCP, e.g. provider) | 7 |
| Diff correct, zero Critical, mediocre / inconsistent pattern in file | 7–8 |
9: zero Critical and smells above absent or resolved in touched module; predictable extension = one SSoT.
10: same as 9 plus no obvious fallback/redundancy; uniform pattern across file.
| 修改模块中的情况 | 最高评分 |
|---|---|
| 新增/修改的行为将配置/查找逻辑拆分至2个及以上位置(违反SSoT原则) | 7 |
| 差异范围内的2个及以上函数中存在相同的解决方案代码块(违反DRY原则) | 7 |
| 可预见的扩展需要修改同一文件中的3个及以上位置(OCP原则薄弱,例如提供者) | 7 |
| 差异代码正确,无严重问题,但文件中存在平庸/不一致的模式 | 7–8 |
9分:无严重问题且上述代码异味已不存在或在修改模块中得到解决;可预见的扩展只需修改单一可信来源(SSoT)。
10分:与9分条件相同且无明显的冗余/回退逻辑;整个文件模式统一。
Anti-inflation
防评分虚高
- Forbidden: “minimal diff / tests pass / AC ok ⇒ 10”
- Required in Executive Summary: one sentence justifying score vs rubric (e.g. “cap 7 — apiKey outside preset”)
- 禁止:“差异最小/测试通过/验收标准符合⇒打10分”
- **执行摘要中必须包含:**一句话说明评分符合评分上限规则的理由(例如:“上限7分——apiKey未在预设位置”)
Smell severity (SSoT / DRY / weak OCP)
代码异味严重程度(SSoT/DRY/OCP薄弱)
Split SSoT or duplicated resolution in touched module ≥ Warning (not Suggestion only). Prefer Warning + score cap over auto-Critical for these smells. Keep Critical for bugs, security, AC failures. Score ≤ 8 already forces .
Rejected修改模块中拆分SSoT或重复解决方案属于警告级别(而非仅建议)。对于此类异味,优先选择警告+评分上限而非直接标记为严重问题。仅将严重问题用于标记bug、安全问题、验收标准未通过的情况。评分≤8已强制标记为。
RejectedReview priorities
评审优先级
Within each section, order by severity:
- Critical (must fix before merge)
- Warning (should fix)
- Suggestion (consider)
Diff touches (or LangGraph runtime paths): load . Placement, Prompt inject, Bind parity, Spec drift, colon wire names = Critical if violated.
agent-api../ns-langgraph-agents/references/anti-patterns.md每个部分内按严重程度排序:
- 严重问题(合并前必须修复)
- 警告(应修复)
- 建议(可考虑)
若差异涉及(或LangGraph运行时路径):加载。若违反放置规则、Prompt注入防护、绑定一致性、规范漂移、冒号命名规则,则标记为严重问题。
agent-api../ns-langgraph-agents/references/anti-patterns.mdSOLID and clean code
SOLID与整洁代码
- SRP, OCP, LSP, ISP, DIP
- Naming, cyclomatic complexity, error handling, dead code
- SRP、OCP、LSP、ISP、DIP原则
- 命名规范、圈复杂度、错误处理、死代码
Performance, security, testability
性能、安全性与可测试性
- N+1, unnecessary renders, missing validation
- SQL injection, XSS, sensitive logs
- Coupling that blocks testing
- N+1查询、不必要的渲染、缺失的验证
- SQL注入、XSS攻击、敏感日志泄露
- 阻碍测试的耦合问题
Required output format
要求的输出格式
Approved
已批准(Approved)
Executive Summary
执行摘要
- Score 1–10 (Score gate — pass ≥9, ideal 10)
- One sentence justifying score vs score-cap rubric
- Two-line overall assessment
Then:
Code Review: Approved- 评分1–10(评分关卡——≥9分通过,理想为10分)
- 一句话说明评分符合评分上限规则的理由
- 两行总体评估
结尾:
Code Review: ApprovedRejected / Blocked
已拒绝(Rejected)/ 已阻塞(Blocked)
Executive Summary
执行摘要
- Score 1–10
- One sentence justifying score
- Two-line overall assessment
- 评分1–10
- 一句话说明评分理由
- 两行总体评估
Fix map (agent)
修复映射(供代理使用)
Follow — actionable correction rows only.
Omit positive findings, suggestions-only noise, history, long prose.
references/review-fix-map.template.mdThen: or
Code Review: RejectedCode Review: Blocked遵循——仅包含可操作的修正条目。
省略正面结论、仅建议的内容、历史记录及冗长描述。
references/review-fix-map.template.md结尾:或
Code Review: RejectedCode Review: BlockedConstraints
约束条件
- Read-only. No edit/create/delete product files — including
code-review-report.md - Not substitutable. Workflow callers must invoke this skill by name; platform review subagents not equivalent unless human explicitly requests them this run
- Direct, constructive; no personal criticism
- No rewrite unrelated code
- Findings from actual diff + rules read
- Match project conventions visible in codebase
- Fix map audience = another agent, not human
- 只读模式。不得编辑/创建/删除产品文件——包括
code-review-report.md - 不可替代。工作流调用方必须按名称调用此技能;除非本次运行中用户明确要求,否则平台评审子代理无法替代此技能
- 直接、具建设性;不得进行人身攻击
- 不得重写无关代码
- 结论需基于实际差异及已读取的规则
- 匹配代码库中可见的项目约定
- 修复映射的受众为其他代理,而非人类
References
参考文档
| File | When |
|---|---|
| Rejected/Blocked response body |
| Artifact paths |
| Posting internal review comments |
| 文件 | 使用场景 |
|---|---|
| 已拒绝/已阻塞时的回复内容 |
| 工件路径 |
| 发布内部评审评论 |