复制安装命令
用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。
复制前请先查看来源、License 和安全提示。
Repo-Docs: Keep up with the code your agents write.
用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。
复制前请先查看来源、License 和安全提示。
来源文件:README.md
An evidence atlas for agent-built code.
Vibe coding makes code move faster than memory. Repo-Docs turns each real run into walkthroughs, concepts, references, and sync rules that live beside the source.
Chinese README | Skill contract | Project homepage | Install
Why now | The loop | Artifacts | Quality bar
Understand the repo before you memorize paths.
Agent-built repos often feel like this
|
Repo-Docs leaves this behind
|
Repo-Docs is not a file-tree tour, a generated API dump, or a chat transcript. It is a small project guide that tells a reader what the repo does, how the behavior moves, where the proof lives, and how to keep that understanding fresh.
AI coding is no longer a niche workflow. Two 2026 open-source studies make the scale visible: AIDev reports 932,791 agent-authored pull requests across 116,211 GitHub repositories, while a multi-method census of 180 million repositories shows that many agent traces are missed by single-signal detection.
That growth creates a new maintenance problem: the code may be real, but the project understanding is often temporary. Repo-Docs gives coding agents a repeatable way to preserve the reasoning layer inside the repository itself.
flowchart LR
A["User asks or agent changes repo"] --> B["Understanding sync check"]
B --> C["Update README and walkthrough"]
B --> D["Update change-log"]
B --> E["Patch modules / glossary / references"]
B --> F["Update AGENTS.md / CLAUDE.md"]
C --> G["User can read the current project"]
D --> G
E --> G
F --> G
The loop is intentionally conservative. A good update touches the page that would otherwise mislead the next reader, not every page that could be polished.
| Artifact | Job |
|---|---|
repo-docs/README.md | Orient the reader and point to the first useful path. |
walkthroughs/one-real-run.md | Follow one real behavior from observable entry to output. |
code-map.md | Map in-scope source directories to responsibilities, important code, tests, and likely change points. |
modules/ | Explain durable concepts the walkthrough names. |
references/ | Hold source evidence and optional quality review. |
glossary.md | Translate repeated project terms into plain meaning. |
change-log.md | Record meaningful guide work, verification, and sync anchors. |
AGENTS.md / CLAUDE.md | Tell future coding agents when and how to keep docs current. |
Give this natural-language install request to your coding agent:
Install the repo-docs skill from this project:
https://github.com/YurunChen/repo-docs-skills
Make both repo-docs and repo-docs-zh available in my agent skill directory.
Then ask it to run the skill in any repository:
Use the repo-docs skill to create docs for this repository.
Use this when you prefer a shell install. The URL is a GitHub repository raw-file URL; GitHub serves the raw script bytes through its raw content host after redirect.
curl -fsSL https://github.com/YurunChen/repo-docs-skills/raw/main/install.sh | bash
Windows PowerShell:
irm https://github.com/YurunChen/repo-docs-skills/raw/main/install.ps1 | iex
From this source checkout:
./install.sh
# Install into all known locations: ~/.codex/skills, ~/.claude/skills, ~/.agents/skills
./install.sh --agent all
# Install into one explicit skills directory
./install.sh --target ~/.agents/skills
Use the repo-docs skill to create docs for this repository.
Use repo-docs-zh to create a Chinese repo guide for this project.
Explain how this subsystem works using repo-docs and the current source.
| Mode | Use when | What it preserves |
|---|---|---|
| Seed | The repo is new or has little runtime evidence | Goals, decisions, planned work, and unknowns |
| Build | The repo needs its first guide | Walkthrough, concepts, references, glossary, and sync rule |
| Sync | A repo question or guide-covered behavior may make docs stale | The smallest page that would otherwise mislead |
| Cleanup | The user asks to remove generated docs | Docs package and stale root-agent pointers |
| Question refinement | A question exposes a wrong reader model | The corrected page, then an answer linked to it |
python skills/repo-docs/scripts/validate_repo_docs.py /path/to/repo-docs --repo-root /path/to/repo
Use --lite for small projects and --seed for repositories that still need
status-labeled plans instead of implementation claims. --repo-root checks
source locators and post-anchor drift.
A good Repo-Docs package is useful after the chat ends.
| Principle | Meaning |
|---|---|
| Behavior before inventory | Teach one real workflow before listing files. |
| Reader handles before locators | Explain the concept, then link to the exact path, function, field, or command. |
| One durable fact, one home | Concepts and needed details live in modules; evidence and quality audit live in references; history lives in the change log. |
| Evidence stays visible | Current source, tests, config, data, commands, and artifacts outrank memory or stale docs. |
| Patches stay surgical | When understanding drifts, update the smallest page that fixes the reader model. |
repo-docs-skills/
├── skills/
│ ├── repo-docs/ # installable skill package
│ └── repo-docs-zh/ # Chinese language overlay
├── site/ # homepage source
├── docs/ # GitHub Pages publish tree
├── install.sh
├── install.ps1
├── README.md
└── README_CN.md
The installable skill source lives under skills/. The site/ directory is homepage source, while docs/ is the GitHub Pages publish tree.
<skills-dir>/
├── repo-docs/
│ ├── SKILL.md
│ ├── REFERENCE.md
│ ├── WRITING.md
│ ├── PAGE_RULES.md
│ ├── SCOPE_MODES.md
│ ├── SYNC_RULES.md
│ ├── QUALITY_RULES.md
│ ├── EXAMPLES.md
│ ├── validate_repo_docs.py
│ └── scripts/
│ └── validate_repo_docs.py
└── repo-docs-zh/
└── SKILL.md
Repo Docs Skills is developed by the AI4GC Lab at Zhejiang University.
name: repo-docs
description: Build and maintain a Markdown guide that helps humans understand a repository through real behavior, concepts, and evidence. Use when a user asks to understand a repo, generate or update repo-docs, answer repo-architecture/onboarding questions, seed docs for a new project, sync docs after code changes, or delete generated repo docs.repo-docs explains a repository to a human reader.
Do not start with a tree tour. Build a reader model first: what problem the repo solves, one real behavior it performs, the concepts behind that behavior, where those responsibilities live in code, where source truth lives, and how to verify the understanding.
Keep the routing narrow. SKILL.md defines the contract; topic files carry the detailed rules. If a detail appears in two places, keep it in the topic file and leave a pointer here.
| File | Role |
|---|---|
SKILL.md | Entry: mission, core laws, output contract, mode router, finish gate |
REFERENCE.md | Router to topic files; open only when detail is needed |
WRITING.md | Explanation design, voice, evidence discovery |
PAGE_RULES.md | Build workflow, reader paths, page types, output shape, navigation |
SCOPE_MODES.md | Seed, large/monorepo scope, specialized repos |
SYNC_RULES.md | Sync decision gate, question loop, change sync, widened content alignment |
ROOT_AGENT_RULES.md | Root AGENTS.md / CLAUDE.md routing block and install contract |
QUALITY_RULES.md | Evidence labels, source truth, quality bar |
EXAMPLES.md | Finished-page tone and output-shape examples |
scripts/validate_repo_docs.py | Structure, links, sync anchors, freshness, evidence, references scope, and quality-review checks |
validate_repo_docs.py | Compatibility wrapper for older invocations |
evals/ | Source-repository regression fixtures and assertions for this skill; not required at runtime |
../repo-docs-zh/SKILL.md | Chinese language overlay |
code-map.md; concept knowledge and mechanism details live in modules/; fixed generated audit artifacts live in references/; terms live in glossary.md; guide history lives in change-log.md.Red flags that mean stop and re-route:
| Thought or draft move | Better action |
|---|---|
| "I'll start with the file tree." | Pick the behavior the reader should follow. |
| "The path/function name explains it." | Write the reader handle first; use source as proof. |
| "This schema/catalog deserves a references page." | Put details in the owning module; keep references/ fixed. |
| "A repo question always means patch docs." | Run the sync decision gate and use answer-only when the guide is already safe. |
| "The docs look fine; no validator needed." | Run the validator or report the blocker. |
Use the smallest package that teaches the repo honestly.
README.md, walkthroughs/one-real-run.md, code-map.md, modules/, references/source-evidence.md, glossary.md, change-log.md; add references/quality-review.md when the guide is source-heavy, high-risk, generated, or handoff-sensitive.README.md, walkthroughs/one-real-run.md, references/source-evidence.md, change-log.md; use for small repos with little durable terminology. Add code-map.md when the small repo still has multiple first-party implementation areas or the reader needs a change-location index.README.md, change-log.md, optional glossary.md; label facts as Confirmed, Planned, or Unknown.| Page | Job |
|---|---|
README.md | Orient the reader and point to the first useful path. |
walkthroughs/one-real-run.md | Follow one real behavior end to end with numbered ## Step N: behavior headings. |
code-map.md | Map in-scope first-party directories to responsibilities, key files or symbols, main-path connections, and change locations after the behavior model is established. |
modules/<concept>.md | Explain one durable concept named by the walkthrough, including details, representative cases, call/data shapes, commands, fields, caveats, and verification hooks needed to understand it. |
references/source-evidence.md | Fixed generated evidence base: traversal log, coverage notes, claim/evidence/confidence/caveat rows, and source material later pages may use. |
references/quality-review.md | Optional fixed generated audit note for source-heavy, high-risk, generated, or handoff-sensitive guides. |
glossary.md | Three columns only: `Term |
change-log.md | Meaningful guide changes and sync anchors. |
references/ is not a lookup layer. Code location belongs in code-map.md; do not hide it in an audit artifact. Do not add extra files under references/ for schemas, contracts, metrics, task catalogs, command lists, scripts, artifacts, or exact-name lookup. If a detail helps understanding, put it in the owning module. If it only proves a claim, put it in references/source-evidence.md.
Modes name common situations, not detached jobs. Use REFERENCE.md to open details only when the current mode needs them.
| Mode | Use when | What to do |
|---|---|---|
| Seed | No real source/runtime/test/data contract yet | Status-labeled project memory; do not describe plans as implemented |
| Build | First repo docs or onboarding material | Follow PAGE_RULES.md, wire root agent rules from ROOT_AGENT_RULES.md, run validator, deliver |
| Sync | Interaction, repo state, user uncertainty, surfaced conversation knowledge, or memory updates may make the guide stale or incomplete | Follow SYNC_RULES.md; decide none, answer-only, foreground patch, or background sync before answering |
| Cleanup / removal | User asks to delete generated repo docs | Remove the package and stale root pointers; do not recreate docs unless explicitly asked |
| Question refinement | A repo question shows the guide built the wrong model | Patch the smallest stable owning page, anchor in change-log.md, answer with a link |
When repo-docs/ exists and a repo-docs trigger appears, ask: what would a new reader misunderstand if they read the guide as it stands?
The foreground gate must end in one decision:
| Decision | Use when |
|---|---|
none | The turn is unrelated to guide-covered knowledge or the guide is absent/out of scope. |
answer-only | The guide is current enough, or the gap is transient, non-durable, not answer-critical, and not a small local patch. Answer from inspected guide/source without editing docs. |
foreground patch | The current answer or code change would mislead without a small owning-page update, the guide says the opposite, or a stable knowledge gap is small and belongs in the guide now. |
background sync | The gap is durable but broader than the current answer needs, the answer remains correct, and the platform has a trackable handoff. |
Do not patch for one-off debug state, local environment quirks, or personal preference unless the user asks to preserve it.
Detailed Build rules live in PAGE_RULES.md. The short version:
references/source-evidence.md as the evidence base with at least two traversal passes.For large repos or monorepos, scope the guide to one subsystem or workflow and say what is not covered.
Use WRITING.md for voice and explanation rules. The short version:
Evidence status: Confirmed unless noted.Before delivery, confirm:
repo-docs/README.md and reach the main walkthrough.walkthroughs/one-real-run.md follows one real behavior with numbered steps.code-map.md; it covers every first-party source directory inside the declared scope, names the important code inside each area, states exclusions, and routes deeper mechanism questions to modules.references/source-evidence.md exists and includes Pass 1/Pass 2 traversal rows, coverage/exclusion notes, a falsifying check, a likely reader follow-up, and a Claim | Evidence | Confidence | Caveat | Used by audit table.references/quality-review.md, when present, stays an audit note rather than a second walkthrough.references/ contains only fixed generated artifacts.Repo docs routing block, or the build explicitly explains why it was not written.change-log.md records meaningful guide work and includes Synced through <sha> when git is available.Before finishing, check structure, local links, source links, narrative flow, module ownership, fixed references scope, evidence maps, and quality review.
Run:
python scripts/validate_repo_docs.py <path-to-repo-docs> --repo-root <repo-root>
First build: tell the user what the reader can now do, where to start, the key pages, scope, validator result, and root agent-file status. Keep durable history in change-log.md, not in chat.
Cleanup: if the user asks to remove repo docs, delete the generated docs package and stale root-agent pointers. Do not recreate docs in the same turn unless explicitly asked.
Widened sync closeout: when the user explicitly asks to sync, tidy, hand off, or repair stale docs, follow SYNC_RULES.md and summarize by changed layer, not as a substitute for per-turn sync decisions.
评论 (0)
暂无评论,成为第一个评论者吧!