关于 sherlock-review
通过可复现证据调查代码相关声明的技能。它帮助审查者对照代码、测试、运行行为和历史记录,给出有依据的结论并记录发现。
主要功能
- 01收集代码、测试和历史证据
- 02复现所报告的行为
- 03对照声明与实际结果
- 04给出基于证据的判定
- 05记录调查发现
适用场景
- 01核实已修复缺陷的声明
- 02评估性能提升声明
- 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. 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”
步骤:
- 在修复前的提交上复现 Bug
- 在包含修复的提交上确认 Bug 已消失
- 检查修复解决的是根本原因还是表面症状
- 测试原始报告中未提及的边界情况
警示信号:
- 仅移除错误日志的修复
- 仅对特定测试用例有效
- 用变通方案代替修复根本原因
- 未添加回归测试
场景 2:“性能提升了 50%”
步骤:
- 在基线提交上运行基准测试
- 在优化后的提交上运行相同的基准测试
- 在相同条件下进行比较
- 验证测量方法
警示信号:
- 只在玩具数据上测试
- 对比条件不同
- 未提及权衡取舍
场景 3:“处理所有边界情况”
步骤:
- 列出代码路径中的所有边界情况
- 检查每种情况是否都有测试覆盖
- 测试边界条件
- 验证错误处理路径
警示信号:
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'
});
相关技能
- brutal-honesty-review - 直接的技术批评
- context-driven-testing - 根据情境调整
- bug-reporting-excellence - 记录发现
请牢记
“没有数据就进行理论推演,是严重的错误。” 只相信可复现的证据。不要相信提交消息、文档或“在我的机器上能运行”。
Sherlock 标准: 每项主张都必须通过实证验证。证据实际说明了什么?
评论
支持 Markdown