← 返回
效率工具 中文

Docs Sync

Keep project documentation in sync with code changes. Identifies which docs need updating after a PR merges or code changes, drafts the updates, and manages...
保持项目文档与代码变更同步。识别PR合并或代码变更后需要更新的文档,起草更新内容,并管理文档更新流程。
chriscox
效率工具 clawhub v1.0.3 1 版本 100000 Key: 无需
★ 1
Stars
📥 684
下载
💾 9
安装
1
版本
#latest

概述

Docs Sync

Prerequisites

  • git
  • gh (GitHub CLI, authenticated via gh auth login)

Keep project documentation current with code changes. Three modes:

  1. Content sync — update doc content after code changes
  2. Site management — maintain doc site structure and navigation
  3. Docs audit — identify stale docs that need attention

Repo Discovery

Before doing anything, discover the project's documentation setup:

  1. Run git rev-parse --show-toplevel to find the repo root
  2. Check for .docs-sync.yml at the repo root — if it exists, read it and use its

values for all paths, roles, and site config

  1. If no config file, auto-discover:
    • Doc site engine: look for mkdocs.yml, docusaurus.config.js, .vitepress/config.*
    • Doc directory: look for docs/, documentation/, wiki/
    • Known doc files: scan for common patterns (see Doc Roles below)
    • Convention files: CLAUDE.md, AGENTS.md, CONTRIBUTING.md
  2. Run gh repo view --json name,owner to confirm the repo

Config File: .docs-sync.yml

Optional config file at repo root. All fields are optional — auto-discovery fills gaps.

See docs-sync.yml in the skill directory for a starter.

# Map your doc files to roles so the skill knows what content belongs where
docs:
  - path: docs/features.md
    role: features

  - path: docs/architecture.md
    role: architecture

  - path: CHANGELOG.md
    role: changelog
    format: keep-a-changelog

  - path: CLAUDE.md
    role: conventions

  - path: README.md
    role: readme

# Doc site configuration (optional)
site:
  engine: mkdocs               # mkdocs | docusaurus | vitepress
  config: mkdocs.yml           # path to site config
  auto_nav: true               # update navigation when docs change

Doc Roles

Roles tell the skill what kind of content a file contains, so it knows how to update it.

RoleContentUpdated when...
--------------------------------
featuresUser-facing feature descriptions, shortcuts, statusNew feature added, feature behavior changes
architectureApp structure, data flow, patterns, diagramsNew components, changed patterns, refactors
conventionsDev setup, coding rules, build commandsBuild process changes, new conventions adopted
changelogVersion-based change historyAny significant change (follows format: keep-a-changelog, conventional, custom)
readmeProject overview, install instructions, quick startMajor features, install process changes
apiAPI reference, endpoints, function signaturesPublic API changes
guideTutorials, how-tos, walkthroughsWorkflow changes, new capabilities
customAnything else — describe in the description fieldBased on your description

Auto-Detection (No Config)

Without a config file, the skill detects roles by filename:

PatternInferred role
-----------------------
feature, capabilityfeatures
architect, design, structurearchitecture
CLAUDE.md, AGENTS.md, CONTRIBUTING.md, conventionconventions
CHANGELOG, CHANGES, HISTORY*changelog
README*readme
api, reference, endpointapi
guide, tutorial, howtoguide

Files not matching any pattern are skipped unless listed in the config.

Workflow: Content Sync

When the user says docs need updating (or after a PR merge):

  1. Identify what changed — determine the scope of code changes:
    • If a PR number is provided: gh pr view --json files,title,body
    • If a commit range: git diff --name-only
    • If unspecified: git diff --name-only HEAD~1 (last commit)
    • Read the actual diffs for changed files to understand what changed, not just which files
  1. Map changes to affected docs — for each changed file, determine which doc

roles are affected:

  • New UI component → features, architecture
  • Changed data model → architecture
  • New keyboard shortcut → features
  • Changed build command → conventions
  • Bug fix → changelog (if tracking fixes)
  • New API endpoint → api, readme (if it's a headline feature)
  1. Read current docs — read each affected doc file to understand current content,

structure, and style

  1. Draft updates — write the specific changes needed for each doc:
    • Match the existing writing style and structure
    • Add to existing sections rather than creating new ones (unless clearly needed)
    • For changelog: add entry under the appropriate version/section
    • For features: add or update the feature entry, not rewrite the whole file
    • For architecture: update the affected section, preserve diagrams
  1. Apply or propose — based on user preference:
    • Direct apply: edit the files, commit to a branch, report what changed
    • Review first: show the proposed changes and ask for approval
    • Issue: create a GitHub issue listing which docs need updating and why

Quality Checklist

Before committing doc updates:

  • [ ] Each update matches the existing style of that doc file
  • [ ] No content was removed that's still accurate
  • [ ] New entries are placed in the correct section (not appended randomly)
  • [ ] Cross-references between docs are consistent
  • [ ] Changelog entries follow the file's existing format
  • [ ] Feature descriptions are user-facing (not implementation details)

Workflow: Site Management

When docs are added, moved, or deleted — keep the site structure current.

mkdocs

  1. Read mkdocs.yml and parse the nav: section
  2. For new docs: determine the correct nav section based on the doc's role and path
  3. Add the entry to nav: in the right position
  4. For moved docs: update the nav path
  5. For deleted docs: remove the nav entry

docusaurus

  1. Check sidebars.js or sidebars.ts
  2. For auto-generated sidebars: ensure the doc has correct frontmatter (sidebar_position, sidebar_label)
  3. For manual sidebars: add/update/remove entries

vitepress

  1. Check .vitepress/config.* for sidebar configuration
  2. Add/update/remove sidebar entries as needed

General Rules

  • Preserve existing organization — don't reorganize the nav, just maintain it
  • Follow naming patterns — if existing entries use Title Case, match that
  • Respect ordering — add new entries at logical positions, not always at the end
  • Update indexes — if a section has an index.md with a list, update it too

Workflow: Docs Audit

When the user asks "which docs are stale?" or "audit my docs":

  1. Discover all doc files (see Repo Discovery)
  2. For each doc file, check git log -1 --format="%ar" -- for last modified
  3. Compare with recent code changes in related areas
  4. Report docs that may be stale:
    • Doc hasn't been updated in a long time but related code changed recently
    • Doc references files/functions/patterns that no longer exist
    • Doc describes behavior that the code no longer implements
  5. Suggest specific updates needed for each stale doc

Important Rules

  • Match existing style — read the doc before updating it. Don't impose a new format.
  • Be surgical — update the specific section that changed, don't rewrite entire docs
  • Features are user-facing — don't write "Added SyncSettingsView.swift", write

"Added sync settings with enable/disable toggle, status indicator, and Sync Now button"

  • Don't remove accurate content — only remove content that's now wrong
  • Commit to a branch — never push directly to main
  • One concern per update — if a PR changed both features and architecture, update

both docs but keep the changes focused on what actually changed

  • Respect repo conventions — if the repo has CLAUDE.md or CONTRIBUTING.md, read

and follow its branch naming, commit message, and PR conventions

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-03-30 12:28 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Obsidian

steipete
操作 Obsidian 仓库(纯 Markdown 笔记)并通过 obsidian-cli 自动化。
★ 432 📥 103,807
productivity

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 445 📥 226,370
productivity

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 440 📥 147,846