Token导航 LogoToken导航

Agent Skill · 研究检索

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

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

doc-spec-fixer 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 48,992。

总安装 667周安装 27GitHub Stars 14下载 210核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 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

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

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

来源仓库内路径:skills/doc-spec-fixer

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/vladm3105/aidoc-flow-framework --skill doc-spe…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

doc-spec-fixer 怎么安装?

在终端执行 npx skills add https://github.com/vladm3105/aidoc-flow-framework --skill doc-spec-fixer。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

doc-spec-fixer 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

doc-spec-fixer 需要什么权限?

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

doc-spec-fixer 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

doc-spec-fixer 用的人多吗?

公开数据是累计安装 667 次,近一周安装 27 次,下载 210 次,GitHub 14 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

doc-spec-fixer 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 标注为只读权限,试用阶段不容易误改本地文件。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 只想先试试效果、不希望它改动本地文件的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
doc-spec-fixer

文档规范修复程序 · 本页

66714只读未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

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.

平台分布

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 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills