mcpField
S
sherlock-review

sherlock-review

github.com/proffesor-for-testing测试与质量519128 次安装今天更新
代码仓库

关于 sherlock-review

通过可复现证据调查代码相关声明的技能。它帮助审查者对照代码、测试、运行行为和历史记录,给出有依据的结论并记录发现。

主要功能

  1. 01收集代码、测试和历史证据
  2. 02复现所报告的行为
  3. 03对照声明与实际结果
  4. 04给出基于证据的判定
  5. 05记录调查发现

适用场景

  1. 01核实已修复缺陷的声明
  2. 02评估性能提升声明
  3. 03检查边界情况覆盖声明

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill sherlock-review

安装后在 Claude Code 中输入/sherlock-review确认已加载。

附带文件schemas/output.jsonscripts/validate-config.json

详细介绍

Sherlock 审查

<default_to_action> 调查代码相关主张时:

  1. 观察:收集所有证据(代码、测试、历史记录、行为)
  2. 推断:证据实际说明了什么,与主张有何出入?
  3. 排除:排除不可能的情况
  4. 下结论:证据是否支持该主张?
  5. 记录:用证据证明发现,而非凭空假设

三步调查法:

# 1. OBSERVE: Gather evidence
git diff <commit>
npm test -- --coverage

# 2. DEDUCE: Compare claim vs reality
# Does code match description?
# Do tests prove the fix/feature?

# 3. CONCLUDE: Verdict with evidence
# SUPPORTED / PARTIALLY SUPPORTED / NOT SUPPORTED

福尔摩斯原则:

  • “数据!数据!数据!”——先收集,再下结论
  • “排除不可能的情况”——什么是不可能的?
  • “你看见了,却没有观察”——运行代码,而不只是阅读
  • 只相信可复现的证据 </default_to_action>

快速参考卡

证据收集清单
类别检查内容方法
主张PR 描述、提交消息仔细阅读
代码实际文件变更git diff
测试覆盖率、断言独立运行
行为运行时输出在本地执行
时间线事件发生时间git log、git blame
判定等级
判定含义
✓ 属实证据完全支持该主张
⚠ 部分属实主张准确但不完整
✗ 不属实证据与该主张矛盾
? 不合逻辑该主张不适用于当前情境

调查模板

## Sherlock Investigation: [Claim]

### The Claim
"[What PR/commit claims to do]"

### Evidence Examined
- Code changes: [files, lines]
- Tests added: [count, coverage]
- Behavior observed: [what actually happens]

### Deductive Analysis

**Claim**: [specific assertion]
**Evidence**: [what you found]
**Deduction**: [logical conclusion]
**Verdict**: ✓/⚠/✗

### Findings
- What works: [with evidence]
- What doesn't: [with evidence]
- What's missing: [gaps in implementation/testing]

### Recommendations
1. [Action based on findings]

最低发现数量要求

每次调查都 MUST 至少提出 3 条加权观察结果(CRITICAL=3、HIGH=2、MEDIUM=1、LOW=0.5)。基础观察结果按 INFORMATIONAL=0.25 的权重计入。没有任何发现的 Sherlock 调查就是失败的调查——福尔摩斯总能发现线索。


调查场景

场景 1:“这修复了 Bug”

步骤:

  1. 在修复前的提交上复现 Bug
  2. 在包含修复的提交上确认 Bug 已消失
  3. 检查修复解决的是根本原因还是表面症状
  4. 测试原始报告中未提及的边界情况

警示信号:

  • 仅移除错误日志的修复
  • 仅对特定测试用例有效
  • 用变通方案代替修复根本原因
  • 未添加回归测试
场景 2:“性能提升了 50%”

步骤:

  1. 在基线提交上运行基准测试
  2. 在优化后的提交上运行相同的基准测试
  3. 在相同条件下进行比较
  4. 验证测量方法

警示信号:

  • 只在玩具数据上测试
  • 对比条件不同
  • 未提及权衡取舍
场景 3:“处理所有边界情况”

步骤:

  1. 列出代码路径中的所有边界情况
  2. 检查每种情况是否都有测试覆盖
  3. 测试边界条件
  4. 验证错误处理路径

警示信号:

  • catch {} 吞掉错误
  • 通用错误消息
  • 未记录关键错误

调查示例

## Case: PR #123 "Fix race condition in async handler"

### Claims Examined:
1. "Eliminates race condition"
2. "Adds mutex locking"
3. "100% thread safe"

### Evidence:
- File: src/handlers/async-handler.js
- Changes: Added `async/await`, removed callbacks
- Tests: 2 new tests for async flow
- Coverage: 85% (was 75%)

### Analysis:

**Claim 1: "Eliminates race condition"**
Evidence: Added `await` to sequential operations. No actual mutex.
Deduction: Race avoided by removing concurrency, not synchronization.
Verdict: ⚠ PARTIALLY TRUE (solved differently than claimed)

**Claim 2: "Adds mutex locking"**
Evidence: No mutex library, no lock variables, no sync primitives.
Verdict: ✗ FALSE

**Claim 3: "100% thread safe"**
Evidence: JavaScript is single-threaded. No worker threads used.
Verdict: ? NONSENSICAL (meaningless in this context)

### Conclusion:
Fix works but not for reasons claimed. Race condition avoided by
making operations sequential, not by adding synchronization.

### Recommendations:
1. Update PR description to accurately reflect solution
2. Add test for concurrent request handling
3. Remove incorrect technical claims

Agent 集成

// Evidence-based code review
await Task("Sherlock Review", {
  prNumber: 123,
  claims: [
    "Fixes memory leak",
    "Improves performance 30%"
  ],
  verifyReproduction: true,
  testEdgeCases: true
}, "qe-code-reviewer");

// Bug fix verification
await Task("Verify Fix", {
  bugCommit: 'abc123',
  fixCommit: 'def456',
  reproductionSteps: steps,
  testBoundaryConditions: true
}, "qe-code-reviewer");

Agent 协作提示

记忆命名空间
aqe/sherlock/
├── investigations/*   - Investigation reports
├── evidence/*         - Collected evidence
├── verdicts/*         - Claim verdicts
└── patterns/*         - Common deception patterns
Fleet 协作
const investigationFleet = await FleetManager.coordinate({
  strategy: 'evidence-investigation',
  agents: [
    'qe-code-reviewer',        // Code analysis
    'qe-security-auditor',     // Security claim verification
    'qe-performance-validator' // Performance claim verification
  ],
  topology: 'parallel'
});

相关技能


请牢记

“没有数据就进行理论推演,是严重的错误。” 只相信可复现的证据。不要相信提交消息、文档或“在我的机器上能运行”。

Sherlock 标准: 每项主张都必须通过实证验证。证据实际说明了什么?

评论

支持 Markdown