doc-sync

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Documentation Sync Audit

文档同步审计

Audit all project documentation against the actual codebase and report (or fix) any drift.
针对实际代码库审计所有项目文档,并报告(或修复)任何偏差。

Steps

步骤

  1. Identify documentation files: Find all
    .md
    files in
    docs/
    , project root, and
    .claude/reference/
    that describe architecture, security, testing, or roadmap.
  2. Audit architecture docs against the codebase:
    • Check main entry point — does the plugin/middleware chain match the documented order?
    • Check routes directory — are all route modules listed?
    • Check shared packages — are all exports documented?
    • Check monorepo layout — does the documented tree match actual directory structure?
  3. Audit security docs:
    • Check security plugins/middleware — are all documented?
    • Check for new security-related commits since last doc update
    • Verify permission counts match actual definitions
  4. Audit test docs:
    • Count actual test files
    • Run test suite to get current pass counts
    • Compare documented test counts to actual counts
  5. Audit roadmap/changelog:
    • Check git log for commits not reflected in any documented phase
    • Verify completed phases are marked done
  6. Audit CLAUDE.md / agent instructions:
    • Check naming conventions match actual code patterns
    • Verify documented file paths still exist
    • Confirm anti-patterns section is current
  7. Report findings:
    | Doc | Section | Issue | Severity |
    |-----|---------|-------|----------|
  8. Fix drift (if
    $ARGUMENTS
    contains "fix"):
    • Make targeted edits to fix each drift item
    • Commit with
      docs: sync documentation with codebase [doc-sync]
If
$ARGUMENTS
is empty or "audit", only report — don't edit.
  1. 识别文档文件:查找
    docs/
    、项目根目录和
    .claude/reference/
    中所有描述架构、安全、测试或路线图的
    .md
    文件。
  2. 针对代码库审计架构文档
    • 检查主入口点——插件/中间件链是否与文档记录的顺序一致?
    • 检查路由目录——是否列出了所有路由模块?
    • 检查共享包——是否所有导出都已记录?
    • 检查单体仓库布局——文档记录的目录树是否与实际目录结构匹配?
  3. 审计安全文档
    • 检查安全插件/中间件——是否全部已记录?
    • 检查自上次文档更新以来的新安全相关提交
    • 验证权限数量是否与实际定义匹配
  4. 审计测试文档
    • 统计实际测试文件数量
    • 运行测试套件以获取当前通过数量
    • 将文档记录的测试数量与实际数量进行对比
  5. 审计路线图/变更日志
    • 检查git日志中是否有未反映在任何已记录阶段的提交
    • 验证已完成的阶段是否标记为已完成
  6. 审计CLAUDE.md / Agent指令
    • 检查命名约定是否与实际代码模式匹配
    • 验证文档记录的文件路径是否仍然存在
    • 确认反模式部分是最新的
  7. 报告结果
    | 文档 | 章节 | 问题 | 严重程度 |
    |-----|---------|-------|----------|
  8. 修复偏差(如果
    $ARGUMENTS
    包含"fix"):
    • 进行针对性编辑以修复每个偏差项
    • 使用提交信息
      docs: sync documentation with codebase [doc-sync]
      提交
如果
$ARGUMENTS
为空或为"audit",则仅报告——不进行编辑。

Arguments

参数

  • $ARGUMENTS
    :
    audit
    (default, report only) or
    fix
    (report and fix drift)
  • $ARGUMENTS
    audit
    (默认,仅报告)或
    fix
    (报告并修复偏差)

When to Run

运行时机

  • Before creating a pull request (
    /doc-sync audit
    )
  • After completing a development phase (
    /doc-sync fix
    )
  • After any structural changes (new plugins, routes, migrations)
  • 创建拉取请求前(
    /doc-sync audit
  • 完成开发阶段后(
    /doc-sync fix
  • 任何结构变更后(新插件、路由、迁移)