文档同步
- 作者仓库星标 3,406
- 作者更新于 实时读取
- 作者仓库 claude-octopus
- 领域
- 写作
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @nyldn · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需手动接入
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- Docker
- 底层运行要求
- Docker
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: skill-doc-sync
description: Post-ship doc sync across project markdown. Use when: sync docs, update docs, document changes…
category: 写作
runtime: Docker
---
# skill-doc-sync 输出预览
## PART A: 任务判断
- 适用问题:文章、文案、发言稿、润色或结构化表达。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Caps / Step 1: Discover Docs / Step 2: Cross-Reference Diff”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于文章、文案、发言稿、润色或结构化表达,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Caps / Step 1: Discover Docs / Step 2: Cross-Reference Diff”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/octo` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Caps / Step 1: Discover Docs / Step 2: Cross-Reference Diff”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: skill-doc-sync
description: Post-ship doc sync across project markdown. Use when: sync docs, update docs, document changes…
category: 写作
source: nyldn/claude-octopus
---
# skill-doc-sync
## 什么时候使用
- 把写作方向的常用动作沉淀成 Agent 可调用的技能 适合处理文章、文案、润色、翻译、总结和结构化表达,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;通常…
- 面向文章、文案、发言稿、润色或结构化表达,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Caps / Step 1: Discover Docs / Step 2: Cross-Reference Diff」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "skill-doc-sync" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Caps / Step 1: Discover Docs / Step 2: Cross-Reference Diff
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Docker | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Host: Codex CLI — This skill was designed for Claude Code and adapted for Codex. Cross-reference commands use installed skill names in Codex rather than
/octo:*slash commands. Use the active Codex shell and subagent tools. Do not claim a provider, model, or host subagent is available until the current session exposes it. For host tool equivalents, seeskills/blocks/codex-host-adapter.md.
Post-Ship Documentation Synchronization
Automated documentation synchronization for the Deliver phase. After code is committed and a PR is created, this skill reads all .md files in the project, cross-references the diff, auto-updates factual content, checks cross-doc consistency, and updates the PR body.
Caps
- Max 30 doc files scanned — skip files beyond the cap, warn the user
- Never clobber CHANGELOG — append only, never delete existing entries
- Ask user before changing narrative/philosophy sections — risky changes require confirmation
Step 1: Discover Docs
Find all .md files in the project root (max depth 2), skipping node_modules/ and .git/.
# Discover all markdown files (max depth 2, skip noise directories)
DOC_FILES=$(find . -maxdepth 2 -name '*.md' \
-not -path './node_modules/*' \
-not -path './.git/*' \
-not -path './vendor/*' \
-not -path './.claude/*' \
2>/dev/null | head -30)
DOC_COUNT=$(echo "$DOC_FILES" | wc -l | tr -d ' ')
echo "Found $DOC_COUNT doc files to scan (cap: 30)"
if [[ "$DOC_COUNT" -ge 30 ]]; then
echo "WARNING: Doc file cap reached (30). Some files may be skipped."
fi
Read each discovered doc file so you have their current content in context.
Step 2: Cross-Reference Diff
Run git diff --stat HEAD~1 (or diff against the base branch if on a feature branch) to identify which files changed and what content may now be stale in each doc.
# Get the diff stat to identify changed files
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" == "main" || "$BRANCH" == "master" ]]; then
DIFF_STAT=$(git diff --stat HEAD~1)
DIFF_FULL=$(git diff HEAD~1)
else
BASE_BRANCH=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)
DIFF_STAT=$(git diff --stat "$BASE_BRANCH"..HEAD)
DIFF_FULL=$(git diff "$BASE_BRANCH"..HEAD)
fi
echo "$DIFF_STAT"
For each doc file, check whether any paths, function names, counts, or version numbers mentioned in the doc were affected by the diff.
Step 3: Auto-Update Factual Corrections
Fix paths, counts, table entries, and version numbers automatically. These are mechanical changes that do not alter meaning.
Auto-update targets:
- File paths that were renamed or moved in the diff
- Numeric counts (e.g., "42 tests" when the number changed)
- Version strings (e.g.,
v9.5.0whenpackage.jsonbumped) - Table entries referencing renamed or removed items
- Import/require paths that changed
WHY: Stale factual references erode trust in documentation. A user who sees a wrong path or count will doubt everything else in the doc.
Step 4: Risky Change Detection
Flag narrative, philosophy, or security-related doc sections for user confirmation. Do NOT auto-edit these.
Risky categories (require user approval):
- Sections with headings containing: "Philosophy", "Principles", "Vision", "Mission", "Security", "Threat Model", "Architecture Decision"
- Paragraphs that express opinion, strategy, or rationale (not just facts)
- Content under
## Whyor## Rationaleheadings - Any changes to
SECURITY.mdorCONTRIBUTING.mdbeyond version bumps
WHY: Narrative and philosophy sections reflect human judgment. Silently rewriting them risks misrepresenting the project's intent.
When risky changes are detected, present them to the user:
The following doc sections may need updating but contain narrative/philosophy content.
I will NOT auto-edit these. Please review and confirm each change:
1. README.md ## Philosophy — mentions "single-binary deployment" but diff adds Docker support
2. SECURITY.md ## Threat Model — new auth endpoint not documented
Approve changes? (list numbers to approve, or "skip all")
Step 5: CHANGELOG Voice Polish
Apply the "sell test" to every CHANGELOG entry: "Would a user reading this bullet think 'oh nice, I want to try that'?"
Rules:
- Lead with the user benefit, not the implementation detail
- Use active voice ("Add X" not "X was added")
- Keep bullets under 120 characters
- Never delete existing CHANGELOG entries (append only)
- Group by: Added, Changed, Fixed, Removed (Keep a Changelog format)
Example transformations:
BAD: "Refactored spawn_agent to use parameter expansion instead of basename"
GOOD: "Speed up agent spawning by eliminating 750 subshell forks (92% reduction)"
BAD: "Added SUPPORTS_MCP_ELICITATION flag"
GOOD: "Support MCP elicitation for richer interactive prompts (CC v2.1.76+)"
WHY: The CHANGELOG is marketing copy for developers. Every bullet should make someone want to upgrade.
Step 6: Cross-Doc Consistency
Check that key values are aligned across all documentation files.
Consistency checks:
- Version numbers match across
README.md,CLAUDE.md,package.json,CHANGELOG.md, and any other files referencing the current version - Feature lists in README match what is actually implemented (cross-reference with command/skill directories)
- Badge URLs and shield.io references are up to date
- Links between docs are not broken (relative path references)
- Command counts and skill counts match actual directory listings
# Example: check version consistency
PKG_VERSION=$(grep '"version"' package.json | head -1 | sed 's/.*"version": *"//' | sed 's/".*//')
echo "package.json version: $PKG_VERSION"
# Check README mentions this version
if ! grep -q "$PKG_VERSION" README.md 2>/dev/null; then
echo "WARNING: README.md does not mention version $PKG_VERSION"
fi
# Check CHANGELOG has an entry for this version
if ! grep -q "$PKG_VERSION" CHANGELOG.md 2>/dev/null; then
echo "WARNING: CHANGELOG.md has no entry for version $PKG_VERSION"
fi
Step 7: Discoverability Check
Ensure every documentation file is reachable from README.md or CLAUDE.md. Orphaned docs are invisible docs.
Check:
- Every
.mdfile in the project should be linked from eitherREADME.mdorCLAUDE.md(directly or transitively through another linked doc) - Flag orphaned docs that have no inbound links
- Suggest where to add links for orphaned docs
WHY: Documentation that cannot be found does not exist from the user's perspective. Every doc must be one or two clicks from the entry points.
Step 8: TODOS.md Update
Update the project's task tracking based on the diff.
Actions:
- Mark completed items: scan TODO/FIXME/HACK comments that were removed in the diff and mark corresponding items as done
- Flag new deferred work: scan TODO/FIXME/HACK comments that were added in the diff and create new tracking entries
- Update completion percentages if the project uses progress tracking
# Find new TODOs added in the diff
NEW_TODOS=$(echo "$DIFF_FULL" | grep '^+' | grep -iE 'TODO|FIXME|HACK' | grep -v '^+++' || true)
if [[ -n "$NEW_TODOS" ]]; then
echo "New TODOs found in diff:"
echo "$NEW_TODOS"
fi
# Find TODOs removed in the diff
REMOVED_TODOS=$(echo "$DIFF_FULL" | grep '^-' | grep -iE 'TODO|FIXME|HACK' | grep -v '^---' || true)
if [[ -n "$REMOVED_TODOS" ]]; then
echo "Resolved TODOs (removed in diff):"
echo "$REMOVED_TODOS"
fi
Step 9: Commit Doc Changes
Commit all documentation changes to the current branch and update the PR body with a doc-sync summary.
# Stage only .md files that were modified by this skill
git add *.md docs/*.md 2>/dev/null || true
# Check if there are staged changes
if git diff --cached --quiet; then
echo "No documentation changes needed — all docs are up to date."
else
git commit -m "docs: post-ship documentation sync
- Auto-updated paths, counts, and version references
- CHANGELOG entries polished for user benefit
- Cross-doc consistency verified
- Discoverability check passed
"
echo "Documentation sync committed."
fi
If a PR exists for the current branch, update its body to include a doc-sync section:
# Update PR body with doc-sync summary (if PR exists)
PR_NUMBER=$(gh pr view --json number -q '.number' 2>/dev/null || true)
if [[ -n "$PR_NUMBER" ]]; then
echo "Updating PR #$PR_NUMBER with doc-sync summary..."
fi
Integration
This skill is designed to work as a sub-step of flow-deliver. After validation and review are complete, invoke doc-sync to ensure documentation stays current with the shipped code.
Invocation from flow-deliver:
After PR creation and CI passes:
1. Run doc-sync to update documentation
2. Push doc changes to the PR branch
3. Re-run CI if doc changes affect tests
Standalone invocation:
User: "sync docs"
User: "update documentation after merge"
User: "document changes from last release"
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核