doc-brd-reviewer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedoc-brd-reviewer
doc-brd-reviewer
Purpose
用途
Comprehensive content review and quality assurance for Business Requirements Documents (BRD). This skill performs deep content analysis beyond structural validation, checking link integrity, requirement completeness, ADR topic coverage, strategic alignment, and identifying issues that require manual business review.
Layer: 1 (BRD Quality Assurance)
Upstream: Strategy documents, stakeholder requirements
Downstream: None (final QA gate before PRD generation)
针对业务需求文档(BRD)的全面内容审核与质量保证。该技能会在结构验证之外进行深度内容分析,检查链接完整性、需求完备性、ADR主题覆盖度、战略一致性,并识别需要业务人员人工审核的问题。
层级: 1(BRD质量保证)
上游依赖: 战略文档、干系人需求
下游输出: 无(生成PRD前的最终QA关卡)
When to Use This Skill
何时使用该技能
Use when:
doc-brd-reviewer- After BRD Generation: Run immediately after completes
doc-brd-autopilot - Manual BRD Edits: After making manual changes to a BRD
- Pre-PRD Check: Before running
doc-prd-autopilot - Periodic Review: Regular quality checks on existing BRDs
- CI/CD Integration: Automated review gate in documentation pipelines
Do NOT use when:
- BRD does not exist yet (use or
doc-brdfirst)doc-brd-autopilot - Need structural/schema validation only (use )
doc-brd-validator - Generating new BRD content (use )
doc-brd
在以下场景使用:
doc-brd-reviewer- BRD生成后: 在完成后立即运行
doc-brd-autopilot - BRD手动编辑后: 对BRD进行手动修改后
- PRD生成前检查: 在运行之前
doc-prd-autopilot - 定期审核: 对现有BRD进行常规质量检查
- CI/CD集成: 在文档流水线中设置自动化审核关卡
请勿在以下场景使用:
- BRD尚未生成(请先使用或
doc-brd)doc-brd-autopilot - 仅需结构/ schema验证(请使用)
doc-brd-validator - 生成新的BRD内容(请使用)
doc-brd
Skill vs Validator: Key Differences
技能与验证工具的核心差异
| Aspect | | |
|---|---|---|
| Focus | Schema compliance, PRD-Ready score | Content quality, strategic alignment |
| Checks | Required sections, field formats | Link integrity, ADR completeness, placeholders |
| Auto-Fix | Structural issues only | Content issues (links, dates, placeholders) |
| Output | PRD-Ready score (numeric) | Review score + issue list |
| Phase | Phase 4 (Validation) | Phase 5 (Final Review) |
| Blocking | PRD-Ready < threshold blocks | Review score < threshold flags |
| 维度 | | |
|---|---|---|
| 核心关注点 | Schema合规性、PRD就绪评分 | 内容质量、战略一致性 |
| 检查项 | 必填章节、字段格式 | 链接完整性、ADR完备性、占位符 |
| 自动修复 | 仅修复结构问题 | 修复内容问题(链接、日期、占位符) |
| 输出结果 | PRD就绪评分(数值型) | 审核评分+问题列表 |
| 所处阶段 | 第4阶段(验证) | 第5阶段(最终审核) |
| 阻塞规则 | PRD就绪评分低于阈值则阻塞 | 审核评分低于阈值则标记 |
Review Workflow
审核工作流
mermaid
flowchart TD
A[Input: BRD Path] --> B[Load BRD Files]
B --> C{Sectioned or Monolithic?}
C -->|Sectioned| D[Load All Section Files]
C -->|Monolithic| E[Load Single File]
D --> F0[Check #0: Structure Compliance]
E --> F0
F0 --> F0a{Nested Folder Valid?}
F0a -->|No| F0b[FAIL - BLOCKING]
F0a -->|Yes| F[Run Review Checks]
subgraph Review["Review Checks"]
F --> G[1. Link Integrity]
G --> H[2. Requirement Completeness]
H --> I[3. ADR Topic Coverage]
I --> J[4. Placeholder Detection]
J --> K[5. Traceability Tags]
K --> L[6. Section Completeness]
L --> M[7. Strategic Alignment]
M --> M2[8. Naming Compliance]
M2 --> M3[9. Upstream Drift Detection]
end
M3 --> N{Issues Found?}
N -->|Yes| O[Categorize Issues]
O --> P{Auto-Fixable?}
P -->|Yes| Q[Apply Auto-Fixes]
Q --> R[Re-run Affected Checks]
P -->|No| S[Flag for Manual Review]
R --> N
S --> T[Generate Report]
N -->|No| T
T --> U[Calculate Review Score]
U --> V{Score >= Threshold?}
V -->|Yes| W[PASS]
V -->|No| X[FAIL with Details]mermaid
flowchart TD
A[输入: BRD路径] --> B[加载BRD文件]
B --> C{分段式还是单体式?}
C -->|分段式| D[加载所有章节文件]
C -->|单体式| E[加载单个文件]
D --> F0[检查#0: 结构合规性]
E --> F0
F0 --> F0a{嵌套文件夹是否有效?}
F0a -->|否| F0b[失败 - 阻塞]
F0a -->|是| F[执行审核检查]
subgraph Review["审核检查"]
F --> G[1. 链接完整性]
G --> H[2. 需求完备性]
H --> I[3. ADR主题覆盖度]
I --> J[4. 占位符检测]
J --> K[5. 可追溯性标签]
K --> L[6. 章节完备性]
L --> M[7. 战略一致性]
M --> M2[8. 命名合规性]
M2 --> M3[9. 上游漂移检测]
end
M3 --> N{是否发现问题?}
N -->|是| O[问题分类]
O --> P{是否可自动修复?}
P -->|是| Q[执行自动修复]
Q --> R[重新运行受影响的检查]
P -->|否| S[标记为需要人工审核]
R --> N
S --> T[生成报告]
N -->|否| T
T --> U[计算审核评分]
U --> V{评分 >= 阈值?}
V -->|是| W[通过]
V -->|否| X[失败并显示详情]Review Checks
审核检查项
0. Structure Compliance (BLOCKING)
0. 结构合规性(阻塞项)
Validates BRD follows the mandatory nested folder rule.
Nested Folder Rule: ALL BRDs MUST be in nested folders regardless of size.
Required Structure:
| BRD Type | Required Location |
|---|---|
| Monolithic | |
| Sectioned | |
Validation:
1. Check document is inside a nested folder: docs/01_BRD/BRD-NN_{slug}/
2. Verify folder name matches BRD ID pattern: BRD-NN_{slug}
3. Verify file name matches folder: BRD-NN_{slug}.md or BRD-NN.N_*.md
4. Parent path must be: docs/01_BRD/Example Valid Structure:
docs/01_BRD/
├── BRD-01_f1_iam/
│ ├── BRD-01_f1_iam.md ✓ Valid (monolithic)
│ ├── BRD-01.R_review_report_v001.md
│ └── .drift_cache.json
├── BRD-02_f2_session/
│ ├── BRD-02.0_index.md ✓ Valid (sectioned)
│ ├── BRD-02.1_core.md
│ └── BRD-02.2_requirements.mdInvalid Structure:
docs/01_BRD/
├── BRD-01_f1_iam.md ✗ NOT in nested folderAuto-Fix:
- Create the nested folder
docs/01_BRD/BRD-NN_{slug}/ - Move the BRD file(s) into the folder
- Update all internal links (navigation, cross-references)
- Update any downstream PRD links to correct path
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-STR001 | Error | BRD not in nested folder (blocking) |
| REV-STR002 | Error | BRD folder name doesn't match BRD ID |
| REV-STR003 | Warning | Monolithic BRD should be sectioned (>25KB) |
This check is BLOCKING - BRD must pass structure validation before other checks proceed.
验证BRD是否遵循强制嵌套文件夹规则。
嵌套文件夹规则: 所有BRD无论大小,都必须存放在嵌套文件夹中。
必填结构:
| BRD类型 | 必填存放位置 |
|---|---|
| 单体式 | |
| 分段式 | |
验证逻辑:
1. 检查文档是否位于嵌套文件夹内: docs/01_BRD/BRD-NN_{slug}/
2. 验证文件夹名称是否匹配BRD ID格式: BRD-NN_{slug}
3. 验证文件名是否与文件夹匹配: BRD-NN_{slug}.md 或 BRD-NN.N_*.md
4. 父路径必须为: docs/01_BRD/有效结构示例:
docs/01_BRD/
├── BRD-01_f1_iam/
│ ├── BRD-01_f1_iam.md ✓ 有效(单体式)
│ ├── BRD-01.R_review_report_v001.md
│ └── .drift_cache.json
├── BRD-02_f2_session/
│ ├── BRD-02.0_index.md ✓ 有效(分段式)
│ ├── BRD-02.1_core.md
│ └── BRD-02.2_requirements.md无效结构:
docs/01_BRD/
├── BRD-01_f1_iam.md ✗ 未存放在嵌套文件夹中自动修复:
- 创建嵌套文件夹
docs/01_BRD/BRD-NN_{slug}/ - 将BRD文件移动到该文件夹中
- 更新所有内部链接(导航、交叉引用)
- 更新下游PRD指向正确路径的链接
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-STR001 | 错误 | BRD未存放在嵌套文件夹中(阻塞项) |
| REV-STR002 | 错误 | BRD文件夹名称与BRD ID不匹配 |
| REV-STR003 | 警告 | 单体式BRD应拆分为分段式(文件大小>25KB) |
该检查为阻塞项 - BRD必须通过结构验证才能进行后续检查。
1. Link Integrity
1. 链接完整性
Validates all internal document links resolve correctly.
Scope:
- Navigation links (,
[Previous: ...])[Next: ...] - Section cross-references ()
[See Section 7.2](...) - Index to section links
- External documentation links (warns if unreachable)
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-L001 | Error | Broken internal link |
| REV-L002 | Warning | External link unreachable |
| REV-L003 | Info | Link path uses absolute instead of relative |
验证所有内部文档链接均可正确解析。
检查范围:
- 导航链接 (,
[Previous: ...])[Next: ...] - 章节交叉引用 ()
[See Section 7.2](...) - 索引到章节的链接
- 外部文档链接(如果无法访问则发出警告)
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-L001 | 错误 | 内部链接失效 |
| REV-L002 | 警告 | 外部链接无法访问 |
| REV-L003 | 信息 | 链接路径使用绝对路径而非相对路径 |
2. Requirement Completeness
2. 需求完备性
Validates all business requirements have complete specifications.
Scope:
- Each requirement has acceptance criteria
- Success metrics defined
- Scope boundaries clear (in/out)
- Priority assignments present
- Dependencies documented
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-R001 | Error | Requirement missing acceptance criteria |
| REV-R002 | Error | No success metrics defined |
| REV-R003 | Warning | Scope boundaries unclear |
| REV-R004 | Warning | Missing priority assignment |
| REV-R005 | Info | Dependency not documented |
验证所有业务需求均具备完整的规范说明。
检查范围:
- 每个需求都有验收标准
- 定义了成功指标
- 范围边界清晰(包含/排除)
- 已分配优先级
- 记录了依赖关系
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-R001 | 错误 | 需求缺少验收标准 |
| REV-R002 | 错误 | 未定义成功指标 |
| REV-R003 | 警告 | 范围边界不清晰 |
| REV-R004 | 警告 | 缺少优先级分配 |
| REV-R005 | 信息 | 未记录依赖关系 |
3. ADR Topic Coverage
3. ADR主题覆盖度
Validates Section 7.2 ADR Topics have complete coverage.
Scope:
- All 7 mandatory categories present (Infrastructure, Data Architecture, Integration, Security, Observability, AI/ML, Technology Selection)
- Each topic has Status, Alternatives Overview, Decision Drivers
- Selected topics have Cloud Provider Comparison table
- Deferred topics have justification
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-ADR001 | Error | Mandatory ADR category missing |
| REV-ADR002 | Error | Topic missing Alternatives Overview |
| REV-ADR003 | Error | Selected topic missing comparison table |
| REV-ADR004 | Warning | Topic missing Decision Drivers |
| REV-ADR005 | Info | Deferred topic needs justification |
验证第7.2节ADR主题的覆盖完整性。
检查范围:
- 包含全部7个必填类别(基础设施、数据架构、集成、安全、可观测性、AI/ML、技术选型)
- 每个主题都有状态、备选方案概述、决策驱动因素
- 选定的主题包含云服务商对比表
- 延迟处理的主题有理由说明
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-ADR001 | 错误 | 缺少必填ADR类别 |
| REV-ADR002 | 错误 | 主题缺少备选方案概述 |
| REV-ADR003 | 错误 | 选定主题缺少对比表 |
| REV-ADR004 | 警告 | 主题缺少决策驱动因素 |
| REV-ADR005 | 信息 | 延迟处理的主题需要理由说明 |
4. Placeholder Detection
4. 占位符检测
Identifies incomplete content requiring replacement.
Scope:
- ,
[TODO],[TBD]text[PLACEHOLDER] - Template dates: ,
YYYY-MM-DDTHH:MM:SSMM/DD/YYYY - Template names: ,
[Name],[Author][Reviewer] - Empty sections:
<!-- Content here --> - Lorem ipsum or sample text
Auto-Fix:
- Replace with current datetime
YYYY-MM-DDTHH:MM:SS - Replace with document author from metadata
[Name] - Remove empty comment placeholders
- Flag /
[TODO]for manual completion[TBD]
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-P001 | Error | [TODO] placeholder found |
| REV-P002 | Error | [TBD] placeholder found |
| REV-P003 | Warning | Template date not replaced |
| REV-P004 | Warning | Template name not replaced |
| REV-P005 | Warning | Empty section content |
识别需要替换的不完整内容。
检查范围:
- ,
[TODO],[TBD]文本[PLACEHOLDER] - 模板日期: ,
YYYY-MM-DDTHH:MM:SSMM/DD/YYYY - 模板名称: ,
[Name],[Author][Reviewer] - 空章节:
<!-- Content here --> - 占位文本(如Lorem ipsum)
自动修复:
- 将 替换为当前时间
YYYY-MM-DDTHH:MM:SS - 将 替换为元数据中的文档作者
[Name] - 移除空的注释占位符
- 标记 /
[TODO]以便人工补全[TBD]
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-P001 | 错误 | 发现[TODO]占位符 |
| REV-P002 | 错误 | 发现[TBD]占位符 |
| REV-P003 | 警告 | 模板日期未替换 |
| REV-P004 | 警告 | 模板名称未替换 |
| REV-P005 | 警告 | 章节内容为空 |
5. Traceability Tags
5. 可追溯性标签
Validates and cross-reference tags.
@strategy:Scope:
- tags reference valid source documents
@strategy: DOC-XX - Element IDs properly formatted
- Cross-references consistent
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-TR001 | Error | Invalid strategy reference |
| REV-TR002 | Warning | Missing element ID |
| REV-TR003 | Info | Inconsistent cross-reference format |
| REV-TR004 | Warning | Tag format malformed |
验证和交叉引用标签。
@strategy:检查范围:
- 标签引用有效的源文档
@strategy: DOC-XX - 元素ID格式正确
- 交叉引用保持一致
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-TR001 | 错误 | 无效的战略引用 |
| REV-TR002 | 警告 | 缺少元素ID |
| REV-TR003 | 信息 | 交叉引用格式不一致 |
| REV-TR004 | 警告 | 标签格式错误 |
6. Section Completeness
6. 章节完备性
Verifies all required sections have substantive content.
Scope:
- Minimum word count per section (configurable)
- Section headers present
- Tables have data rows (not just headers)
- Mermaid diagrams render properly
Minimum Word Counts (configurable):
| Section | Minimum Words |
|---|---|
| Executive Summary | 100 |
| Problem Statement | 75 |
| Business Objectives | 150 |
| Functional Requirements | 200 |
| Non-Functional Requirements | 150 |
| ADR Topics | 300 |
| Appendices | 100 |
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-S001 | Error | Required section missing entirely |
| REV-S002 | Warning | Section below minimum word count |
| REV-S003 | Warning | Table has no data rows |
| REV-S004 | Error | Mermaid diagram syntax error |
验证所有必填章节都有实质性内容。
检查范围:
- 每个章节的最低字数要求(可配置)
- 章节标题存在
- 表格包含数据行(而非仅表头)
- Mermaid图表可正常渲染
最低字数要求(可配置):
| 章节 | 最低字数 |
|---|---|
| 执行摘要 | 100 |
| 问题陈述 | 75 |
| 业务目标 | 150 |
| 功能需求 | 200 |
| 非功能需求 | 150 |
| ADR主题 | 300 |
| 附录 | 100 |
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-S001 | 错误 | 缺少必填章节 |
| REV-S002 | 警告 | 章节字数未达最低要求 |
| REV-S003 | 警告 | 表格无数据行 |
| REV-S004 | 错误 | Mermaid图表语法错误 |
7. Strategic Alignment
7. 战略一致性
Validates BRD aligns with business strategy and objectives.
Scope:
- Business objectives trace to strategic goals
- Success metrics align with KPIs
- Scope matches project charter
- Stakeholder concerns addressed
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-SA001 | Warning | Business objective not traced to strategy |
| REV-SA002 | Info | Success metric may not align with KPI |
| REV-SA003 | Warning | Scope may exceed project charter |
| REV-SA004 | Flag | Requires stakeholder review |
验证BRD与业务战略和目标保持一致。
检查范围:
- 业务目标可追溯到战略目标
- 成功指标与KPI保持一致
- 范围与项目章程匹配
- 干系人关注点已得到解决
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-SA001 | 警告 | 业务目标无法追溯到战略 |
| REV-SA002 | 信息 | 成功指标可能与KPI不一致 |
| REV-SA003 | 警告 | 范围可能超出项目章程 |
| REV-SA004 | 标记 | 需要干系人审核 |
8. Naming Compliance
8. 命名合规性
Validates element IDs follow standards.
doc-namingScope:
- Element IDs use format
BRD.NN.TT.SS - Element type codes valid for BRD (01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 22, 23, 24, 32, 33)
- No legacy patterns (BO-NNN, FR-NNN, etc.)
Auto-Fix:
- Convert legacy patterns to unified format
- Suggest correct element type codes
Error Codes:
| Code | Severity | Description |
|---|---|---|
| REV-N001 | Error | Invalid element ID format |
| REV-N002 | Error | Element type code not valid for BRD |
| REV-N003 | Error | Legacy pattern detected |
| REV-N004 | Warning | Inconsistent ID sequencing |
验证元素ID遵循标准。
doc-naming检查范围:
- 元素ID使用格式
BRD.NN.TT.SS - 元素类型代码对BRD有效(01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 22, 23, 24, 32, 33)
- 无遗留格式(如BO-NNN, FR-NNN等)
自动修复:
- 将遗留格式转换为统一格式
- 建议正确的元素类型代码
错误代码:
| 代码 | 严重程度 | 描述 |
|---|---|---|
| REV-N001 | 错误 | 无效的元素ID格式 |
| REV-N002 | 错误 | 元素类型代码对BRD无效 |
| REV-N003 | 错误 | 检测到遗留格式 |
| REV-N004 | 警告 | ID编号序列不一致 |
9. Upstream Drift Detection (Mandatory Cache)
9. 上游漂移检测(强制缓存)
Detects when upstream source documents have been modified after the BRD was created or last updated. The drift cache is mandatory - the reviewer MUST create/update it after each review.
Purpose: Identifies stale BRD content that may not reflect current source documentation. When upstream documents (strategy specs, technical specifications, stakeholder inputs) change, the BRD may need updates to maintain alignment.
Scope:
- tag targets (technical specifications, strategy documents)
@ref: - tag references
@strategy: - Traceability section upstream artifact links
- GAP analysis document references
- Any markdown links to or source documents
../00_REF/
检测上游源文档在BRD创建或最后更新后是否被修改。漂移缓存是强制要求 - 审核工具必须在每次审核后创建/更新缓存。
目的: 识别可能未反映当前源文档的过时BRD内容。当上游文档(战略规范、技术规范、干系人输入)发生变化时,BRD可能需要更新以保持一致性。
检查范围:
- 标签目标(技术规范、战略文档)
@ref: - 标签引用
@strategy: - 可追溯性章节中的上游工件链接
- GAP分析文档引用
- 任何指向或源文档的Markdown链接
../00_REF/
9.1 Drift Cache File (MANDATORY)
9.1 漂移缓存文件(强制)
Location:
docs/01_BRD/{BRD_folder}/.drift_cache.jsonIMPORTANT: The reviewer MUST:
- Read the cache if it exists (for hash comparison)
- Create the cache if it doesn't exist
- Update the cache after every review with current hashes
Cache Schema:
json
{
"schema_version": "1.0",
"document_id": "BRD-01",
"document_version": "1.0",
"last_reviewed": "2026-02-10T17:00:00",
"reviewer_version": "1.4",
"upstream_documents": {
"../../00_REF/foundation/F1_IAM_Technical_Specification.md": {
"hash": "sha256:a1b2c3d4e5f6g7h8i9j0...",
"last_modified": "2026-02-10T15:34:26",
"file_size": 50781,
"version": "1.0",
"sections_tracked": ["#3-authentication", "#4-authorization", "#5-user-profile"]
},
"../../00_REF/foundation/GAP_Foundation_Module_Gap_Analysis.md": {
"hash": "sha256:k1l2m3n4o5p6q7r8s9t0...",
"last_modified": "2026-02-10T15:34:21",
"file_size": 4730,
"version": "1.0",
"sections_tracked": ["#f1-iam-gaps"]
}
},
"review_history": [
{
"date": "2026-02-10T16:30:00",
"score": 97,
"drift_detected": false,
"report_version": "v002"
}
]
}存放位置:
docs/01_BRD/{BRD_folder}/.drift_cache.json重要提示: 审核工具必须:
- 读取已存在的缓存(用于哈希比较)
- 创建不存在的缓存
- 更新缓存,每次审核后保存当前哈希值
缓存Schema:
json
{
"schema_version": "1.0",
"document_id": "BRD-01",
"document_version": "1.0",
"last_reviewed": "2026-02-10T17:00:00",
"reviewer_version": "1.4",
"upstream_documents": {
"../../00_REF/foundation/F1_IAM_Technical_Specification.md": {
"hash": "sha256:a1b2c3d4e5f6g7h8i9j0...",
"last_modified": "2026-02-10T15:34:26",
"file_size": 50781,
"version": "1.0",
"sections_tracked": ["#3-authentication", "#4-authorization", "#5-user-profile"]
},
"../../00_REF/foundation/GAP_Foundation_Module_Gap_Analysis.md": {
"hash": "sha256:k1l2m3n4o5p6q7r8s9t0...",
"last_modified": "2026-02-10T15:34:21",
"file_size": 4730,
"version": "1.0",
"sections_tracked": ["#f1-iam-gaps"]
}
},
"review_history": [
{
"date": "2026-02-10T16:30:00",
"score": 97,
"drift_detected": false,
"report_version": "v002"
}
]
}9.2 Detection Algorithm (Three-Phase)
9.2 检测算法(三阶段)
PHASE 1: Load Cache (if exists)
=========================================
1. Check for .drift_cache.json in BRD folder
2. If exists:
- Load cached hashes and metadata
- Set detection_mode = "hash_comparison"
3. If not exists:
- Set detection_mode = "timestamp_only"
- Will create cache at end of review
PHASE 2: Detect Drift
=========================================
For each upstream reference in BRD:
A. Extract reference:
- @ref: tags → [path, section anchor]
- @strategy: tags → [document ID]
- Links to ../00_REF/ → [path]
- Traceability table upstream artifacts → [path]
B. Resolve and validate:
- Resolve path to absolute file path
- Check file exists (skip if covered by Check #1)
- Get file stats: mtime, size
C. Compare (based on detection_mode):
IF detection_mode == "hash_comparison":
- Compute SHA-256 hash of current file content
- Compare to cached hash
- IF hash differs:
- Calculate change_percentage
- Flag as CONTENT_DRIFT (REV-D002)
- IF change > 20%: Flag as CRITICAL (REV-D005)
ELSE (timestamp_only):
- Compare file mtime > BRD last_updated
- IF mtime > BRD date:
- Flag as TIMESTAMP_DRIFT (REV-D001)
D. Check version field (if YAML frontmatter):
- Extract version from upstream doc
- Compare to cached version
- IF version incremented: Flag REV-D003
PHASE 3: Update Cache (MANDATORY)
=========================================
1. Compute SHA-256 hash for ALL upstream documents
2. Create/update .drift_cache.json with:
- Current hashes
- Current timestamps
- Current file sizes
- Review metadata
3. Append to review_history arrayPHASE 1: 加载缓存(如果存在)
=========================================
1. 检查BRD文件夹中是否存在.drift_cache.json
2. 如果存在:
- 加载缓存的哈希值和元数据
- 设置detection_mode = "hash_comparison"
3. 如果不存在:
- 设置detection_mode = "timestamp_only"
- 审核结束时将创建缓存
PHASE 2: 检测漂移
=========================================
针对BRD中的每个上游引用:
A. 提取引用:
- @ref: 标签 → [路径, 章节锚点]
- @strategy: 标签 → [文档ID]
- 指向../00_REF/的链接 → [路径]
- 可追溯性表格中的上游工件 → [路径]
B. 解析并验证:
- 将路径解析为绝对文件路径
- 检查文件是否存在(如果已被检查#1覆盖则跳过)
- 获取文件状态: 修改时间、大小
C. 比较(基于detection_mode):
如果detection_mode == "hash_comparison":
- 计算当前文件内容的SHA-256哈希值
- 与缓存的哈希值比较
- 如果哈希值不同:
- 计算change_percentage
- 标记为CONTENT_DRIFT(REV-D002)
- 如果变化>20%: 标记为CRITICAL(REV-D005)
否则(timestamp_only):
- 比较文件修改时间 > BRD最后更新时间
- 如果修改时间晚于BRD更新时间:
- 标记为TIMESTAMP_DRIFT(REV-D001)
D. 检查版本字段(如果有YAML前置元数据):
- 从上游文档提取版本
- 与缓存的版本比较
- 如果版本已升级: 标记REV-D003
PHASE 3: 更新缓存(强制)
=========================================
1. 计算所有上游文档的SHA-256哈希值
2. 创建/更新.drift_cache.json,包含:
- 当前哈希值
- 当前时间戳
- 当前文件大小
- 审核元数据
3. 将记录追加到review_history数组9.3 Hash Calculation
9.3 哈希计算
python
import hashlib
from pathlib import Path
def compute_file_hash(file_path: str) -> str:
"""Compute SHA-256 hash of file content."""
sha256 = hashlib.sha256()
with open(file_path, 'rb') as f:
for chunk in iter(lambda: f.read(8192), b''):
sha256.update(chunk)
return f"sha256:{sha256.hexdigest()}"
def compute_section_hash(file_path: str, section_anchor: str) -> str:
"""Compute hash of specific section (for anchor references)."""
content = Path(file_path).read_text()
# Extract section from anchor to next heading
section_pattern = f"#{section_anchor.lstrip('#')}"
# ... section extraction logic ...
section_content = extract_section(content, section_pattern)
return f"sha256:{hashlib.sha256(section_content.encode()).hexdigest()}"
def calculate_change_percentage(old_hash: str, new_content: str) -> float:
"""Estimate change percentage using content diff."""
# Use difflib to calculate similarity ratio
import difflib
# ... comparison logic ...
return change_percentagepython
import hashlib
from pathlib import Path
def compute_file_hash(file_path: str) -> str:
"""计算文件内容的SHA-256哈希值。"""
sha256 = hashlib.sha256()
with open(file_path, 'rb') as f:
for chunk in iter(lambda: f.read(8192), b''):
sha256.update(chunk)
return f"sha256:{sha256.hexdigest()}"
def compute_section_hash(file_path: str, section_anchor: str) -> str:
"""计算特定章节的哈希值(针对锚点引用)。"""
content = Path(file_path).read_text()
# 从锚点提取章节到下一个标题
section_pattern = f"#{section_anchor.lstrip('#')}"
# ... 章节提取逻辑 ...
section_content = extract_section(content, section_pattern)
return f"sha256:{hashlib.sha256(section_content.encode()).hexdigest()}"
def calculate_change_percentage(old_hash: str, new_content: str) -> float:
"""使用内容差异估算变化百分比。"""
# 使用difflib计算相似度
import difflib
# ... 比较逻辑 ...
return change_percentage9.4 Error Codes
9.4 错误代码
| Code | Severity | Description | Trigger |
|---|---|---|---|
| REV-D001 | Warning | Upstream document modified after BRD creation | mtime > BRD date (no cache) |
| REV-D002 | Warning | Referenced content has changed | hash mismatch (with cache) |
| REV-D003 | Info | Upstream document version incremented | version field changed |
| REV-D004 | Info | New content added to upstream | file size increased >10% |
| REV-D005 | Error | Critical modification (>20% change) | hash diff >20% |
| REV-D006 | Info | Cache created (first review) | no prior cache existed |
| 代码 | 严重程度 | 描述 | 触发条件 |
|---|---|---|---|
| REV-D001 | 警告 | 上游文档在BRD创建后被修改 | 修改时间晚于BRD日期(无缓存) |
| REV-D002 | 警告 | 引用的内容已更改 | 哈希值不匹配(有缓存) |
| REV-D003 | 信息 | 上游文档版本已升级 | 版本字段已更改 |
| REV-D004 | 信息 | 上游文档新增内容 | 文件大小增加>10% |
| REV-D005 | 错误 | 重大修改(>20%变化) | 哈希差异>20% |
| REV-D006 | 信息 | 已创建缓存(首次审核) | 之前无缓存 |
9.5 Report Output
9.5 报告输出
markdown
undefinedmarkdown
undefined9. Upstream Drift Detection (5/5)
9. 上游漂移检测(5/5)
Cache Status
缓存状态
| Field | Value |
|---|---|
| Cache File | |
| Cache Status | ✅ Updated |
| Detection Mode | Hash Comparison |
| Documents Tracked | 2 |
| 字段 | 值 |
|---|---|
| 缓存文件 | |
| 缓存状态 | ✅ 已更新 |
| 检测模式 | 哈希比较 |
| 跟踪的文档数 | 2 |
Upstream Document Analysis
上游文档分析
| Upstream Document | Hash Status | Last Modified | Change % | Status |
|---|---|---|---|---|
| F1_IAM_Technical_Specification.md | ✅ Match | 2026-02-10T15:34:26 | 0% | Current |
| GAP_Foundation_Module_Gap_Analysis.md | ✅ Match | 2026-02-10T15:34:21 | 0% | Current |
| 上游文档 | 哈希状态 | 最后修改时间 | 变化百分比 | 状态 |
|---|---|---|---|---|
| F1_IAM_Technical_Specification.md | ✅ 匹配 | 2026-02-10T15:34:26 | 0% | 当前 |
| GAP_Foundation_Module_Gap_Analysis.md | ✅ 匹配 | 2026-02-10T15:34:21 | 0% | 当前 |
Drift Summary
漂移摘要
| Status | Count | Details |
|---|---|---|
| ✅ Current | 2 | All upstream documents synchronized |
| ⚠️ Warning | 0 | No drift detected |
| ❌ Critical | 0 | No major changes |
Cache updated: 2026-02-10T17:00:00
---| 状态 | 数量 | 详情 |
|---|---|---|
| ✅ 当前 | 2 | 所有上游文档已同步 |
| ⚠️ 警告 | 0 | 未检测到漂移 |
| ❌ 严重 | 0 | 无重大变更 |
缓存已更新: 2026-02-10T17:00:00
---9.6 Configuration
9.6 配置项
| Setting | Default | Description |
|---|---|---|
| true | Mandatory - always create/update cache |
| 7 | Days before timestamp drift becomes Warning |
| 20 | Percentage change for critical drift |
| true | Track individual section hashes for anchored refs |
| 10 | Maximum review_history entries to retain |
| 设置项 | 默认值 | 描述 |
|---|---|---|
| true | 强制 - 始终创建/更新缓存 |
| 7 | 时间戳漂移变为警告的天数阈值 |
| 20 | 严重漂移的百分比变化阈值 |
| true | 跟踪锚点引用的单个章节哈希值 |
| 10 | 保留的review_history最大条目数 |
Review Score Calculation
审核评分计算
Scoring Formula:
| Category | Weight | Calculation |
|---|---|---|
| Structure Compliance | 12% | (nested_folder_valid ? 12 : 0) - BLOCKING |
| Link Integrity | 8% | (valid_links / total_links) × 8 |
| Requirement Completeness | 15% | (complete_reqs / total_reqs) × 15 |
| ADR Topic Coverage | 15% | (covered_topics / required_topics) × 15 |
| Placeholder Detection | 10% | (no_placeholders ? 10 : 10 - (count × 2)) |
| Traceability Tags | 10% | (valid_tags / total_tags) × 10 |
| Section Completeness | 12% | (complete_sections / total_sections) × 12 |
| Strategic Alignment | 5% | (aligned_objectives / total_objectives) × 5 |
| Naming Compliance | 8% | (valid_ids / total_ids) × 8 |
| Upstream Drift | 5% | (fresh_refs / total_refs) × 5 |
Total: Sum of all categories (max 100)
Note: Structure Compliance is a blocking check. If structure validation fails (REV-STR001), the review cannot pass regardless of other scores.
Thresholds:
- PASS: ≥ 90 (configurable)
- WARNING: 80-89
- FAIL: < 80
评分公式:
| 类别 | 权重 | 计算方式 |
|---|---|---|
| 结构合规性 | 12% | (嵌套文件夹有效 ? 12 : 0) - 阻塞项 |
| 链接完整性 | 8% | (有效链接数 / 总链接数) × 8 |
| 需求完备性 | 15% | (完备需求数 / 总需求数) × 15 |
| ADR主题覆盖度 | 15% | (覆盖主题数 / 必填主题数) × 15 |
| 占位符检测 | 10% | (无占位符 ? 10 : 10 - (数量 × 2)) |
| 可追溯性标签 | 10% | (有效标签数 / 总标签数) × 10 |
| 章节完备性 | 12% | (完备章节数 / 总章节数) × 12 |
| 战略一致性 | 5% | (一致目标数 / 总目标数) × 5 |
| 命名合规性 | 8% | (有效ID数 / 总ID数) × 8 |
| 上游漂移 | 5% | (最新引用数 / 总引用数) × 5 |
总分: 所有类别得分之和(最高100分)
注意: 结构合规性是阻塞项。如果结构验证失败(REV-STR001),无论其他得分如何,审核都无法通过。
阈值:
- 通过: ≥ 90(可配置)
- 警告: 80-89
- 失败: < 80
Command Usage
命令使用
Basic Usage
基础用法
bash
undefinedbash
undefinedReview specific BRD
审核指定BRD
/doc-brd-reviewer BRD-01
/doc-brd-reviewer BRD-01
Review BRD by path
通过路径审核BRD
/doc-brd-reviewer docs/01_BRD/BRD-01_platform/
/doc-brd-reviewer docs/01_BRD/BRD-01_platform/
Review all BRDs
审核所有BRD
/doc-brd-reviewer all
undefined/doc-brd-reviewer all
undefinedOptions
选项
| Option | Default | Description |
|---|---|---|
| 90 | Minimum passing review score |
| true | Apply automatic fixes |
| false | Disable auto-fix (report only) |
| all | Specific checks to run (comma-separated) |
| none | Checks to skip (comma-separated) |
| false | Detailed output per check |
| true | Generate markdown report |
| 选项 | 默认值 | 描述 |
|---|---|---|
| 90 | 审核通过的最低评分 |
| true | 执行自动修复 |
| false | 禁用自动修复(仅生成报告) |
| all | 要执行的特定检查(逗号分隔) |
| none | 要跳过的检查(逗号分隔) |
| false | 显示每个检查的详细输出 |
| true | 生成Markdown报告 |
Output Report
输出报告
Review reports are stored alongside the reviewed document per project standards.
Nested Folder Rule: ALL BRDs use nested folders () regardless of size. This ensures review reports, fix reports, and drift cache files are organized with their parent document.
BRD-NN_{slug}/File Naming:
BRD-NN.R_review_report_vNNN.mdLocation: Inside the BRD nested folder:
docs/01_BRD/BRD-NN_{slug}/审核报告将按照项目标准存储在被审核文档的同级目录。
嵌套文件夹规则: 所有BRD无论大小,都使用嵌套文件夹()。确保审核报告、修复报告和漂移缓存文件与父文档一起管理。
BRD-NN_{slug}/文件命名:
BRD-NN.R_review_report_vNNN.md存放位置: BRD嵌套文件夹内:
docs/01_BRD/BRD-NN_{slug}/Versioning Rules
版本规则
- First Review: Creates
BRD-NN.R_review_report_v001.md - Subsequent Reviews: Auto-increments version (v002, v003, etc.)
- Same-Day Reviews: Each review gets unique version number
Version Detection Algorithm:
1. Scan folder for pattern: BRD-NN.R_review_report_v*.md
2. Extract highest version number (N)
3. Create new file with version (N + 1)Example:
docs/01_BRD/BRD-03_f3_observability/
├── BRD-03.R_review_report_v001.md # First review
├── BRD-03.R_review_report_v002.md # After fixes
└── BRD-03.R_review_report_v003.md # Final review- 首次审核: 创建
BRD-NN.R_review_report_v001.md - 后续审核: 自动递增版本号(v002, v003等)
- 当日多次审核: 每次审核都使用唯一版本号
版本检测算法:
1. 扫描文件夹中匹配模式的文件: BRD-NN.R_review_report_v*.md
2. 提取最高版本号(N)
3. 创建新版本文件,版本号为(N + 1)示例:
docs/01_BRD/BRD-03_f3_observability/
├── BRD-03.R_review_report_v001.md # 首次审核
├── BRD-03.R_review_report_v002.md # 修复后
└── BRD-03.R_review_report_v003.md # 最终审核Delta Reporting
差异报告
When previous reviews exist, include score comparison:
markdown
undefined如果存在之前的审核记录,包含评分对比:
markdown
undefinedScore Comparison
评分对比
| Metric | Previous (v002) | Current (v003) | Delta |
|---|---|---|---|
| Overall Score | 85 | 94 | +9 |
| Errors | 3 | 0 | -3 |
| Warnings | 5 | 2 | -3 |
See `REVIEW_DOCUMENT_STANDARDS.md` for complete requirements.
---| 指标 | 上一版本(v002) | 当前版本(v003) | 变化值 |
|---|---|---|---|
| 总分 | 85 | 94 | +9 |
| 错误数 | 3 | 0 | -3 |
| 警告数 | 5 | 2 | -3 |
完整要求请参考`REVIEW_DOCUMENT_STANDARDS.md`。
---Integration with doc-brd-autopilot
与doc-brd-autopilot的集成
This skill is invoked during Phase 5 of :
doc-brd-autopilotmermaid
flowchart LR
A[Phase 4: Validation] --> B[Phase 5: Final Review]
B --> C{doc-brd-reviewer}
C --> D[Phase 6: Continue]该技能在的第5阶段被调用:
doc-brd-autopilotmermaid
flowchart LR
A[Phase 4: Validation] --> B[Phase 5: Final Review]
B --> C{doc-brd-reviewer}
C --> D[Phase 6: Continue]Related Skills
相关技能
| Skill | Relationship |
|---|---|
| Naming standards for Check #8 |
| Invokes this skill in Phase 5 |
| Structural validation (Phase 4) |
| Applies fixes based on review findings |
| BRD creation rules |
| Downstream consumer |
| 技能 | 关系 |
|---|---|
| 检查#8的命名标准 |
| 在第5阶段调用该技能 |
| 结构验证(第4阶段) |
| 根据审核结果执行修复 |
| BRD创建规则 |
| 下游消费者 |
Version History
版本历史
| Version | Date | Changes |
|---|---|---|
| 1.5 | 2026-02-11T18:00:00 | Structure Compliance: Added Check #0 for nested folder rule enforcement (REV-STR001-STR003); Updated workflow diagram with structure validation decision node; Added structure compliance to scoring (12% weight, blocking); Consistent with other reviewer skills |
| 1.4 | 2026-02-10T17:00:00 | Mandatory drift cache: Reviewer MUST create/update |
| 1.3 | 2026-02-10T14:30:00 | Added Check #9: Upstream Drift Detection - detects when source documents modified after BRD creation; REV-D001-D005 error codes; drift cache support; configurable thresholds |
| 1.2 | 2026-02-10 | Added element type code 33 (Benefit Statement) to valid BRD codes per doc-naming v1.5 |
| 1.1 | 2026-02-10 | Added review versioning support (_vNNN pattern); Delta reporting for score comparison |
| 1.0 | 2026-02-10 | Initial skill creation with 8 review checks; ADR topic coverage validation; Strategic alignment check |
| 版本 | 日期 | 变更内容 |
|---|---|---|
| 1.5 | 2026-02-11T18:00:00 | 结构合规性: 新增检查#0,强制嵌套文件夹规则(REV-STR001-STR003);更新工作流图,添加结构验证决策节点;将结构合规性加入评分(权重12%,阻塞项);与其他审核技能保持一致 |
| 1.4 | 2026-02-10T17:00:00 | 强制漂移缓存: 审核工具必须在每次审核后创建/更新 |
| 1.3 | 2026-02-10T14:30:00 | 新增检查#9: 上游漂移检测 - 检测源文档在BRD创建后是否被修改;新增REV-D001-D005错误代码;支持漂移缓存;可配置阈值 |
| 1.2 | 2026-02-10 | 根据doc-naming v1.5,为BRD新增有效元素类型代码33(收益声明) |
| 1.1 | 2026-02-10 | 支持审核版本控制(_vNNN格式);新增评分对比的差异报告 |
| 1.0 | 2026-02-10 | 初始版本,包含8项审核检查;ADR主题覆盖度验证;战略一致性检查 |