doc-governance-init
Bootstrap or refactor a repository's documentation into a layered governance structure that supports human readers and multiple coding agents (Claude, Codex, OpenCode) without tool lock-in.
适合你,如果仓库文档混乱,需要同时服务人类和多个AI编码助手。
npx oh-my-skill add quanxiaoxiao/quan-skills/doc-governance-initcurl -fsSL https://oh-my-skill.com/install.sh | bash -s -- quanxiaoxiao/quan-skills/doc-governance-initnpx oh-my-skill verify quanxiaoxiao/quan-skills/doc-governance-init怎么用
技能原文 SKILL.md
Doc Governance Init
Transform unstructured repository documentation into a maintainable, layered system that humans and coding agents can collaboratively maintain.
Use This Skill
Use this skill when the task involves:
- bootstrapping documentation for a new or undocumented repository
- refactoring scattered docs into a structured governance model
- establishing shared agent collaboration rules (AGENTS.md)
- auditing documentation for drift, duplication, or missing layers
- migrating tool-specific instructions into a shared doc structure
- questions such as "set up docs", "organize documentation", "create AGENTS.md"
When NOT to use
Do not use this skill when:
- the task is comparing existing docs to code for correctness (use
doc-evidence-compare) - the task is editing a single document without structural changes
- the task is generating domain-specific content (API docs, user guides)
- documentation structure already exists and only content updates are needed
Pre-Read Order
Read the target repository first:
README.mdif presentAGENTS.mdorCLAUDE.mdorCODEX.mdif presentdocs/directory listing- Any
agents/orprompts/directories .opencode/,.claude/,.codex/tool-specific dirs
Then load bundled guidance from this skill:
references/layer-model.mdreferences/migration-rules.md
Documentation Layer Model
The skill enforces five documentation layers:
| Layer | Location | Purpose | Owner | |-------|----------|---------|-------| | 1 — Entry | README.md | Human entry point, project overview | Humans | | 2 — Collaboration | AGENTS.md | Shared rules for all agents | Humans + Agents | | 3 — System knowledge | docs/ | Architecture, workflows, constraints | Humans + Agents | | 4 — Tool guidance | agents/ | Tool-specific instructions | Per-tool maintainer | | 5 — Reusable prompts | prompts/ | Audit, alignment, implementation prompts | Agents |
Rules:
- Project truth lives in
docs/, not in tool-specific files - Do not duplicate system explanations across layers
- Agents reference shared docs instead of redefining them
- Prefer cross-references over repeated explanations
README.mdlinks intodocs/but does not replace it
Workflow
Phase 1 — Assess
Analyze the current documentation state. Produce an assessment report.
- List all documentation files in the repository.
- Classify each file by layer (1–5) or mark as
unclassified. - Identify problems:
- duplicated explanations across files
- scattered architecture docs (spread across README, tool configs, inline comments)
- tool-specific coupling (project truth locked inside
.claude/or.codex/) - missing layers (no AGENTS.md, no docs/ directory, no prompts/)
- outdated or contradictory instructions
- Output the assessment as a table:
File,Current Layer,Problems,Action Needed.
Phase 2 — Normalize
Propose a clean target structure based on the layer model.
- Define the target directory tree for this specific repository.
- Map each existing doc to its target location.
- Define source-of-truth boundaries:
- Which file is authoritative for each topic?
- Which files should cross-reference instead of explain?
- Define ownership: human-maintained vs agent-maintained vs shared.
- Output the normalized structure as a directory tree with annotations.
Phase 3 — Migrate
Generate a concrete migration plan.
For each file, assign exactly one action:
| Action | When to use | |--------|------------| | keep | File is already in the right place and layer | | move | File content is correct but location is wrong | | merge | Multiple files cover the same topic — combine into one | | split | One file covers multiple layers — separate concerns | | rewrite | Content is outdated or poorly structured | | remove | Content is duplicated elsewhere or no longer relevant | | create | A required layer or document does not exist |
Output the plan as a table: Source, Action, Target, Notes.
Execute migrations only after user approval.
Phase 4 — Future Governance
After migration, generate maintenance artifacts:
- A
prompts/doc-audit.prompt.mdtailored to this repository - A
prompts/doc-alignment.prompt.mdfor periodic doc/code sync checks - Documentation maintenance rules added to
AGENTS.md - A recommended audit cadence (e.g., monthly, per-release)
Reference Guide
Load these only when needed:
references/layer-model.md— detailed layer definitions and boundary rulesreferences/migration-rules.md— migration action definitions and conflict resolution
Verification
Before finalizing, verify:
- Every documentation file maps to exactly one layer
- No project truth is duplicated across layers
README.mdexists and links todocs/for detailAGENTS.mdexists with shared rules, not tool-specific instructionsdocs/contains architecture and workflow docs- Tool-specific files reference
docs/instead of re-explaining - At least one audit prompt exists for future maintenance
- Migration plan was approved before execution
Output Contract
Return results in this order:
Assessment— current state tableTarget Structure— proposed directory treeMigration Plan— action tableGenerated Artifacts— list of files created or modifiedGovernance Rules— maintenance instructions for AGENTS.md