Nov 18, 2026
Keep Agent-Built Code Documented With the Repo-Docs Skill
Repo-Docs turns one real run into a walkthrough, concepts, references, and a sync rule, so the reasoning behind agent-built code stays in the repository and the next agent starts from current docs instead of chat archaeology.
Agents write code faster than anyone can document it, and the reasoning behind each change stays in the chat that produced it. Repo-Docs — a skill from YurunChen, developed by the AI4GC Lab at Zhejiang University — flips that: it turns one real run into a small project guide that lives beside the source, so the next reader (human or agent) starts from current docs.
Why This Skill Matters
The README frames the scale with a citation: the AIDev study reports 932,791 agent-authored pull requests across 116,211 GitHub repositories, and a second 2026 census of 180 million repositories finds that many agent traces are missed by single-signal detection. Code may be real, the README argues, while project understanding is temporary.
What Repo-Docs builds is deliberately narrow. The README defines it by exclusion — not a file-tree tour, not a generated API dump, not a chat transcript — and by what it produces: a guide that tells a reader what the repo does, how the behavior moves, where the proof lives, and how to keep that understanding fresh.
The repo installs two skills: repo-docs for English output and repo-docs-zh, a Chinese language overlay.
Installation
The primary install is one natural-language 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.
If you prefer a shell install, the README documents a script install and explains that the URL is a GitHub repository raw-file URL served through its raw content host after redirect:
curl -fsSL https://github.com/YurunChen/repo-docs-skills/raw/main/install.sh | bash
Windows PowerShell has its own installer (irm https://github.com/YurunChen/repo-docs-skills/raw/main/install.ps1 | iex). From a source checkout, ./install.sh --agent all installs into all known locations — ~/.codex/skills, ~/.claude/skills, and ~/.agents/skills — and --target points at one explicit skills directory.
Real Workflow: Document a Repo After an Agent Build
- Hand the agent one request in any repository:
Use the repo-docs skill to create docs for this repository.
For Chinese output, the README documents the overlay invocation:
Use repo-docs-zh to create a Chinese repo guide for this project.
-
The skill works in a loop: an understanding sync check decides what needs updating, then the agent updates the README and walkthrough, the change log, the modules, glossary, and references, and the root agent rules in
AGENTS.mdorCLAUDE.md. The README calls the loop intentionally conservative: a good update touches the page that would otherwise mislead the next reader, not every page that could be polished. -
Expect a specific artifact set:
| 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. |
-
Pick the right mode. The README documents five: Seed for a new repo with little runtime evidence, Build for a repo's first guide, Sync when a repo question or covered behavior may have made docs stale, Cleanup when you ask to remove generated docs, and Question refinement when a question exposes a wrong reader model.
-
Validate the package the skill ships with a checker script:
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.
Tips
- The README's quality bar opens with behavior before inventory: teach one real workflow before listing files, and explain a concept before linking the exact path, function, field, or command.
- One durable fact gets one home — concepts live in modules, evidence and quality audit in references, history in the change log.
- Patches stay surgical: when understanding drifts, update the smallest page that fixes the reader model.
- Current source, tests, config, data, commands, and artifacts outrank memory or stale docs — the package is designed to be useful after the chat ends.
When Not to Use This
- If what you need is a generated API reference or a file-tree dump, the README explicitly says Repo-Docs is neither.
- Docs updates do not run on autopilot: the sync loop is conservative by design, and cleanup happens when you ask for it.
- A brand-new repo with no runtime evidence starts in Seed mode — the README scopes that mode to goals, decisions, planned work, and unknowns, not implementation claims.
See the leaderboard for more skills.