Token导航 LogoToken导航

Agent Skill · 研究检索

doc-ctr-fixer(文档 CTR 修复程序)

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

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

总安装 612周安装 26GitHub Stars 14下载 214核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

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

用于修复已审核的数据合同文档,根据审查报告自动修正内容问题。适用于CTR文档的迭代优化,提升合同质量和可读性。运行于doc-ctr-reviewer之后,自动应用修复建议并生成修复报告。需配合审查报告使用,确保修改基于事实依据,不夸大能力或虚构信息。

doc-ctr-fixer 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

doc-ctr-fixer 怎么安装?

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

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

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

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

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

doc-ctr-fixer 是免费的吗?

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

doc-ctr-fixer 用的人多吗?

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

doc-ctr-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-ctr-fixer

文档 CTR 修复程序 · 本页

61214需要联网未明确有提醒

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

SKILL.md 原文

doc-ctr-fixer

Purpose

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

Layer: 8 (CTR Quality Improvement)

Upstream: REQ documents, CTR document, Review Report (CTR-NN-SSS.R_review_report_vNNN.md)

Downstream: Fixed CTR (MD + YAML), Fix Report (CTR-NN-SSS.F_fix_report_vNNN.md)


When to Use This Skill

Use doc-ctr-fixer when:

  • After Review: Run after doc-ctr-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 CTRs based on review reports
  • Dual-File Sync Issues: MD and YAML content has diverged

Do NOT use when:

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

Skill Dependencies

SkillPurposeWhen Used
doc-ctr-reviewerSource of issues to fixInput (reads review report)
doc-namingElement ID standardsFix element IDs
doc-ctrCTR creation rulesCreate missing sections
doc-reqREQ traceabilityValidate upstream links

Workflow Overview

flowchart TD
    A[Input: CTR Path] --> B[Find Latest Review Report]
    B --> C{Review Found?}
    C -->|No| D[Run doc-ctr-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 DualFileSync["Dual-File Synchronization"]
        K2 --> L1{MD + YAML Exist?}
        L1 -->|Yes| L2[Sync MD <-> YAML]
        L1 -->|No| L3[Create Missing File]
        L2 --> L4[Validate Consistency]
        L3 --> L4
    end

    L4 --> M[Write Fixed CTR Files]
    M --> N[Generate Fix Report]
    N --> O{Re-run Review?}
    O -->|Yes| P[Invoke doc-ctr-reviewer]
    P --> Q{Score >= Threshold?}
    Q -->|No, iterations < max| F
    Q -->|Yes| R[COMPLETE]
    O -->|No| R

Fix Phases

Phase 0: Fix Structure Violations (CRITICAL)

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

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

Required Structure:

CTR TypeRequired Location
Dual-Filedocs/08_CTR/CTR-NN_{slug}/CTR-NN_{slug}.md + CTR-NN_{slug}.yaml

Fix Actions:

Issue CodeIssueFix Action
REV-STR001CTR not in nested folderCreate folder, move both files, update all links
REV-STR002CTR folder name doesn't match CTR IDRename folder to match
REV-STR003CTR >25KB should be sectionedFlag for manual review

Structure Fix Workflow:

def fix_ctr_structure(ctr_path: str) -> list[Fix]:
    """Fix CTR structure violations."""
    fixes = []

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

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

    ctr_id = match.group(1)
    slug = match.group(2)
    expected_folder = f"CTR-{ctr_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 both .md and .yaml files
        base_name = f"CTR-{ctr_id}_{slug}"
        for ext in ['.md', '.yaml']:
            old_file = os.path.join(parent_folder, base_name + ext)
            if os.path.exists(old_file):
                new_file = os.path.join(new_folder, base_name + ext)
                shutil.move(old_file, new_file)
                fixes.append(f"Moved {old_file} to {new_file}")

        # Update upstream links in moved .md file
        md_path = os.path.join(new_folder, base_name + '.md')
        if os.path.exists(md_path):
            content = Path(md_path).read_text()
            updated_content = content.replace('../07_REQ/', '../../07_REQ/')
            updated_content = updated_content.replace('../06_SYS/', '../../06_SYS/')
            Path(md_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
../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
CTR-NN-SSS.yamlCreate YAML contract from MDYAML contract template
CTR-NN-SSS.mdCreate MD documentation from YAMLMD contract template
Schema files (*_schema.json)Create placeholder schemaJSON Schema template
Reference docsCreate placeholderREF template

YAML Contract Template:

# CTR-NN-SSS: [Contract Name]
# Auto-generated by doc-ctr-fixer - requires completion

contract:
  id: CTR-NN-SSS
  name: "[Contract Name]"
  version: "1.0.0"
  status: draft
  created: "YYYY-MM-DD"

metadata:
  layer: 8
  artifact_type: CTR
  upstream_req: REQ-NN

interface:
  type: "[API|EVENT|DATA|SERVICE]"
  protocol: "[HTTP|gRPC|AMQP|Kafka]"

endpoints: []
  # TODO: Define endpoints

schemas: []
  # TODO: Define schemas

validation:
  # TODO: Define validation rules

MD Contract Template:

---
title: "CTR-NN-SSS: [Contract Name]"
tags:
  - ctr
  - contract
  - layer-8
custom_fields:
  document_type: contract
  artifact_type: CTR
  layer: 8
  upstream_req: REQ-NN
  yaml_companion: CTR-NN-SSS.yaml
---

# CTR-NN-SSS: [Contract Name]

> **Status**: Placeholder - Requires completion

## 1. Contract Overview

[TODO: Document contract purpose and scope]

## 2. Interface Definition

[TODO: Define interface specifications]

## 3. Data Schemas

[TODO: Document data schemas]

## 4. Validation Rules

[TODO: Define validation rules]

---

*Created by doc-ctr-fixer as placeholder. Complete this document to resolve 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-L004YAML reference brokenUpdate YAML $ref path
REV-L005Schema reference invalidFix JSON Schema $ref

Path Resolution Logic:

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

    # CTR files: docs/08_CTR/CTR-01-API.md + CTR-01-API.yaml
    # Schema files: docs/08_CTR/schemas/

    if is_yaml_reference(target_path):
        return fix_yaml_ref(ctr_location, target_path)
    elif is_schema_reference(target_path):
        return fix_schema_ref(ctr_location, target_path)
    else:
        return calculate_relative_path(ctr_location, target_path)

YAML Reference Fix:

Reference TypeOriginalFixed
Schema ref$ref: schema.json$ref:./schemas/schema.json
Component ref$ref: #/components/Validate path exists
External ref$ref: http://...Add warning if unreachable

Phase 3: Fix Element IDs

Converts invalid element IDs to correct format.

Conversion Rules:

PatternIssueConversion
CTR.NN.XX.SSInvalid type codeConvert to valid CTR code
API-XXXLegacy patternCTR.NN.16.SS
INT-XXXLegacy patternCTR.NN.16.SS
MODEL-XXXLegacy patternCTR.NN.17.SS
SCHEMA-XXXLegacy patternCTR.NN.17.SS
CLAUSE-XXXLegacy patternCTR.NN.20.SS

Type Code Mapping (CTR-specific per ID_NAMING_STANDARDS.md):

Invalid CodeValid CodeElement Type
0116Interface
0217Data Model
2816Interface (legacy)
2917Data Model (legacy)
Any other16/17/20Map to interface, data model, or clause

Valid CTR Type Codes:

CodeElement TypeDescription
16InterfaceAPI endpoints, service interfaces
17Data ModelSchemas, data structures
20Contract ClauseContract terms, validation rules

Regex Patterns:

# Find element IDs with invalid type codes for CTR
invalid_ctr_type = r'CTR\.(\d{2})\.(?!16|17|20)(\d{2})\.(\d{2})'

# Find legacy patterns
legacy_api = r'###\s+API-(\d+):'
legacy_evt = r'###\s+EVT-(\d+):'
legacy_schema = r'###\s+SCHEMA-(\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-Y001Invalid YAML syntaxAttempt YAML repair
REV-Y002Missing required YAML fieldAdd field with placeholder

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 Repair Actions:

YAML IssueRepair Action
Missing quotesAdd quotes around string values
Invalid indentationFix to 2-space indent
Duplicate keysKeep first, comment duplicates
Missing colonsAdd colons after keys

Phase 5: Update References

Ensures traceability and cross-references are correct.

Fix Actions:

IssueFix Action
Missing @req: referenceAdd REQ traceability tag
Incorrect REQ pathUpdate to correct relative path
Missing traceability entryAdd to traceability matrix
Orphan YAML companionLink MD and YAML files

REQ Traceability Fix:

<!-- Before -->
## 3. Interface Endpoints

<!-- After -->
## 3. Interface Endpoints

@req: [REQ-01.28.01](../07_REQ/REQ-01.md#req-01-28-01)

Phase 6: Handle Upstream Drift (Auto-Merge)

Addresses issues where upstream REQ documents have changed since CTR 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

Upstream: REQ (Layer 7) Downstream: SPEC (Layer 9)

Contract ID Pattern

Format: CTR-NN-TYPE-SS

ComponentDescriptionExamples
CTRArtifact prefixCTR
NNDocument number (01-99)01, 02, 15
TYPEContract typeAPI, DATA, EVENT, SERVICE
SSSequence within type (01-99)01, 02, 13

Auto-Generated ID Examples:

  • CTR-01-API-01 - First API contract in document 01
  • CTR-01-API-13 - 13th API contract in document 01
  • CTR-02-DATA-05 - 5th data contract in document 02
  • CTR-03-EVENT-02 - 2nd event contract in document 03
Tiered Auto-Merge System

Change percentage is calculated by comparing upstream REQ content hash at CTR creation vs current:

def calculate_drift_percentage(ctr_path: str, req_path: str) -> float:
    """Calculate percentage of upstream REQ changes affecting CTR."""
    drift_cache = load_drift_cache(ctr_path)
    original_hash = drift_cache.get('req_content_hash')
    current_hash = compute_content_hash(req_path)

    if original_hash == current_hash:
        return 0.0

    # Line-by-line diff comparison
    original_lines = drift_cache.get('req_snapshot_lines', [])
    current_lines = read_file_lines(req_path)

    changed_lines = len(set(original_lines) ^ set(current_lines))
    total_lines = max(len(original_lines), len(current_lines))

    return (changed_lines / total_lines) * 100
TierChange %ActionVersion Impact
Tier 1< 5%Auto-merge contract updatesPatch increment (1.0.0 → 1.0.1)
Tier 25-15%Auto-merge with detailed changelogMinor increment (1.0.0 → 1.1.0)
Tier 3> 15%Archive current, trigger regenerationMajor increment (1.0.0 → 2.0.0)
Tier 1: Minor Drift (< 5%)

Auto-merge with minimal disruption:

Actions:

  1. Update @req: references to current REQ version
  2. Sync metadata fields from REQ
  3. Increment contract patch version
  4. Update drift cache

Example Update:

# Before (CTR-01-API-05.yaml)
contract:
  id: CTR-01-API-05
  version: "1.0.0"
  req_version: "1.0.0"

# After auto-merge
contract:
  id: CTR-01-API-05
  version: "1.0.1"
  req_version: "1.0.1"
  last_merge: "2026-02-10T16:00:00"
Tier 2: Moderate Drift (5-15%)

Auto-merge with detailed changelog:

Actions:

  1. All Tier 1 actions
  2. Generate detailed changelog entry
  3. Add [MERGED] markers to affected sections
  4. Increment contract minor version
  5. Update companion MD file with changelog

Changelog Format:

## Changelog

### v1.1.0 (2026-02-10) - Auto-Merged

**Upstream Changes** (REQ-01.md v1.0.0 → v1.1.0):
- Modified: REQ-01.28.03 - Updated validation rules
- Added: REQ-01.28.07 - New authentication requirement
- Drift: 8.5%

**Contract Updates**:
- [MERGED] Section 3.2: Updated schema validation
- [MERGED] Section 4.1: Added auth contract reference
Tier 3: Significant Drift (> 15%)

Archive and regenerate:

Actions:

  1. Create archive manifest
  2. Move current CTR to archive
  3. Trigger CTR regeneration via doc-ctr-autopilot
  4. Increment major version
  5. Link archive in new CTR

Archive Manifest (CTR-NN-TYPE_archive_manifest.yaml):

# CTR Archive Manifest
archive:
  original_id: CTR-01-API-05
  archived_version: "1.1.0"
  archive_date: "2026-02-10T16:00:00"
  archive_reason: "upstream_drift_exceeded_15%"
  drift_percentage: 23.5

upstream_trigger:
  document: REQ-01.md
  original_version: "1.0.0"
  current_version: "2.0.0"

archived_files:
  - path: "archive/CTR-01-API-05_v1.1.0.md"
    hash: "sha256:abc123..."
  - path: "archive/CTR-01-API-05_v1.1.0.yaml"
    hash: "sha256:def456..."

regeneration:
  new_id: CTR-01-API-05
  new_version: "2.0.0"
  trigger_skill: doc-ctr-autopilot
  regenerated: "2026-02-10T16:05:00"
No Deletion Policy

Contracts are NEVER deleted. When a contract becomes obsolete:

Deprecation Marker:

# CTR-01-API-03.yaml
contract:
  id: CTR-01-API-03
  status: "[DEPRECATED]"
  deprecated_date: "2026-02-10"
  deprecated_reason: "Superseded by CTR-01-API-15"
  successor: CTR-01-API-15

MD Deprecation Header:

---
status: deprecated
deprecated_date: "2026-02-10"
successor: CTR-01-API-15
---

# CTR-01-API-03: Legacy User Authentication Contract

> **[DEPRECATED]** This contract has been superseded by [CTR-01-API-15](./CTR-01-API-15.md).
> Retained for historical reference and backward compatibility documentation.
Enhanced Drift Cache

The drift cache tracks merge history for audit purposes:

File: .drift_cache.json (per CTR directory)

{
  "CTR-01-API-05": {
    "current_version": "1.1.0",
    "req_content_hash": "sha256:abc123...",
    "req_snapshot_lines": ["line1", "line2", "..."],
    "last_checked": "2026-02-10T16:00:00",
    "last_modified": "2026-02-10T15:30:00",
    "merge_history": [
      {
        "date": "2026-02-08T14:00:00",
        "tier": 1,
        "drift_percentage": 3.2,
        "version_before": "1.0.0",
        "version_after": "1.0.1",
        "req_version": "1.0.1"
      },
      {
        "date": "2026-02-10T16:00:00",
        "tier": 2,
        "drift_percentage": 8.5,
        "version_before": "1.0.1",
        "version_after": "1.1.0",
        "req_version": "1.1.0",
        "changelog_entries": 3
      }
    ],
    "archive_history": []
  }
}
File Type Handling

Both .md and .yaml contract files are processed:

File TypeMerge Actions
.mdUpdate frontmatter, @req references, changelog section
.yamlUpdate contract metadata, version, timestamps
BothSync version numbers, maintain dual-file consistency

Sync Order:

  1. Process YAML first (authoritative for contract data)
  2. Sync changes to MD companion
  3. Update drift cache
  4. Generate fix report entry
Drift Issue Codes
CodeSeverityTierDescriptionAction
REV-D001Info1Minor REQ modification (< 5%)Auto-merge, patch version
REV-D002Warning2Moderate REQ modification (5-15%)Auto-merge with changelog, minor version
REV-D003Error3Major REQ modification (> 15%)Archive and regenerate, major version
REV-D004Info1-2New requirements addedAdd contract stubs
REV-D005WarningN/ADeprecated contract referencedUpdate reference to successor

Dual-File Synchronization

CTR documents consist of paired MD + YAML files that must remain synchronized.

Sync Detection

Sync IssueDetectionResolution
MD exists, YAML missingCheck for companion fileGenerate YAML from MD
YAML exists, MD missingCheck for companion fileGenerate MD from YAML
Content mismatchCompare key fieldsReconcile differences
Version mismatchCompare version fieldsUpdate to latest

Sync Actions

MD to YAML Sync:

MD SectionYAML Field
Titlecontract.name
Versioncontract.version
Interface endpointsendpoints[]
Data schemasschemas[]
Validation rulesvalidation

YAML to MD Sync:

YAML FieldMD Section
contract.nameTitle
endpoints[]Interface Endpoints section
schemas[]Data Schemas section
validationValidation Rules section

Conflict Resolution

Conflict TypeResolution Strategy
Both modified same fieldFlag for manual review
YAML has newer dataUpdate MD from YAML
MD has newer dataUpdate YAML from MD
Structural differenceKeep MD structure, sync data

Command Usage

Basic Usage

# Fix CTR based on latest review
/doc-ctr-fixer CTR-01-API

# Fix with explicit review report
/doc-ctr-fixer CTR-01-API --review-report CTR-01-API.R_review_report_v001.md

# Fix and re-run review
/doc-ctr-fixer CTR-01-API --revalidate

# Fix with iteration limit
/doc-ctr-fixer CTR-01-API --revalidate --max-iterations 3

# Sync dual files only
/doc-ctr-fixer CTR-01-API --sync-only

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 CTR before fixing
--dry-runfalsePreview fixes without applying
--sync-onlyfalseOnly sync MD/YAML, skip other fixes
--acknowledge-driftfalseInteractive drift acknowledgment mode
--update-drift-cachetrueUpdate.drift_cache.json after fixes

Fix Types

TypeDescription
missing_filesCreate missing YAML, MD, schema docs
broken_linksFix link paths and YAML refs
element_idsConvert invalid/legacy element IDs
contentFix placeholders, dates, YAML syntax
referencesUpdate REQ traceability and cross-references
driftHandle upstream drift detection issues
syncSynchronize MD and YAML companion files
allAll fix types (default)

Output Artifacts

Fix Report

Nested Folder Rule: ALL CTR use nested folders (CTR-NN_{slug}/) regardless of size. Fix reports are stored alongside the CTR dual files (.md +.yaml) in the nested folder.

File Naming: CTR-NN-SSS.F_fix_report_vNNN.md

Location: Inside the CTR nested folder: docs/08_CTR/CTR-NN_{slug}/

Structure:

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

# CTR-NN-SSS Fix Report v001

## Summary

| Metric | Value |
|--------|-------|
| Source Review | CTR-NN-SSS.R_review_report_v001.md |
| Issues in Review | 15 |
| Issues Fixed | 12 |
| Issues Remaining | 3 (manual review required) |
| Files Created | 1 |
| Files Modified | 2 |
| Dual-File Sync | Completed |

## Files Created

| File | Type | Location |
|------|------|----------|
| CTR-01-API.yaml | YAML Contract | docs/08_CTR/ |

## Dual-File Sync Status

| MD File | YAML File | Sync Status | Action |
|---------|-----------|-------------|--------|
| CTR-01-API.md | CTR-01-API.yaml | Synchronized | Generated YAML from MD |

## Fixes Applied

| # | Issue Code | Issue | Fix Applied | File |
|---|------------|-------|-------------|------|
| 1 | REV-L004 | Broken YAML ref | Updated schema path | CTR-01-API.yaml |
| 2 | REV-N004 | Invalid element type | Converted to type 16 | CTR-01-API.md |
| 3 | REV-Y001 | Invalid YAML syntax | Fixed indentation | CTR-01-API.yaml |

## Issues Requiring Manual Review

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

## Upstream Drift Summary

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

## Validation After Fix

| Metric | Before | After | Delta |
|--------|--------|-------|-------|
| Review Score | 88 | 96 | +8 |
| Errors | 3 | 0 | -3 |
| Warnings | 5 | 2 | -3 |

## Next Steps

1. Complete [TODO] placeholders in CTR-01-API.md
2. Review upstream REQ drift
3. Run `/doc-ctr-reviewer CTR-01-API` to verify fixes

Integration with Autopilot

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

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

Error Handling

Recovery Actions

ErrorAction
Review report not foundPrompt to run doc-ctr-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
Dual-file conflictFlag for manual resolution

Backup Strategy

Before applying any fixes:

  1. Create backup in tmp/backup/CTR-NN-SSS_YYYYMMDD_HHMMSS/
  2. Copy all CTR files (MD + YAML) to backup location
  3. Apply fixes to original files
  4. If error during fix, restore from backup

Related Skills

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

Version History

VersionDateChanges
2.22026-02-26Element Type Code Alignment: Updated type codes from 28, 29 to 16, 17, 20 per ID_NAMING_STANDARDS.md; Fixed paths from ai_dev_flow/CTR/ to ai_dev_ssd_flow/08_CTR/
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; Added Tier 1/2/3 thresholds (<5%, 5-15%, >15%); Contract ID pattern CTR-NN-TYPE-SS; No deletion policy with [DEPRECATED] markers; Archive manifest for Tier 3; Enhanced drift cache with merge history; Support for both.md and.yaml contract files
1.02026-02-10Initial skill creation; 6-phase fix workflow; Dual-file (MD + YAML) synchronization; Element ID conversion (types 28, 29); YAML syntax repair; REQ 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

32.95%
按下载量换算71

Claude

33.18%
按下载量换算71

Cursor

17.6%
按下载量换算38

Gemini CLI

10.22%
按下载量换算22

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

继续浏览同类 Skills