Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

doc-req-fixer文档请求修复程序

Agent Skill

用于辅助文档、README、Markdown、说明文和内容稿件的整理与改写。它适合让 Agent 提炼结构、补齐章节、统一术语、检查链接或把零散材料整理成可读文档。使用时应保留项目已有事实、命令和路径,不要把未确认的信息写成确定结论;涉及对外文案时,还需要控制语气,避免过度营销或夸大能力。

总安装

642

周安装

27

GitHub Stars

14

下载量

225
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:doc-req-fixer(文档请求修复程序)
来源仓库:https://github.com/vladm3105/aidoc-flow-framework
仓库路径:skills/doc-req-fixer
安装命令:
npx skills add https://github.com/vladm3105/aidoc-flow-framework --skill doc-req-fixer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/vladm3105/aidoc-flow-framework --skill doc-req-fixer

简介

依据评审报告修复 REQ 文档质量问题。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

  • 处理非原子化表述与 SYS 设计偏离情况。
  • 生成 fix report 记录变更细节与遗留问题。
  • 支持单文件或多子系统(SSS)版本管理。
  • doc-req-fixer 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

doc-req-fixer

Purpose

Automated fix skill that reads the latest review report and applies fixes to REQ (Requirements Specification) documents. This skill bridges the gap between doc-req-reviewer (which identifies issues) and the corrected REQ, enabling iterative improvement cycles.

Layer: 7 (REQ Quality Improvement)

Upstream: REQ document, Review Report (REQ-NN.A_audit_report_vNNN.md preferred, REQ-NN.R_review_report_vNNN.md legacy-compatible, or REQ-NN-SSS.R_review_report_vNNN.md), SYS (for system design alignment)

Downstream: Fixed REQ, Fix Report (REQ-NN.F_fix_report_vNNN.md or REQ-NN-SSS.F_fix_report_vNNN.md)


When to Use This Skill

Use doc-req-fixer when:

  • After Review: Run after doc-req-reviewer identifies issues
  • Iterative Improvement: Part of Review -> Fix -> Review cycle
  • Automated Pipeline: CI/CD integration for quality gates
  • Batch Fixes: Apply fixes to multiple REQ documents based on review reports

Do NOT use when:

  • No review report exists (run doc-req-reviewer first)
  • Creating new REQ (use doc-req or doc-req-autopilot)
  • Only need validation (use doc-req-validator)

Skill Dependencies

SkillPurposeWhen Used
doc-req-reviewerSource of issues to fixInput (reads review report)
doc-namingElement ID standardsFix element IDs
doc-reqREQ creation rulesCreate missing sections
doc-sysSYS alignment referenceVerify system traceability

Workflow Overview

flowchart TD
    A[Input: REQ Path] --> B[Find Latest Review Report]
    B --> C{Review Found?}
    C -->|No| D[Run doc-req-reviewer First]
    C -->|Yes| E[Parse Review Report]

    E --> F[Categorize Issues]

    subgraph FixPhases["Fix Phases"]
        F --> F0[Phase 0: Fix Structure Violations]
        F0 --> G[Phase 1: Create Missing Files]
        G --> H[Phase 2: Fix Broken Links]
        H --> I[Phase 3: Fix Element IDs]
        I --> J[Phase 4: Fix Content Issues]
        J --> K[Phase 5: Update References]
        K --> K2[Phase 6: Handle Upstream Drift]
    end

    K2 --> L[Write Fixed REQ]
    L --> M[Generate Fix Report]
    M --> N{Re-run Review?}
    N -->|Yes| O[Invoke doc-req-reviewer]
    O --> P{Score >= Threshold?}
    P -->|No, iterations < max| F
    P -->|Yes| Q[COMPLETE]
    N -->|No| Q

Fix Phases

Phase 0: Fix Structure Violations (CRITICAL)

Fixes REQ documents that are not in nested folders. This phase runs FIRST because all subsequent phases depend on correct folder structure.

Nested Folder Rule: ALL REQ documents MUST be in nested folders regardless of document size.

Required Structure:

REQ TypeRequired Location
Monolithicdocs/07_REQ/REQ-NN_{slug}/REQ-NN_{slug}.md

Fix Actions:

Issue CodeIssueFix Action
REV-STR001REQ not in nested folderCreate folder, move file, update all links
REV-STR002REQ folder name doesn't match REQ IDRename folder to match
REV-STR003Monolithic REQ >25KB should be sectionedFlag for manual review

Structure Fix Workflow:

def fix_req_structure(req_path: str) -> list[Fix]:
    """Fix REQ structure violations."""
    fixes = []

    filename = os.path.basename(req_path)
    parent_folder = os.path.dirname(req_path)

    # Extract REQ ID and slug from filename
    match = re.match(r'REQ-(\d+)_([^/]+)\.md', filename)
    if not match:
        return []  # Cannot auto-fix invalid filename

    req_id = match.group(1)
    slug = match.group(2)
    expected_folder = f"REQ-{req_id}_{slug}"

    # Check if already in nested folder
    if os.path.basename(parent_folder) != expected_folder:
        # Create nested folder
        new_folder = os.path.join(os.path.dirname(parent_folder), expected_folder)
        os.makedirs(new_folder, exist_ok=True)

        # Move file
        new_path = os.path.join(new_folder, filename)
        shutil.move(req_path, new_path)
        fixes.append(f"Moved {req_path} to {new_path}")

        # Update upstream links in moved file
        content = Path(new_path).read_text()
        updated_content = content.replace('../06_SYS/', '../../06_SYS/')
        updated_content = updated_content.replace('../05_ADR/', '../../05_ADR/')
        Path(new_path).write_text(updated_content)
        fixes.append(f"Updated relative links for nested folder structure")

    return fixes

Link Path Updates After Move:

Original PathUpdated Path
../06_SYS/SYS-01_slug/SYS-01.md../../06_SYS/SYS-01_slug/SYS-01.md

Phase 1: Create Missing Files

Creates files that are referenced but don't exist.

Scope:

Missing FileActionTemplate Used
REQ-00_INDEX.mdCreate REQ indexIndex template
REQ-00_GLOSSARY.mdCreate requirements glossaryGlossary template
UC_*.mdCreate placeholder use case docUse Case template
Reference docs (*_REF_*.md)Create placeholderREF template

REQ Index Template:

---
title: "REQ-00: Requirements Specifications Index"
tags:
  - req
  - index
  - reference
custom_fields:
  document_type: index
  artifact_type: REQ-REFERENCE
  layer: 7
---

# REQ-00: Requirements Specifications Index

Master index of all Requirements Specifications for this project.

## Functional Requirements

| REQ ID | Module | Status | Priority | SYS Refs |
|--------|--------|--------|----------|----------|
| REQ-01 | [Name] | Draft/Approved | P1/P2/P3 | SYS-01 |

## Non-Functional Requirements

| REQ ID | Category | Status | Priority |
|--------|----------|--------|----------|
| REQ-NFR-01 | Performance | Draft | P1 |
| REQ-NFR-02 | Security | Draft | P1 |

## Requirements by Priority

| Priority | REQ IDs | Count |
|----------|---------|-------|
| P1 (Critical) | | 0 |
| P2 (Important) | | 0 |
| P3 (Nice-to-have) | | 0 |

## Coverage Matrix

| SYS Component | REQ Coverage | Gaps |
|---------------|--------------|------|
| SYS-01 | REQ-01, REQ-02 | None |

---

*Maintained by doc-req-fixer. Update when adding new REQ documents.*

REQ Glossary Template:

---
title: "REQ-00: Requirements Glossary"
tags:
  - req
  - glossary
  - reference
custom_fields:
  document_type: glossary
  artifact_type: REQ-REFERENCE
  layer: 7
---

# REQ-00: Requirements Glossary

Common terminology used across all Requirements Specification documents.

## Requirement Types

| Term | Definition | Example |
|------|------------|---------|
| FR | Functional Requirement | System shall authenticate users |
| NFR | Non-Functional Requirement | Response time < 200ms |
| UC | Use Case | User login flow |
| AC | Acceptance Criteria | Given/When/Then statement |

## Priority Levels

| Level | Definition | SLA |
|-------|------------|-----|
| P1 | Critical - Must have for MVP | Immediate |
| P2 | Important - Should have | Sprint N+1 |
| P3 | Nice-to-have - Could have | Backlog |

## Status Values

| Status | Definition | Next State |
|--------|------------|------------|
| Draft | Initial documentation | Review |
| Review | Under stakeholder review | Approved/Rejected |
| Approved | Accepted for implementation | Implemented |
| Implemented | Code complete | Verified |
| Verified | Testing complete | Closed |

## Domain Terms

<!-- Add project-specific terminology below -->

| Term | Definition | Context |
|------|------------|---------|
| [Term] | [Definition] | [Where used] |

---

*Maintained by doc-req-fixer. Update when terminology changes.*

Use Case Placeholder Template:

---
title: "Use Case: [Use Case Name]"
tags:
  - use-case
  - requirements
  - reference
custom_fields:
  document_type: use-case
  status: placeholder
  created_by: doc-req-fixer
---

# Use Case: [Use Case Name]

> **Status**: Placeholder - Requires completion

## 1. Overview

| Attribute | Value |
|-----------|-------|
| UC ID | UC-NN |
| Actor | [Primary Actor] |
| Priority | P1/P2/P3 |
| Status | Placeholder |

## 2. Description

[TODO: Describe the use case purpose]

## 3. Preconditions

| # | Precondition |
|---|--------------|
| 1 | [Condition that must be true] |

## 4. Main Flow

| Step | Actor | System |
|------|-------|--------|
| 1 | [Actor action] | [System response] |

## 5. Alternative Flows

[TODO: Document alternative scenarios]

## 6. Postconditions

| # | Postcondition |
|---|---------------|
| 1 | [State after successful completion] |

## 7. Acceptance Criteria

| AC ID | Criteria | Type |
|-------|----------|------|
| AC-01 | [Given/When/Then] | Functional |

---

*Created by doc-req-fixer as placeholder. Complete this document to resolve broken link issues.*

Phase 2: Fix Broken Links

Updates links to point to correct locations.

Fix Actions:

Issue CodeIssueFix Action
REV-L001Broken internal linkUpdate path or create target file
REV-L002External link unreachableAdd warning comment, keep link
REV-L003Absolute path usedConvert to relative path
REV-L004Missing SYS traceability linkAdd link to corresponding SYS

Path Resolution Logic:

def fix_link_path(req_location: str, target_path: str) -> str:
    """Calculate correct relative path based on REQ location."""

    # Monolithic REQ: docs/07_REQ/REQ-01.md
    # Sectioned REQ: docs/07_REQ/REQ-01_slug/REQ-01-003_section.md

    if is_sectioned_req(req_location):
        # Need to go up one more level
        return "../" + calculate_relative_path(req_location, target_path)
    else:
        return calculate_relative_path(req_location, target_path)

Cross-Layer Link Fix:

SourceTargetLink Pattern
REQSYS../06_SYS/SYS-NN.md
REQCTR../08_CTR/CTR-NN.md
REQSPEC../09_SPEC/SPEC-NN.md

Phase 3: Fix Element IDs

Converts invalid element IDs to correct format.

Conversion Rules:

PatternIssueConversion
REQ.NN.13.SSCode 13 invalid for REQREQ.NN.01.SS (Functional Req)
FR-XXXLegacy patternREQ.NN.01.SS
NFR-XXXLegacy patternREQ.NN.27.SS
UC-XXXLegacy patternREQ.NN.05.SS
AC-XXXLegacy patternREQ.NN.06.SS

Type Code Mapping (REQ-specific valid codes: 01, 05, 06, 27):

CodeElement TypeDescription
01Functional RequirementSystem function specification
05Use CaseUser interaction scenario
06Acceptance CriteriaTestable success criteria
27Non-Functional RequirementQuality attribute requirement

Invalid Code Conversions:

Invalid CodeValid CodeElement Type
1301Functional Requirement (was Decision Context)
1405Use Case (was Decision Statement)
1701Functional Requirement (was Component)
1806Acceptance Criteria (was Interface)
2201Functional Requirement (was Feature Item)

Regex Patterns:

# Find element IDs with invalid type codes for REQ
invalid_req_type_13 = r'REQ\.(\d{2})\.13\.(\d{2})'
replacement_13 = r'REQ.\1.01.\2'

invalid_req_type_14 = r'REQ\.(\d{2})\.14\.(\d{2})'
replacement_14 = r'REQ.\1.05.\2'

invalid_req_type_17 = r'REQ\.(\d{2})\.17\.(\d{2})'
replacement_17 = r'REQ.\1.01.\2'

# Find legacy patterns
legacy_fr = r'###\s+FR-(\d+):'
legacy_nfr = r'###\s+NFR-(\d+):'
legacy_uc = r'###\s+UC-(\d+):'
legacy_ac = r'###\s+AC-(\d+):'

Phase 4: Fix Content Issues

Addresses placeholders and incomplete content.

Fix Actions:

Issue CodeIssueFix Action
REV-P001[TODO] placeholderFlag for manual completion (cannot auto-fix)
REV-P002[TBD] placeholderFlag for manual completion (cannot auto-fix)
REV-P003Template date YYYY-MM-DDReplace with current date
REV-P004Template name [Name]Replace with metadata author or flag
REV-P005Empty sectionAdd minimum template content
REV-P006Missing requirement statusAdd "Draft" as default status
REV-P007Missing priorityAdd "P2" as default priority

Auto-Replacements:

replacements = {
    'YYYY-MM-DDTHH:MM:SS': datetime.now().strftime('%Y-%m-%dT%H:%M:%S'),
    'YYYY-MM-DD': datetime.now().strftime('%Y-%m-%d'),
    'MM/DD/YYYY': datetime.now().strftime('%m/%d/%Y'),
    '[Current date]': datetime.now().strftime('%Y-%m-%dT%H:%M:%S'),
    '[Status]': 'Draft',
    '[Priority]': 'P2',
    '[Version]': '0.1',
}

REQ-Specific Content Fixes:

SectionMissing ContentAuto-Fill
StatusEmpty"Draft"
PriorityEmpty"P2"
VersionEmpty"0.1"
Last UpdatedEmptyCurrent date
Verification MethodEmpty"Test"

Phase 5: Update References

Ensures traceability and cross-references are correct.

Fix Actions:

IssueFix Action
Missing @ref: for created filesAdd reference tag
Incorrect cross-REQ pathUpdate to correct relative path
Missing SYS traceabilityAdd @trace: SYS-NN.SS tag
Missing CTR forward referenceAdd @trace: CTR-NN.SS tag
Missing SPEC forward referenceAdd @trace: SPEC-NN.SS tag

Traceability Matrix Update:

## Traceability

| REQ Element | Traces From | Traces To | Type |
|-------------|-------------|-----------|------|
| REQ.01.0101 | SYS.01.1701 | SPEC.01.0101 | Requirement->Spec |
| REQ.01.0501 | SYS.01.0501 | BDD.01.0901 | UseCase->Behavior |
| REQ.01.0601 | REQ.01.0101 | TSPEC.01.0101 | Criteria->TestSpec |

Phase 6: Handle Upstream Drift (Auto-Merge)

Addresses issues where upstream source documents (SYS) have changed since REQ creation. This phase implements a tiered auto-merge system that automatically integrates upstream changes based on change magnitude.

6.0.1 Hash Validation Fixes

FIX-H001: Invalid Hash Placeholder

Trigger: Hash contains placeholder instead of SHA-256

Fix:

sha256sum <upstream_file_path> | cut -d' ' -f1

Update cache with: sha256:<64_hex_output>

FIX-H002: Missing Hash Prefix

Trigger: 64 hex chars but missing sha256: prefix

Fix: Prepend sha256: to value

FIX-H003: Upstream File Not Found

Trigger: Cannot compute hash (file missing)

Fix: Set drift_detected: true, add to manual review

CodeDescriptionAuto-FixSeverity
FIX-H001Replace placeholder hash with actual SHA-256YesError
FIX-H002Add missing sha256: prefixYesWarning
FIX-H003Upstream file not foundPartialError

Upstream: SYS (Layer 6 - System Design) Downstream: CTR (Layer 8 - Contracts), SPEC (Layer 9 - Specifications)

ID Pattern: REQ.NN.xxxx where:

  • NN = Module number (01-99)
  • TT = Type code (01=Functional, 05=UseCase, 06=AcceptanceCriteria, 27=NFR)
  • SS = Sequence number (01-99)

Tiered Auto-Merge Thresholds

TierChange %ActionVersion BumpHuman Review
Tier 1< 5%Auto-merge additionsPatch (1.0 -> 1.0.1)No
Tier 25-15%Auto-merge with changelogMinor (1.0 -> 1.1)Optional
Tier 3> 15%Archive + RegenerateMajor (1.x -> 2.0)Yes

Change Percentage Calculation

def calculate_change_percentage(sys_current: str, sys_baseline: str) -> float:
    """
    Calculate percentage of change between SYS versions.

    Algorithm:
    1. Tokenize both documents (sections, components, interfaces)
    2. Calculate added tokens (new content)
    3. Calculate modified tokens (changed content)
    4. Calculate removed tokens (deleted content - weighted 2x)
    5. Return: (added + modified + 2*removed) / total_baseline * 100
    """
    baseline_tokens = tokenize_sys_document(sys_baseline)
    current_tokens = tokenize_sys_document(sys_current)

    added = len(current_tokens - baseline_tokens)
    removed = len(baseline_tokens - current_tokens)
    modified = count_modified_tokens(baseline_tokens, current_tokens)

    total_baseline = len(baseline_tokens)
    if total_baseline == 0:
        return 100.0  # New document = 100% change

    change_score = added + modified + (2 * removed)
    return (change_score / total_baseline) * 100

def tokenize_sys_document(content: str) -> set:
    """Extract meaningful tokens from SYS document."""
    tokens = set()
    # Extract component definitions (SYS.NN.17.SS)
    tokens.update(re.findall(r'SYS\.\d{2}\.17\.\d{2}', content))
    # Extract interface definitions (SYS.NN.18.SS)
    tokens.update(re.findall(r'SYS\.\d{2}\.18\.\d{2}', content))
    # Extract decision references (SYS.NN.13.SS)
    tokens.update(re.findall(r'SYS\.\d{2}\.13\.\d{2}', content))
    # Extract section headers
    tokens.update(re.findall(r'^##+ .+$', content, re.MULTILINE))
    return tokens

Tier 1: Auto-Merge Additions (< 5% Change)

Trigger: Minor additions to SYS that extend existing components.

Actions:

  1. Identify new SYS elements (components, interfaces)
  2. Generate corresponding REQ elements with auto-assigned IDs
  3. Insert new requirements in appropriate sections
  4. Increment patch version (1.0 -> 1.0.1)
  5. Update drift cache with merge record

Auto-ID Generation:

def generate_next_req_id(existing_ids: list, module: str, type_code: str) -> str:
    """
    Generate next available REQ ID.

    Example: If REQ.01.0112 exists, next is REQ.01.0113
    """
    pattern = f"REQ.{module}.{type_code}."
    max_seq = 0

    for id in existing_ids:
        if id.startswith(pattern):
            seq = int(id.split('.')[-1])
            max_seq = max(max_seq, seq)

    next_seq = str(max_seq + 1).zfill(2)
    return f"REQ.{module}.{type_code}.{next_seq}"

# Example: REQ.01.0112 exists -> new ID is REQ.01.0113

Tier 1 Merge Template:

<!-- AUTO-MERGED from SYS-01 v1.2 | Tier 1 | 2026-02-10T16:00:00 -->
### REQ.01.0113: [New Requirement Title]

| Attribute | Value |
|-----------|-------|
| ID | REQ.01.0113 |
| Status | Draft |
| Priority | P2 |
| Source | SYS.01.1705 (auto-merged) |
| Version Added | 1.0.1 |

**Description**: [Auto-extracted from SYS component description]

**Acceptance Criteria**:
- [ ] AC-01: [Derived from SYS interface contracts]

@trace: SYS.01.1705

Tier 2: Auto-Merge with Changelog (5-15% Change)

Trigger: Moderate changes including new sections or modified components.

Actions:

  1. Perform all Tier 1 actions
  2. Generate detailed changelog section
  3. Mark modified existing requirements with [UPDATED] tag
  4. Increment minor version (1.0 -> 1.1)
  5. Create merge summary for optional human review

Changelog Format:

## Changelog (Auto-Merged v1.1)

**Merge Date**: 2026-02-10T16:00:00
**Source**: SYS-01 v1.3 (baseline: v1.1)
**Change Percentage**: 8.5%
**Tier**: 2 (Auto-Merge with Changelog)

### Added Requirements

| REQ ID | Title | Source SYS Element |
|--------|-------|-------------------|
| REQ.01.0113 | New Data Validation | SYS.01.1705 |
| REQ.01.0114 | Extended Logging | SYS.01.1706 |

### Updated Requirements

| REQ ID | Change Type | Previous | Current |
|--------|-------------|----------|---------|
| REQ.01.0103 | Priority | P3 | P2 |
| REQ.01.0107 | Description | [truncated] | [truncated] |

### Deprecated (No Deletion)

| REQ ID | Reason | Superseded By |
|--------|--------|---------------|
| REQ.01.0102 | Component removed in SYS | REQ.01.0113 |

No Deletion Policy:

Requirements are NEVER deleted. Instead, mark as deprecated:

### REQ.01.0102: Legacy Authentication [DEPRECATED]

> **DEPRECATED**: This requirement is superseded by REQ.01.0113 as of v1.1.
> Reason: Source component SYS.01.1702 removed in SYS v1.3.
> Retained for historical traceability.

| Attribute | Value |
|-----------|-------|
| ID | REQ.01.0102 |
| Status | **Deprecated** |
| Deprecated Date | 2026-02-10 |
| Superseded By | REQ.01.0113 |

Tier 3: Archive and Regenerate (> 15% Change)

Trigger: Major architectural changes in SYS requiring fundamental REQ restructure.

Actions:

  1. Create archive manifest
  2. Archive current REQ version
  3. Trigger full REQ regeneration via doc-req-autopilot
  4. Increment major version (1.x -> 2.0)
  5. Require human review before finalization

Archive Manifest:

---
title: "REQ-01 Archive Manifest"
archive_date: "2026-02-10T16:00:00"
archive_reason: "Tier 3 upstream drift (>15% change)"
archived_version: "1.2"
new_version: "2.0"
---

# REQ-01 Archive Manifest

## Archive Summary

| Attribute | Value |
|-----------|-------|
| Document | REQ-01 |
| Archived Version | 1.2 |
| Archive Date | 2026-02-10T16:00:00 |
| Change Percentage | 23.7% |
| Trigger | Tier 3 Upstream Drift |
| Upstream Source | SYS-01 v2.0 |

## Archived Files

| File | Archive Location | Hash |
|------|------------------|------|
| REQ-01.md | archive/REQ-01_v1.2/ | sha256:abc123... |
| REQ-01.F_fix_report_v003.md | archive/REQ-01_v1.2/ | sha256:def456... |

## Migration Notes

| Old REQ ID | Status | New REQ ID | Notes |
|------------|--------|------------|-------|
| REQ.01.0101 | Retained | REQ.01.0101 | No change |
| REQ.01.0102 | Deprecated | - | Functionality removed |
| REQ.01.0103 | Merged | REQ.01.0102 | Combined with REQ.01.0104 |
| - | New | REQ.01.0110 | New from SYS.01.1708 |

## Regeneration Trigger

/doc-req-autopilot SYS-01 --from-archive REQ-01_v1.2 --target-version 2.0

Archive Directory Structure:


docs/07_REQ/ ├── archive/ │ └── REQ-01_v1.2/ │ ├── ARCHIVE_MANIFEST.md │ ├── REQ-01.md │ ├── REQ-01.F_fix_report_v003.md │ └──.drift_cache.json ├── REQ-01.md (v2.0 - regenerated) └── REQ-00_INDEX.md

Enhanced Drift Cache with Merge History

After processing drift issues, update .drift_cache.json:

{
  "req_version": "1.1",
  "req_updated": "2026-02-10T16:00:00",
  "drift_reviewed": "2026-02-10T16:00:00",
  "upstream_hashes": {
    "../../06_SYS/SYS-01.md": "sha256:a1b2c3d4e5f6...",
    "../../06_SYS/SYS-01.md#component-3": "sha256:g7h8i9j0k1l2..."
  },
  "merge_history": [
    {
      "merge_date": "2026-02-10T16:00:00",
      "tier": 2,
      "change_percentage": 8.5,
      "version_before": "1.0",
      "version_after": "1.1",
      "upstream_version": "SYS-01 v1.3",
      "added_ids": ["REQ.01.0113", "REQ.01.0114"],
      "updated_ids": ["REQ.01.0103", "REQ.01.0107"],
      "deprecated_ids": ["REQ.01.0102"]
    }
  ],
  "acknowledged_drift": [
    {
      "document": "SYS-01.md",
      "acknowledged_date": "2026-02-08",
      "reason": "Reviewed - cosmetic changes only",
      "hash_at_acknowledgment": "sha256:xyz789..."
    }
  ],
  "downstream_notifications": {
    "CTR-01": {
      "notified": "2026-02-10T16:05:00",
      "req_version": "1.1",
      "pending_review": true
    },
    "SPEC-01": {
      "notified": "2026-02-10T16:05:00",
      "req_version": "1.1",
      "pending_review": true
    }
  }
}

Drift Issue Codes (Updated)

CodeSeverityDescriptionTierAuto-Fix
REV-D001InfoSYS minor addition (< 5%)1Yes
REV-D002WarningSYS moderate change (5-15%)2Yes
REV-D003InfoUpstream version incremented1Yes
REV-D004WarningNew component added to SYS1-2Yes
REV-D005ErrorMajor upstream modification (> 15%)3No (archive)
REV-D006WarningDeprecated upstream element2Yes (mark deprecated)

Command Options for Drift Handling

# Auto-merge with tier detection
/doc-req-fixer REQ-01 --auto-merge

# Force specific tier (override auto-detection)
/doc-req-fixer REQ-01 --auto-merge --force-tier 2

# Preview merge without applying
/doc-req-fixer REQ-01 --auto-merge --dry-run

# Acknowledge drift without merge
/doc-req-fixer REQ-01 --acknowledge-drift

# View merge history
/doc-req-fixer REQ-01 --show-merge-history

# Restore from archive
/doc-req-fixer REQ-01 --restore-archive v1.2

Command Usage

Basic Usage

# Fix REQ based on latest review
/doc-req-fixer REQ-01

# Fix sectioned REQ
/doc-req-fixer REQ-01-003

# Fix with explicit review report
/doc-req-fixer REQ-01 --review-report REQ-01.R_review_report_v001.md

# Fix and re-run review
/doc-req-fixer REQ-01 --revalidate

# Fix with iteration limit
/doc-req-fixer REQ-01 --revalidate --max-iterations 3

Options

OptionDefaultDescription
--review-reportlatestSpecific review report to use
--revalidatefalseRun reviewer after fixes
--max-iterations3Max fix-review cycles
--fix-typesallSpecific fix types (comma-separated)
--create-missingtrueCreate missing reference files
--backuptrueBackup REQ before fixing
--dry-runfalsePreview fixes without applying
--acknowledge-driftfalseInteractive drift acknowledgment mode
--update-drift-cachetrueUpdate.drift_cache.json after fixes
--auto-mergefalseEnable tiered auto-merge for upstream drift
--force-tierautoForce specific merge tier (1, 2, or 3)
--show-merge-historyfalseDisplay merge history from drift cache
--restore-archivenoneRestore REQ from archived version (e.g., v1.2)
--notify-downstreamtrueNotify CTR/SPEC of REQ changes after merge

Fix Types

TypeDescription
missing_filesCreate missing index, glossary, use case docs
broken_linksFix link paths
element_idsConvert invalid/legacy element IDs
contentFix placeholders, dates, status, priority
referencesUpdate traceability and cross-references
driftHandle upstream drift detection issues
drift_mergeAuto-merge upstream SYS changes (tiered)
drift_archiveArchive current version for Tier 3 changes
deprecateMark obsolete requirements as deprecated (no deletion)
allAll fix types (default)

Output Artifacts

Fix Report

Nested Folder Rule: ALL REQ use nested folders (REQ-NN_{slug}/) regardless of size. Fix reports are stored alongside the REQ document in the nested folder.

File Naming: REQ-NN.F_fix_report_vNNN.md or REQ-NN-SSS.F_fix_report_vNNN.md

Location: Inside the REQ nested folder: docs/07_REQ/REQ-NN_{slug}/

Structure:

---
title: "REQ-NN.F: Fix Report v001"
tags:
  - req
  - fix-report
  - quality-assurance
custom_fields:
  document_type: fix-report
  artifact_type: REQ-FIX
  layer: 7
  parent_doc: REQ-NN
  source_review: REQ-NN.R_review_report_v001.md
  fix_date: "YYYY-MM-DDTHH:MM:SS"
  fix_tool: doc-req-fixer
  fix_version: "1.0"
---

# REQ-NN Fix Report v001

## Summary

| Metric | Value |
|--------|-------|
| Source Review | REQ-NN.R_review_report_v001.md |
| Issues in Review | 18 |
| Issues Fixed | 15 |
| Issues Remaining | 3 (manual review required) |
| Files Created | 3 |
| Files Modified | 5 |

## Files Created

| File | Type | Location |
|------|------|----------|
| REQ-00_INDEX.md | REQ Index | docs/07_REQ/ |
| REQ-00_GLOSSARY.md | REQ Glossary | docs/07_REQ/ |
| UC_UserLogin.md | Use Case Placeholder | docs/00_REF/use-cases/ |

## Fixes Applied

| # | Issue Code | Issue | Fix Applied | File |
|---|------------|-------|-------------|------|
| 1 | REV-L001 | Broken index link | Created REQ-00_INDEX.md | REQ-01.md |
| 2 | REV-L001 | Broken glossary link | Created REQ-00_GLOSSARY.md | REQ-01.md |
| 3 | REV-L001 | Broken use case link | Created placeholder UC file | REQ-01.md |
| 4 | REV-N004 | Element type 13 invalid | Converted to type 01 | REQ-01.md |
| 5 | REV-N004 | Legacy FR-XXX pattern | Converted to REQ.NN.01.SS | REQ-01.md |
| 6 | REV-P007 | Missing priority | Added P2 default | REQ-02.md |

## Issues Requiring Manual Review

| # | Issue Code | Issue | Location | Reason |
|---|------------|-------|----------|--------|
| 1 | REV-P001 | [TODO] placeholder | REQ-01:L67 | Domain expertise needed |
| 2 | REV-D001 | SYS drift detected | REQ-01:L145 | Review system changes |
| 3 | REV-R001 | Missing acceptance criteria | REQ-01:L200 | Define testable criteria |

## Validation After Fix

| Metric | Before | After | Delta |
|--------|--------|-------|-------|
| Review Score | 82 | 93 | +11 |
| Errors | 5 | 0 | -5 |
| Warnings | 8 | 3 | -5 |

## Next Steps

1. Complete UC_UserLogin.md placeholder
2. Address remaining [TODO] placeholders
3. Add missing acceptance criteria for requirements
4. Review SYS drift and update requirements if needed
5. Run `/doc-req-reviewer REQ-01` to verify fixes

Integration with Autopilot

This skill is invoked by doc-req-autopilot in the Review -> Fix cycle:

flowchart LR
    subgraph Phase5["Phase 5: Review & Fix Cycle"]
        A[doc-req-reviewer] --> B{Score >= 90?}
        B -->|No| C[doc-req-fixer]
        C --> D{Iteration < Max?}
        D -->|Yes| A
        D -->|No| E[Flag for Manual Review]
        B -->|Yes| F[PASS]
    end

Autopilot Integration Points:

PhaseActionSkill
Phase 5aRun initial reviewdoc-req-reviewer
Phase 5bApply fixes if issues founddoc-req-fixer
Phase 5cRe-run reviewdoc-req-reviewer
Phase 5dRepeat until pass or max iterationsLoop

Error Handling

Recovery Actions

ErrorAction
Review report not foundPrompt to run doc-req-reviewer first
Cannot create file (permissions)Log error, continue with other fixes
Cannot parse review reportAbort with clear error message
Max iterations exceededGenerate report, flag for manual review

Backup Strategy

Before applying any fixes:

  1. Create backup in tmp/backup/REQ-NN_YYYYMMDD_HHMMSS/
  2. Copy all REQ files to backup location
  3. Apply fixes to original files
  4. If error during fix, restore from backup

Related Skills

SkillRelationship
doc-req-reviewerProvides review report (input)
doc-req-autopilotOrchestrates Review -> Fix cycle
doc-req-validatorStructural validation
doc-namingElement ID standards
doc-reqREQ creation rules
doc-sysUpstream system design
doc-ctrDownstream contracts reference
doc-specDownstream specifications reference

Version History

VersionDateChanges
2.12026-02-11Structure Compliance: Added Phase 0 for nested folder rule enforcement (REV-STR001-STR003); Runs FIRST before other fix phases
2.02026-02-10Enhanced Phase 6 Auto-Merge System: Tiered auto-merge thresholds (Tier 1 <5%, Tier 2 5-15%, Tier 3 >15%); Change percentage calculation algorithm; Auto-generated IDs for new requirements (REQ.NN.xxxx pattern); No deletion policy - mark as [DEPRECATED] instead; Archive manifest creation for Tier 3; Enhanced drift cache with merge history and downstream notifications; New options: --auto-merge, --force-tier, --show-merge-history, --restore-archive, --notify-downstream; New fix types: drift_merge, drift_archive, deprecate; Semantic versioning (patch/minor/major) based on change tier
1.02026-02-10Initial skill creation; 6-phase fix workflow; REQ Index, Glossary, and Use Case file creation; Element ID conversion (types 01, 05, 06, 27); Broken link fixes; SYS upstream drift handling; Support for sectioned REQ naming (REQ-NN-SSS); Integration with autopilot Review->Fix cycle

Implementation Plan Consistency (IPLAN-004)

  • Treat plan-derived outputs as valid source mode and verify intent preservation from implementation plan scope/objectives.
  • Validate upstream autopilot precedence assumption: --iplan > --ref > --prompt.
  • Flag objective/scope conflicts between plan context and artifact output as blocking issues requiring clarification.
  • Do not introduce legacy fallback paths such as docs-v2.0/00_REF.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.99%
按下载量换算81

Claude

31.32%
按下载量换算70

Cursor

17.36%
按下载量换算39

Gemini CLI

9.17%
按下载量换算21

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills