doc-brd-reviewer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

doc-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
doc-brd-reviewer
when:
  • After BRD Generation: Run immediately after
    doc-brd-autopilot
    completes
  • 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
    doc-brd
    or
    doc-brd-autopilot
    first)
  • 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
doc-brd-validator
doc-brd-reviewer
FocusSchema compliance, PRD-Ready scoreContent quality, strategic alignment
ChecksRequired sections, field formatsLink integrity, ADR completeness, placeholders
Auto-FixStructural issues onlyContent issues (links, dates, placeholders)
OutputPRD-Ready score (numeric)Review score + issue list
PhasePhase 4 (Validation)Phase 5 (Final Review)
BlockingPRD-Ready < threshold blocksReview score < threshold flags

维度
doc-brd-validator
doc-brd-reviewer
核心关注点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 TypeRequired Location
Monolithic
docs/01_BRD/BRD-NN_{slug}/BRD-NN_{slug}.md
Sectioned
docs/01_BRD/BRD-NN_{slug}/BRD-NN.0_index.md
,
BRD-NN.1_*.md
, etc.
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.md
Invalid Structure:
docs/01_BRD/
├── BRD-01_f1_iam.md               ✗ NOT in nested folder
Auto-Fix:
  1. Create the nested folder
    docs/01_BRD/BRD-NN_{slug}/
  2. Move the BRD file(s) into the folder
  3. Update all internal links (navigation, cross-references)
  4. Update any downstream PRD links to correct path
Error Codes:
CodeSeverityDescription
REV-STR001ErrorBRD not in nested folder (blocking)
REV-STR002ErrorBRD folder name doesn't match BRD ID
REV-STR003WarningMonolithic BRD should be sectioned (>25KB)
This check is BLOCKING - BRD must pass structure validation before other checks proceed.

验证BRD是否遵循强制嵌套文件夹规则。
嵌套文件夹规则: 所有BRD无论大小,都必须存放在嵌套文件夹中。
必填结构:
BRD类型必填存放位置
单体式
docs/01_BRD/BRD-NN_{slug}/BRD-NN_{slug}.md
分段式
docs/01_BRD/BRD-NN_{slug}/BRD-NN.0_index.md
,
BRD-NN.1_*.md
验证逻辑:
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               ✗ 未存放在嵌套文件夹中
自动修复:
  1. 创建嵌套文件夹
    docs/01_BRD/BRD-NN_{slug}/
  2. 将BRD文件移动到该文件夹中
  3. 更新所有内部链接(导航、交叉引用)
  4. 更新下游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:
CodeSeverityDescription
REV-L001ErrorBroken internal link
REV-L002WarningExternal link unreachable
REV-L003InfoLink 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:
CodeSeverityDescription
REV-R001ErrorRequirement missing acceptance criteria
REV-R002ErrorNo success metrics defined
REV-R003WarningScope boundaries unclear
REV-R004WarningMissing priority assignment
REV-R005InfoDependency 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:
CodeSeverityDescription
REV-ADR001ErrorMandatory ADR category missing
REV-ADR002ErrorTopic missing Alternatives Overview
REV-ADR003ErrorSelected topic missing comparison table
REV-ADR004WarningTopic missing Decision Drivers
REV-ADR005InfoDeferred 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]
    ,
    [PLACEHOLDER]
    text
  • Template dates:
    YYYY-MM-DDTHH:MM:SS
    ,
    MM/DD/YYYY
  • Template names:
    [Name]
    ,
    [Author]
    ,
    [Reviewer]
  • Empty sections:
    <!-- Content here -->
  • Lorem ipsum or sample text
Auto-Fix:
  • Replace
    YYYY-MM-DDTHH:MM:SS
    with current datetime
  • Replace
    [Name]
    with document author from metadata
  • Remove empty comment placeholders
  • Flag
    [TODO]
    /
    [TBD]
    for manual completion
Error Codes:
CodeSeverityDescription
REV-P001Error[TODO] placeholder found
REV-P002Error[TBD] placeholder found
REV-P003WarningTemplate date not replaced
REV-P004WarningTemplate name not replaced
REV-P005WarningEmpty section content

识别需要替换的不完整内容。
检查范围:
  • [TODO]
    ,
    [TBD]
    ,
    [PLACEHOLDER]
    文本
  • 模板日期:
    YYYY-MM-DDTHH:MM:SS
    ,
    MM/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
@strategy:
and cross-reference tags.
Scope:
  • @strategy: DOC-XX
    tags reference valid source documents
  • Element IDs properly formatted
  • Cross-references consistent
Error Codes:
CodeSeverityDescription
REV-TR001ErrorInvalid strategy reference
REV-TR002WarningMissing element ID
REV-TR003InfoInconsistent cross-reference format
REV-TR004WarningTag 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):
SectionMinimum Words
Executive Summary100
Problem Statement75
Business Objectives150
Functional Requirements200
Non-Functional Requirements150
ADR Topics300
Appendices100
Error Codes:
CodeSeverityDescription
REV-S001ErrorRequired section missing entirely
REV-S002WarningSection below minimum word count
REV-S003WarningTable has no data rows
REV-S004ErrorMermaid 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:
CodeSeverityDescription
REV-SA001WarningBusiness objective not traced to strategy
REV-SA002InfoSuccess metric may not align with KPI
REV-SA003WarningScope may exceed project charter
REV-SA004FlagRequires stakeholder review

验证BRD与业务战略和目标保持一致。
检查范围:
  • 业务目标可追溯到战略目标
  • 成功指标与KPI保持一致
  • 范围与项目章程匹配
  • 干系人关注点已得到解决
错误代码:
代码严重程度描述
REV-SA001警告业务目标无法追溯到战略
REV-SA002信息成功指标可能与KPI不一致
REV-SA003警告范围可能超出项目章程
REV-SA004标记需要干系人审核

8. Naming Compliance

8. 命名合规性

Validates element IDs follow
doc-naming
standards.
Scope:
  • Element IDs use
    BRD.NN.TT.SS
    format
  • 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:
CodeSeverityDescription
REV-N001ErrorInvalid element ID format
REV-N002ErrorElement type code not valid for BRD
REV-N003ErrorLegacy pattern detected
REV-N004WarningInconsistent 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:
  • @ref:
    tag targets (technical specifications, strategy documents)
  • @strategy:
    tag references
  • Traceability section upstream artifact links
  • GAP analysis document references
  • Any markdown links to
    ../00_REF/
    or source documents

检测上游源文档在BRD创建或最后更新后是否被修改。漂移缓存是强制要求 - 审核工具必须在每次审核后创建/更新缓存。
目的: 识别可能未反映当前源文档的过时BRD内容。当上游文档(战略规范、技术规范、干系人输入)发生变化时,BRD可能需要更新以保持一致性。
检查范围:
  • @ref:
    标签目标(技术规范、战略文档)
  • @strategy:
    标签引用
  • 可追溯性章节中的上游工件链接
  • GAP分析文档引用
  • 任何指向
    ../00_REF/
    或源文档的Markdown链接

9.1 Drift Cache File (MANDATORY)

9.1 漂移缓存文件(强制)

Location:
docs/01_BRD/{BRD_folder}/.drift_cache.json
IMPORTANT: The reviewer MUST:
  1. Read the cache if it exists (for hash comparison)
  2. Create the cache if it doesn't exist
  3. 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
重要提示: 审核工具必须:
  1. 读取已存在的缓存(用于哈希比较)
  2. 创建不存在的缓存
  3. 更新缓存,每次审核后保存当前哈希值
缓存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 array

PHASE 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_percentage

python
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_percentage

9.4 Error Codes

9.4 错误代码

CodeSeverityDescriptionTrigger
REV-D001WarningUpstream document modified after BRD creationmtime > BRD date (no cache)
REV-D002WarningReferenced content has changedhash mismatch (with cache)
REV-D003InfoUpstream document version incrementedversion field changed
REV-D004InfoNew content added to upstreamfile size increased >10%
REV-D005ErrorCritical modification (>20% change)hash diff >20%
REV-D006InfoCache 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
undefined
markdown
undefined

9. Upstream Drift Detection (5/5)

9. 上游漂移检测(5/5)

Cache Status

缓存状态

FieldValue
Cache File
.drift_cache.json
Cache Status✅ Updated
Detection ModeHash Comparison
Documents Tracked2
字段
缓存文件
.drift_cache.json
缓存状态✅ 已更新
检测模式哈希比较
跟踪的文档数2

Upstream Document Analysis

上游文档分析

Upstream DocumentHash StatusLast ModifiedChange %Status
F1_IAM_Technical_Specification.md✅ Match2026-02-10T15:34:260%Current
GAP_Foundation_Module_Gap_Analysis.md✅ Match2026-02-10T15:34:210%Current
上游文档哈希状态最后修改时间变化百分比状态
F1_IAM_Technical_Specification.md✅ 匹配2026-02-10T15:34:260%当前
GAP_Foundation_Module_Gap_Analysis.md✅ 匹配2026-02-10T15:34:210%当前

Drift Summary

漂移摘要

StatusCountDetails
✅ Current2All upstream documents synchronized
⚠️ Warning0No drift detected
❌ Critical0No major changes
Cache updated: 2026-02-10T17:00:00

---
状态数量详情
✅ 当前2所有上游文档已同步
⚠️ 警告0未检测到漂移
❌ 严重0无重大变更
缓存已更新: 2026-02-10T17:00:00

---

9.6 Configuration

9.6 配置项

SettingDefaultDescription
cache_enabled
trueMandatory - always create/update cache
drift_threshold_days
7Days before timestamp drift becomes Warning
critical_change_pct
20Percentage change for critical drift
track_sections
trueTrack individual section hashes for anchored refs
max_history_entries
10Maximum review_history entries to retain

设置项默认值描述
cache_enabled
true强制 - 始终创建/更新缓存
drift_threshold_days
7时间戳漂移变为警告的天数阈值
critical_change_pct
20严重漂移的百分比变化阈值
track_sections
true跟踪锚点引用的单个章节哈希值
max_history_entries
10保留的review_history最大条目数

Review Score Calculation

审核评分计算

Scoring Formula:
CategoryWeightCalculation
Structure Compliance12%(nested_folder_valid ? 12 : 0) - BLOCKING
Link Integrity8%(valid_links / total_links) × 8
Requirement Completeness15%(complete_reqs / total_reqs) × 15
ADR Topic Coverage15%(covered_topics / required_topics) × 15
Placeholder Detection10%(no_placeholders ? 10 : 10 - (count × 2))
Traceability Tags10%(valid_tags / total_tags) × 10
Section Completeness12%(complete_sections / total_sections) × 12
Strategic Alignment5%(aligned_objectives / total_objectives) × 5
Naming Compliance8%(valid_ids / total_ids) × 8
Upstream Drift5%(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
undefined
bash
undefined

Review 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
undefined

Options

选项

OptionDefaultDescription
--min-score
90Minimum passing review score
--auto-fix
trueApply automatic fixes
--no-auto-fix
falseDisable auto-fix (report only)
--check
allSpecific checks to run (comma-separated)
--skip
noneChecks to skip (comma-separated)
--verbose
falseDetailed output per check
--report
trueGenerate markdown report

选项默认值描述
--min-score
90审核通过的最低评分
--auto-fix
true执行自动修复
--no-auto-fix
false禁用自动修复(仅生成报告)
--check
all要执行的特定检查(逗号分隔)
--skip
none要跳过的检查(逗号分隔)
--verbose
false显示每个检查的详细输出
--report
true生成Markdown报告

Output Report

输出报告

Review reports are stored alongside the reviewed document per project standards.
Nested Folder Rule: ALL BRDs use nested folders (
BRD-NN_{slug}/
) regardless of size. This ensures review reports, fix reports, and drift cache files are organized with their parent document.
File Naming:
BRD-NN.R_review_report_vNNN.md
Location: 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

版本规则

  1. First Review: Creates
    BRD-NN.R_review_report_v001.md
  2. Subsequent Reviews: Auto-increments version (v002, v003, etc.)
  3. 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
  1. 首次审核: 创建
    BRD-NN.R_review_report_v001.md
  2. 后续审核: 自动递增版本号(v002, v003等)
  3. 当日多次审核: 每次审核都使用唯一版本号
版本检测算法:
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
undefined

Score Comparison

评分对比

MetricPrevious (v002)Current (v003)Delta
Overall Score8594+9
Errors30-3
Warnings52-3

See `REVIEW_DOCUMENT_STANDARDS.md` for complete requirements.

---
指标上一版本(v002)当前版本(v003)变化值
总分8594+9
错误数30-3
警告数52-3

完整要求请参考`REVIEW_DOCUMENT_STANDARDS.md`。

---

Integration with doc-brd-autopilot

与doc-brd-autopilot的集成

This skill is invoked during Phase 5 of
doc-brd-autopilot
:
mermaid
flowchart LR
    A[Phase 4: Validation] --> B[Phase 5: Final Review]
    B --> C{doc-brd-reviewer}
    C --> D[Phase 6: Continue]

该技能在
doc-brd-autopilot
的第5阶段被调用:
mermaid
flowchart LR
    A[Phase 4: Validation] --> B[Phase 5: Final Review]
    B --> C{doc-brd-reviewer}
    C --> D[Phase 6: Continue]

Related Skills

相关技能

SkillRelationship
doc-naming
Naming standards for Check #8
doc-brd-autopilot
Invokes this skill in Phase 5
doc-brd-validator
Structural validation (Phase 4)
doc-brd-fixer
Applies fixes based on review findings
doc-brd
BRD creation rules
doc-prd-autopilot
Downstream consumer

技能关系
doc-naming
检查#8的命名标准
doc-brd-autopilot
在第5阶段调用该技能
doc-brd-validator
结构验证(第4阶段)
doc-brd-fixer
根据审核结果执行修复
doc-brd
BRD创建规则
doc-prd-autopilot
下游消费者

Version History

版本历史

VersionDateChanges
1.52026-02-11T18:00:00Structure 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.42026-02-10T17:00:00Mandatory drift cache: Reviewer MUST create/update
.drift_cache.json
after every review; Three-phase detection algorithm; SHA-256 hash computation; Hash comparison mode when cache exists; REV-D006 code for cache creation; Cache schema with review_history tracking
1.32026-02-10T14:30:00Added Check #9: Upstream Drift Detection - detects when source documents modified after BRD creation; REV-D001-D005 error codes; drift cache support; configurable thresholds
1.22026-02-10Added element type code 33 (Benefit Statement) to valid BRD codes per doc-naming v1.5
1.12026-02-10Added review versioning support (_vNNN pattern); Delta reporting for score comparison
1.02026-02-10Initial skill creation with 8 review checks; ADR topic coverage validation; Strategic alignment check
版本日期变更内容
1.52026-02-11T18:00:00结构合规性: 新增检查#0,强制嵌套文件夹规则(REV-STR001-STR003);更新工作流图,添加结构验证决策节点;将结构合规性加入评分(权重12%,阻塞项);与其他审核技能保持一致
1.42026-02-10T17:00:00强制漂移缓存: 审核工具必须在每次审核后创建/更新
.drift_cache.json
;三阶段检测算法;SHA-256哈希计算;有缓存时使用哈希比较模式;新增REV-D006缓存创建代码;缓存Schema支持review_history跟踪
1.32026-02-10T14:30:00新增检查#9: 上游漂移检测 - 检测源文档在BRD创建后是否被修改;新增REV-D001-D005错误代码;支持漂移缓存;可配置阈值
1.22026-02-10根据doc-naming v1.5,为BRD新增有效元素类型代码33(收益声明)
1.12026-02-10支持审核版本控制(_vNNN格式);新增评分对比的差异报告
1.02026-02-10初始版本,包含8项审核检查;ADR主题覆盖度验证;战略一致性检查