doc-sync
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDocumentation Sync Audit
文档同步审计
Audit all project documentation against the actual codebase and report (or fix) any drift.
针对实际代码库审计所有项目文档,并报告(或修复)任何偏差。
Steps
步骤
-
Identify documentation files: Find allfiles in
.md, project root, anddocs/that describe architecture, security, testing, or roadmap..claude/reference/ -
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?
-
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
-
Audit test docs:
- Count actual test files
- Run test suite to get current pass counts
- Compare documented test counts to actual counts
-
Audit roadmap/changelog:
- Check git log for commits not reflected in any documented phase
- Verify completed phases are marked done
-
Audit CLAUDE.md / agent instructions:
- Check naming conventions match actual code patterns
- Verify documented file paths still exist
- Confirm anti-patterns section is current
-
Report findings:
| Doc | Section | Issue | Severity | |-----|---------|-------|----------| -
Fix drift (ifcontains "fix"):
$ARGUMENTS- Make targeted edits to fix each drift item
- Commit with
docs: sync documentation with codebase [doc-sync]
If is empty or "audit", only report — don't edit.
$ARGUMENTS-
识别文档文件:查找、项目根目录和
docs/中所有描述架构、安全、测试或路线图的.claude/reference/文件。.md -
针对代码库审计架构文档:
- 检查主入口点——插件/中间件链是否与文档记录的顺序一致?
- 检查路由目录——是否列出了所有路由模块?
- 检查共享包——是否所有导出都已记录?
- 检查单体仓库布局——文档记录的目录树是否与实际目录结构匹配?
-
审计安全文档:
- 检查安全插件/中间件——是否全部已记录?
- 检查自上次文档更新以来的新安全相关提交
- 验证权限数量是否与实际定义匹配
-
审计测试文档:
- 统计实际测试文件数量
- 运行测试套件以获取当前通过数量
- 将文档记录的测试数量与实际数量进行对比
-
审计路线图/变更日志:
- 检查git日志中是否有未反映在任何已记录阶段的提交
- 验证已完成的阶段是否标记为已完成
-
审计CLAUDE.md / Agent指令:
- 检查命名约定是否与实际代码模式匹配
- 验证文档记录的文件路径是否仍然存在
- 确认反模式部分是最新的
-
报告结果:
| 文档 | 章节 | 问题 | 严重程度 | |-----|---------|-------|----------| -
修复偏差(如果包含"fix"):
$ARGUMENTS- 进行针对性编辑以修复每个偏差项
- 使用提交信息提交
docs: sync documentation with codebase [doc-sync]
如果为空或为"audit",则仅报告——不进行编辑。
$ARGUMENTSArguments
参数
- :
$ARGUMENTS(default, report only) oraudit(report and fix drift)fix
- :
$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 - 任何结构变更后(新插件、路由、迁移)