document
Code-is-truth documentation sync. Detects drift between the codebase and project docs (STATUS.md, CLAUDE.md, README), then applies targeted edits so docs describe what the code actually is. Use this after shipping features, before a release, or when docs feel stale. Secret-scans every doc before writing. Makes small surgical edits, never wholesale rewrites.
- License 许可
- MIT
- 最近更新
- 2026-06-23
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- document
- description
- Code-is-truth documentation sync. Detects drift between the codebase and project docs (STATUS.md, CLAUDE.md, README), then applies targeted edits so docs describe what the code actually is. Use this after shipping features, before a release, or when docs feel stale. Secret-scans every doc before writing. Makes small surgical edits, never wholesale rewrites.
03 SKILL.md 正文
document — Documentation Sync
Scan the code, detect drift from the docs, and patch the docs to match reality.
Usage: /document
Phase 1: Scan the Code (source of truth)
Genericize these probes to the project's actual layout. The goal is a current inventory of routes, modules, data models, and surfaces.
# Recent activity
git log --oneline -10
# Source size / shape («adjust glob to project language»)
find src -type f | wc -l
# Public entry points / routes («PLACEHOLDER: e.g. ls api/ or routes manifest»)
ls api/ 2>/dev/null
# Modules of interest («PLACEHOLDER: commands/ services/ handlers/ ...»)
ls src/services/ src/commands/ 2>/dev/null
# Data models («PLACEHOLDER: ORM schema, e.g. grep '^model ' prisma/schema.prisma»)
# Skills / commands available
ls .claude/skills/ .claude/commands/ 2>/dev/null
Phase 2: Secret Scan (before any write)
grep -rn -iE "(sk_|pk_|api[_-]?key|secret|password|token|[a-z]+://[^ ]*:[^ ]*@)" \
README.md CLAUDE.md docs/ .claude/ \
--include="*.md" 2>/dev/null
If anything real is matched: STOP, alert the user, and remove the secret before writing anything. Do not commit.
Phase 3: Apply Targeted Edits
Update only the parts that drifted.
STATUS.md (path docs/STATUS.md or docs/status/STATUS.md)
- Last-updated date
- Completed work / recent PRs
- Current phase and next steps
- Known blockers
CLAUDE.md
- Directory structure (only if it changed)
- New commands / skills / scripts
- Architecture patterns and workflows
README.md (if present)
- Feature list, tech stack, setup steps
Phase 4: Alignment Check
Verify the docs now match the code on countable facts:
| Check | Doc | Code source | Verify |
|---|---|---|---|
| Data model count | CLAUDE.md | «schema file» | equal |
| Command/route list | CLAUDE.md | «routes / commands dir» | equal |
| Surface count | STATUS.md | «UI manifest» | equal |
| Skill list | CLAUDE.md | .claude/skills/ |
equal |
Rules
- Code is truth — docs describe what IS, not what should be.
- Targeted edits — patch lines; never rewrite whole files.
- Single source — each fact lives in one place; others reference it.
- Secret scan before every write — no exceptions.
- No emojis unless the file already uses them.
04 同仓库更多 Skills
wrap-up
Session-end safe closeout. Updates STATUS, verifies you are on a feature branch (never main), security-greps the diff for secrets, makes a conventional commit (no AI-tool mentions), then asks for approval before pushing and opening a PR. Use this to properly close a development session. Side-effecting and gated on explicit user approval; run explicitly.
wake-up
Session-start context sync. Reads project STATUS, git state, and runs a quick health check, then emits a short (<15 line) announcement of where things stand and the single best next step. Use this at the beginning of a working session to re-establish context fast. Does NOT re-read CLAUDE.md (already in the system prompt). Read-only and fast.
station
End-of-session composition that chains retrospect → document → cleanup → wrap-up into one closeout pipeline. Use this to fully close a working session — capture learnings, sync docs, prune artifacts, then commit and open a PR — without forgetting a step. Side-effecting; honors each sub-skill's confirmation and approval gates. Run explicitly.
retrospect
Post-session learning capture. Mines the current conversation for reusable patterns, pitfalls, architecture decisions, performance and security insights, then appends them to the project knowledge registry. Use this at the end of a working session, after a bug is fixed, or after a non-obvious decision is made — so the next session starts smarter. Writes structured entries to .claude/knowledge/REGISTRY.md.
pre-ship
Mandatory pre-commit quality gates — type-check, lint, test, build — run in order and halting on the first failure. Use this BEFORE committing any change that touches application code, so failures are caught while context is still fresh instead of by CI. Surfaces the failing tool's verbatim error and refuses to proceed until gates pass.
debug-like-expert
Deep analysis debugging mode for complex issues. Activates methodical investigation protocol with evidence gathering, hypothesis testing, and rigorous verification. Use when standard troubleshooting fails or when issues require systematic root cause analysis.