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

doc-spec-fixer文档规范修复程序

Agent Skill

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

总安装

667

周安装

27

GitHub Stars

14

下载量

210
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

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

简介

用于根据评审报告自动修复 SPEC 文档中的问题。

  • 适合在迭代开发中持续改进技术规格质量。
  • 读取 audit 或 review 报告后自动应用修正建议。
  • 需配合 doc-spec-reviewer 使用,不能独立运行修复逻辑。
  • doc-spec-fixer 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

doc-spec-fixer

Purpose

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

Layer: 9 (SPEC Quality Improvement)

Upstream: REQ documents, CTR documents, SPEC document, Review Report (SPEC-NN.A_audit_report_vNNN.md preferred; SPEC-NN.R_review_report_vNNN.md legacy-compatible)

Downstream: Fixed SPEC, Fix Report (SPEC-NN.F_fix_report_vNNN.md)


When to Use This Skill

Use doc-spec-fixer when:

  • After Review: Run after doc-spec-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 SPECs based on review reports
  • YAML Structure Issues: SPEC contains malformed YAML blocks

Do NOT use when:

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

Skill Dependencies

SkillPurposeWhen Used
doc-spec-reviewerSource of issues to fixInput (reads review report)
doc-spec-auditUnified validator+reviewer wrapperPreferred upstream report source
doc-namingElement ID standardsFix element IDs
doc-specSPEC creation rulesCreate missing sections
doc-reqREQ traceabilityValidate upstream links
doc-ctrCTR traceabilityValidate contract links

Workflow Overview

flowchart TD
    A[Input: SPEC Path] --> B[Find Latest Audit/Review Report]
    B --> C{Review Found?}
    C -->|No| D[Run doc-spec-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

    subgraph YAMLFix["YAML Structure Fixes"]
        K2 --> Y1[Parse YAML Blocks]
        Y1 --> Y2{YAML Valid?}
        Y2 -->|No| Y3[Repair YAML Structure]
        Y2 -->|Yes| Y4[Validate Schema Compliance]
        Y3 --> Y4
    end

    Y4 --> L[Write Fixed SPEC]
    L --> M[Generate Fix Report]
    M --> N{Re-run Review?}
    N -->|Yes| O[Invoke doc-spec-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 SPEC documents that are not in nested folders. This phase runs FIRST because all subsequent phases depend on correct folder structure.

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

Required Structure:

SPEC TypeRequired Location
YAMLdocs/09_SPEC/SPEC-NN_{slug}/SPEC-NN_{slug}.yaml

Fix Actions:

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

Structure Fix Workflow:

def fix_spec_structure(spec_path: str) -> list[Fix]:
    """Fix SPEC structure violations."""
    fixes = []

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

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

    spec_id = match.group(1)
    slug = match.group(2)
    expected_folder = f"SPEC-{spec_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(spec_path, new_path)
        fixes.append(f"Moved {spec_path} to {new_path}")

        # Update upstream references in YAML file
        content = Path(new_path).read_text()
        updated_content = content.replace('../08_CTR/', '../../08_CTR/')
        updated_content = updated_content.replace('../07_REQ/', '../../07_REQ/')
        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
../08_CTR/CTR-01_slug/CTR-01.yaml../../08_CTR/CTR-01_slug/CTR-01.yaml
../07_REQ/REQ-01_slug/REQ-01.md../../07_REQ/REQ-01_slug/REQ-01.md

Phase 1: Create Missing Files

Creates files that are referenced but don't exist.

Scope:

Missing FileActionTemplate Used
SPEC-NN_schemas.yamlCreate schema definitions fileSchema template
SPEC-NN_config.yamlCreate configuration specConfig template
Reference docsCreate placeholderREF template

SPEC Schema Template:

# SPEC-NN: Schema Definitions
# Auto-generated by doc-spec-fixer - requires completion

schemas:
  version: "1.0.0"
  spec_id: SPEC-NN
  created: "YYYY-MM-DD"
  status: draft

definitions:
  # TODO: Add schema definitions
  ExampleSchema:
    type: object
    properties:
      id:
        type: string
        description: "Unique identifier"
    required:
      - id

validation_rules:
  # TODO: Define validation rules
  - rule_id: VR-001
    description: "Placeholder validation rule"
    severity: error

SPEC Configuration Template:

# SPEC-NN: Configuration Specification
# Auto-generated by doc-spec-fixer - requires completion

configuration:
  spec_id: SPEC-NN
  version: "1.0.0"
  created: "YYYY-MM-DD"

environments:
  development:
    # TODO: Add development settings
    log_level: debug

  staging:
    # TODO: Add staging settings
    log_level: info

  production:
    # TODO: Add production settings
    log_level: warn

feature_flags:
  # TODO: Define feature flags
  - name: placeholder_flag
    description: "Placeholder feature flag"
    default: false

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-L006YAML include brokenUpdate YAML!include path
REV-L007Schema $ref invalidFix JSON Schema $ref path

Path Resolution Logic:

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

    # SPEC files: docs/09_SPEC/SPEC-01.md
    # Schema files: docs/09_SPEC/schemas/
    # Config files: docs/09_SPEC/config/

    if is_yaml_include(target_path):
        return fix_yaml_include(spec_location, target_path)
    elif is_schema_reference(target_path):
        return fix_schema_ref(spec_location, target_path)
    else:
        return calculate_relative_path(spec_location, target_path)

YAML Include Fix:

Reference TypeOriginalFixed
Schema include!include schema.yaml!include./schemas/schema.yaml
Config include!include config.yaml!include./config/config.yaml
Relative include!include../other.yamlValidate path exists

Phase 3: Fix Element IDs

Converts invalid element IDs to correct format.

SPEC Element ID Format:

SPEC documents are primarily YAML-based and use a different ID structure. Element IDs in SPEC follow the pattern: SPEC-NN.field.path for YAML elements.

Conversion Rules:

PatternIssueConversion
SPEC.NN.XX.SSLegacy numeric formatConvert to YAML path format
SPEC-NN-XXXInvalid slug formatSPEC-NN.section.element
Missing IDsNo element identifierGenerate based on YAML path

YAML Path ID Generation:

def generate_yaml_element_id(spec_id: str, yaml_path: list) -> str:
    """Generate element ID from YAML path.

    Example:
        spec_id: "SPEC-01"
        yaml_path: ["schemas", "definitions", "UserSchema"]
        returns: "SPEC-01.schemas.definitions.UserSchema"
    """
    return f"{spec_id}.{'.'.join(yaml_path)}"

ID Normalization:

Invalid IDNormalized ID
SPEC-01 Schema 1SPEC-01.schemas.schema_1
SPEC-01/config/dbSPEC-01.config.db
spec_01_authSPEC-01.auth

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-Y001Invalid YAML syntaxAttempt YAML repair
REV-Y002Missing required YAML fieldAdd field with placeholder
REV-Y003Invalid YAML typeConvert to correct type
REV-Y004Duplicate YAML keysRemove duplicates

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'),
    '"1.0.0"': f'"{calculate_version()}"',
}

YAML Structure Repair:

YAML IssueRepair Action
Missing quotesAdd quotes around string values
Invalid indentationFix to 2-space indent
Duplicate keysKeep first, log warning
Missing colonsAdd colons after keys
Invalid booleanConvert to true/false
Invalid nullConvert to null or ~
Trailing spacesRemove trailing whitespace
Missing list dashAdd - for list items

Phase 5: Update References

Ensures traceability and cross-references are correct.

Fix Actions:

IssueFix Action
Missing @req: referenceAdd REQ traceability tag
Missing @ctr: referenceAdd CTR traceability tag
Incorrect upstream pathUpdate to correct relative path
Missing traceability entryAdd to traceability matrix

REQ/CTR Traceability Fix:

<!-- Before -->
## 3. Schema Definitions

<!-- After -->
## 3. Schema Definitions

@req: [REQ-01.28.01](../07_REQ/REQ-01.md#req-01-28-01)
@ctr: [CTR-01-API](../08_CTR/CTR-01-API.md)

Phase 6: Handle Upstream Drift (Auto-Merge)

Addresses issues where upstream REQ/CTR documents have changed since SPEC creation using a tiered auto-merge system.

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

SPEC ID Pattern: SPEC-NN-COMPONENT-SS

  • NN: Sequential spec number (01-99)
  • COMPONENT: Component identifier (e.g., AUTH, API, DATA)
  • SS: Sub-spec number within component (01-99)

Example: SPEC-01-AUTH-13, SPEC-02-API-05, SPEC-03-DATA-21

Drift Issue Codes (from doc-spec-reviewer):

CodeSeverityDescriptionChange %Auto-Fix Possible
REV-D001InfoMinor upstream modification< 5%Yes (Tier 1)
REV-D002WarningModerate upstream modification5-15%Yes (Tier 2)
REV-D003InfoUpstream document version incrementedN/AYes (update @ref version)
REV-D004WarningNew requirements added to upstream5-15%Yes (Tier 2)
REV-D005ErrorCritical upstream modification> 15%Yes (Tier 3)

Tiered Auto-Merge System

Tier 1: Minor Changes (< 5% drift)

AspectBehavior
TriggerChange percentage < 5%
ActionAuto-merge spec updates
VersionIncrement PATCH (1.0.0 -> 1.0.1)
LoggingBrief changelog entry
ReviewNo manual review required

Tier 2: Moderate Changes (5-15% drift)

AspectBehavior
TriggerChange percentage 5-15%
ActionAuto-merge with detailed changelog
VersionIncrement MINOR (1.0.0 -> 1.1.0)
LoggingDetailed changelog with diff summary
ReviewOptional review recommended

Tier 3: Major Changes (> 15% drift)

AspectBehavior
TriggerChange percentage > 15%
ActionArchive current version, trigger regeneration
VersionIncrement MAJOR (1.0.0 -> 2.0.0)
LoggingFull archive manifest creation
ReviewManual review required post-regeneration

Change Percentage Calculation

def calculate_drift_percentage(
    upstream_doc: str,
    spec_references: list,
    upstream_modified: datetime,
    spec_created: datetime
) -> float:
    """Calculate drift percentage between upstream and SPEC.

    Factors:
    - Line diff percentage in referenced sections
    - Number of new/removed requirements
    - Structural changes (new sections, moved content)
    - Time since last sync (decay factor)

    Returns:
        float: Drift percentage (0.0 - 100.0)
    """
    line_changes = count_line_changes(upstream_doc, spec_references)
    total_lines = count_referenced_lines(upstream_doc, spec_references)

    if total_lines == 0:
        return 0.0

    base_percentage = (line_changes / total_lines) * 100

    # Apply time decay factor (older drift = more significant)
    days_stale = (datetime.now() - spec_created).days
    decay_factor = min(1.0 + (days_stale / 30) * 0.1, 1.5)

    return min(base_percentage * decay_factor, 100.0)

Auto-Generated SPEC IDs

def generate_spec_id(
    spec_number: int,
    component: str,
    sub_spec: int
) -> str:
    """Generate SPEC ID following SPEC-NN-COMPONENT-SS pattern.

    Args:
        spec_number: Main spec number (1-99)
        component: Component identifier (e.g., AUTH, API, DATA)
        sub_spec: Sub-spec number (1-99)

    Returns:
        str: Formatted SPEC ID

    Example:
        generate_spec_id(1, "AUTH", 13) -> "SPEC-01-AUTH-13"
    """
    return f"SPEC-{spec_number:02d}-{component.upper()}-{sub_spec:02d}"

No-Deletion Policy

CRITICAL: SPECs are NEVER deleted. Mark as deprecated instead.

<!-- DEPRECATED: 2026-02-10 - Superseded by SPEC-01-AUTH-14 -->
<!-- Reason: Major upstream drift (>15%) triggered regeneration -->
<!-- Archive: archive/SPEC-01-AUTH-13_v1.2.0_20260210.md -->
---
title: "[DEPRECATED] SPEC-01-AUTH-13: Authentication Flow"
status: deprecated
superseded_by: SPEC-01-AUTH-14
---

Deprecation Rules:

RuleDescription
Never deleteSPECs are marked [DEPRECATED], not removed
Preserve historyOriginal content remains for audit trail
Add superseded_byLink to replacement SPEC if applicable
Archive locationarchive/ folder with version and date

Archive Manifest (Tier 3)

When Tier 3 triggers regeneration, create an archive manifest:

# archive/SPEC-01-AUTH-13_archive_manifest.yaml
archive_manifest:
  spec_id: SPEC-01-AUTH-13
  archived_version: "1.2.0"
  archive_date: "2026-02-10T16:00:00"
  archive_reason: "Major upstream drift (>15%)"

  drift_details:
    upstream_documents:
      - doc: REQ-01.md
        drift_percentage: 23.5
        lines_changed: 47
        sections_affected: [3, 5, 7]
      - doc: CTR-01-API.yaml
        drift_percentage: 18.2
        endpoints_changed: 5
        schemas_modified: 3

    total_drift: 20.85
    trigger_tier: 3

  archived_files:
    - source: docs/09_SPEC/SPEC-01-AUTH-13.md
      archive: archive/SPEC-01-AUTH-13_v1.2.0_20260210.md
    - source: docs/09_SPEC/schemas/SPEC-01-AUTH-13_schemas.yaml
      archive: archive/SPEC-01-AUTH-13_schemas_v1.2.0_20260210.yaml

  regeneration:
    triggered: true
    new_spec_id: SPEC-01-AUTH-14
    new_version: "2.0.0"

  downstream_impact:
    tspec_documents:
      - TSPEC-01-AUTH-13 (requires update)
    tasks_documents:
      - TASKS-01-AUTH-13 (requires review)

Enhanced Drift Cache

The .drift_cache.json file tracks drift state and merge history:

{
  "cache_version": "2.0",
  "last_updated": "2026-02-10T16:00:00",
  "specs": {
    "SPEC-01-AUTH-13": {
      "current_version": "1.2.0",
      "created": "2026-02-05T10:00:00",
      "last_sync": "2026-02-08T14:30:00",
      "upstream_refs": {
        "REQ-01.md": {
          "last_known_hash": "a1b2c3d4",
          "last_modified": "2026-02-08T09:00:00",
          "sections_tracked": ["3.1", "3.2", "5.4"]
        },
        "CTR-01-API.yaml": {
          "last_known_hash": "e5f6g7h8",
          "last_modified": "2026-02-07T16:00:00",
          "endpoints_tracked": ["/auth/login", "/auth/refresh"]
        }
      },
      "merge_history": [
        {
          "date": "2026-02-06T11:00:00",
          "tier": 1,
          "drift_percentage": 3.2,
          "version_before": "1.0.0",
          "version_after": "1.0.1",
          "changes_merged": ["REQ-01.md: Updated validation rules"]
        },
        {
          "date": "2026-02-08T14:30:00",
          "tier": 2,
          "drift_percentage": 8.5,
          "version_before": "1.0.1",
          "version_after": "1.1.0",
          "changes_merged": [
            "REQ-01.md: Added new requirement REQ-01.28.05",
            "CTR-01-API.yaml: Modified /auth/refresh response"
          ],
          "changelog_file": "changelogs/SPEC-01-AUTH-13_v1.1.0_changelog.md"
        }
      ],
      "downstream_documents": {
        "tspec": ["TSPEC-01-AUTH-13"],
        "tasks": ["TASKS-01-AUTH-13"]
      }
    }
  }
}

YAML Spec Format Handling

SPEC documents use embedded YAML blocks. Drift handling preserves YAML structure:

# Merged YAML section with drift metadata
schemas:
  _drift_metadata:
    last_merge: "2026-02-08T14:30:00"
    merge_tier: 2
    upstream_version: "REQ-01.md@v1.3.0"

  AuthRequest:
    type: object
    properties:
      username:
        type: string
        # @merged: 2026-02-08 from REQ-01.28.01
        minLength: 3
        maxLength: 64
      password:
        type: string
        format: password
        # @merged: 2026-02-08 from REQ-01.28.02 (new validation)
        minLength: 12

Fix Actions by Tier

TierVersion ChangeAuto-Fix Actions
1PATCHUpdate referenced content, update @ref tags, brief changelog
2MINORAll Tier 1 actions + detailed changelog, diff summary, notification
3MAJORArchive current, create manifest, mark deprecated, trigger regeneration

Drift Marker Format (Updated for v2.0):

<!-- DRIFT-MERGED: Tier 1 | REQ-01.md | 3.2% | 2026-02-08 | v1.0.0 -> v1.0.1 -->
@req: [REQ-01.28.01](../07_REQ/REQ-01.md#req-01-28-01) @version:1.3.0

<!-- DRIFT-MERGED: Tier 2 | CTR-01-API.yaml | 8.5% | 2026-02-08 | v1.0.1 -> v1.1.0 -->
<!-- See: changelogs/SPEC-01-AUTH-13_v1.1.0_changelog.md -->
@ctr: [CTR-01-API](../08_CTR/CTR-01-API.md) @version:2.1.0

<!-- DRIFT-ARCHIVED: Tier 3 | 20.85% | 2026-02-10 | Regeneration triggered -->
<!-- Archive: archive/SPEC-01-AUTH-13_v1.2.0_20260210.md -->
<!-- New SPEC: SPEC-01-AUTH-14 -->

YAML Structure Fixes

SPEC documents heavily rely on embedded YAML. This section details specific YAML repair strategies.

YAML Block Detection

def find_yaml_blocks(content: str) -> list:
    """Find all YAML code blocks in markdown content."""
    pattern = r'```ya?ml\n(.*?)```'
    return re.findall(pattern, content, re.DOTALL)

Schema Validation

Schema TypeValidation Rules
Data SchemaMust have type, properties
Config SchemaMust have environment sections
API SchemaMust have paths or endpoints

Common YAML Fixes

IssueBeforeAfter
Unquoted special charsvalue: @specialvalue: "@special"
Multiline without literaldesc: line1\nline2`desc: \\n line1\n line2`
Invalid anchor&anchor name&anchor_name
Missing document startkey: value---\nkey: value

Command Usage

Basic Usage

# Fix SPEC based on latest review
/doc-spec-fixer SPEC-01

# Fix with explicit review report
/doc-spec-fixer SPEC-01 --review-report SPEC-01.R_review_report_v001.md

# Fix and re-run review
/doc-spec-fixer SPEC-01 --revalidate

# Fix with iteration limit
/doc-spec-fixer SPEC-01 --revalidate --max-iterations 3

# Fix YAML only
/doc-spec-fixer SPEC-01 --fix-types yaml

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 SPEC before fixing
--dry-runfalsePreview fixes without applying
--validate-yamltrueValidate YAML after fixes
--acknowledge-driftfalseInteractive drift acknowledgment mode
--update-drift-cachetrueUpdate.drift_cache.json after fixes

Fix Types

TypeDescription
missing_filesCreate missing schema, config docs
broken_linksFix link paths and YAML includes
element_idsConvert invalid element IDs to YAML paths
contentFix placeholders, dates, names
referencesUpdate REQ/CTR traceability and cross-references
driftHandle upstream drift detection issues
yamlFix YAML structure and syntax issues
allAll fix types (default)

Output Artifacts

Fix Report

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

File Naming: SPEC-NN.F_fix_report_vNNN.md

Upstream Selection Precedence:

  1. Select newest report timestamp.
  2. If timestamps are equal, prefer .A_audit_report over .R_review_report.

Location: Inside the SPEC nested folder: docs/09_SPEC/SPEC-NN_{slug}/

Structure:

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

# SPEC-NN Fix Report v001

## Summary

| Metric | Value |
|--------|-------|
| Source Review | SPEC-NN.R_review_report_v001.md |
| Issues in Review | 18 |
| Issues Fixed | 15 |
| Issues Remaining | 3 (manual review required) |
| Files Created | 2 |
| Files Modified | 1 |
| YAML Blocks Repaired | 4 |

## Files Created

| File | Type | Location |
|------|------|----------|
| SPEC-01_schemas.yaml | Schema Definitions | docs/09_SPEC/schemas/ |
| SPEC-01_config.yaml | Configuration Spec | docs/09_SPEC/config/ |

## YAML Repairs

| Block Location | Issue | Repair Applied |
|----------------|-------|----------------|
| Line 45-62 | Invalid indentation | Fixed to 2-space |
| Line 98-105 | Missing quotes | Added quotes to values |
| Line 142-150 | Duplicate key | Removed duplicate |
| Line 201-215 | Invalid boolean | Converted to true/false |

## Fixes Applied

| # | Issue Code | Issue | Fix Applied | File |
|---|------------|-------|-------------|------|
| 1 | REV-L006 | Broken YAML include | Updated include path | SPEC-01.md |
| 2 | REV-Y001 | Invalid YAML syntax | Repaired 4 blocks | SPEC-01.md |
| 3 | REV-L003 | Absolute path used | Converted to relative | SPEC-01.md |

## Issues Requiring Manual Review

| # | Issue Code | Issue | Location | Reason |
|---|------------|-------|----------|--------|
| 1 | REV-P001 | [TODO] placeholder | SPEC-01.md:L78 | Domain knowledge needed |
| 2 | REV-D002 | REQ content changed | REQ-01.28.01 | Review requirement update |

## Upstream Drift Summary

| Upstream Document | Reference | Modified | SPEC Updated | Days Stale | Action Required |
|-------------------|-----------|----------|--------------|------------|-----------------|
| REQ-01.md | SPEC-01:L57 | 2026-02-08 | 2026-02-05 | 3 | Review for changes |
| CTR-01-API.yaml | SPEC-01:L92 | 2026-02-09 | 2026-02-05 | 4 | Review for changes |

## Validation After Fix

| Metric | Before | After | Delta |
|--------|--------|-------|-------|
| Review Score | 85 | 95 | +10 |
| Errors | 5 | 0 | -5 |
| Warnings | 6 | 2 | -4 |
| YAML Valid | No | Yes | Fixed |

## Next Steps

1. Complete [TODO] placeholders in SPEC-01.md
2. Review upstream REQ/CTR drift
3. Populate schema definitions in SPEC-01_schemas.yaml
4. Run `/doc-spec-reviewer SPEC-01` to verify fixes

Integration with Autopilot

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

flowchart LR
    subgraph Phase5["Phase 5: Review & Fix Cycle"]
        A[doc-spec-reviewer] --> B{Score >= 90?}
        B -->|No| C[doc-spec-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-spec-reviewer
Phase 5bApply fixes if issues founddoc-spec-fixer
Phase 5cRe-run reviewdoc-spec-reviewer
Phase 5dRepeat until pass or max iterationsLoop

Error Handling

Recovery Actions

ErrorAction
Review report not foundPrompt to run doc-spec-reviewer first
Cannot create file (permissions)Log error, continue with other fixes
Cannot parse review reportAbort with clear error message
YAML parse errorAttempt repair, flag if unrecoverable
Max iterations exceededGenerate report, flag for manual review
Schema validation failureLog warning, continue with fixes

Backup Strategy

Before applying any fixes:

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

Related Skills

SkillRelationship
doc-spec-reviewerProvides review report (input)
doc-spec-autopilotOrchestrates Review -> Fix cycle
doc-spec-validatorStructural validation
doc-namingElement ID standards
doc-specSPEC creation rules
doc-reqREQ upstream traceability
doc-ctrCTR upstream traceability

Version History

VersionDateChanges
2.22026-02-27Normalized metadata schema; added .A_audit_report preferred upstream contract with deterministic .A_ over .R_ tie-break
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 with tiered auto-merge system (Tier 1: <5%, Tier 2: 5-15%, Tier 3: >15%); Auto-generated SPEC IDs (SPEC-NN-COMPONENT-SS pattern); No-deletion policy with [DEPRECATED] marking; Archive manifest creation for Tier 3; Enhanced drift cache with merge history; YAML spec format handling with drift metadata; Change percentage calculation algorithm
1.02026-02-10Initial skill creation; 6-phase fix workflow; YAML structure repair; Schema and config file generation; YAML path-based element IDs; REQ/CTR drift handling; 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

37.3%
按下载量换算78

Claude

28.7%
按下载量换算60

Cursor

17.68%
按下载量换算37

Gemini CLI

9.46%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

只读

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

安装前确认

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

来源信息

继续浏览同类 Skills