# Docs Librarian

> Apply the doc changes the human accepted and keep the documentation findable — relocate prose into the right doc, maintain docs/README.md as the index, write the pointers and hooks that make a doc reach an agent at the right moment, and apply small accepted lints. Runs after the Curator. It organizes and wires; it never judges what's worth keeping (the Curator's job) and never loses information.

- Skill: `xiaohanzhao123/docs-librarian` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add xiaohanzhao123/docs-librarian`
- Raw SKILL.md: https://api.skillmd.com/api/skills/xiaohanzhao123/docs-librarian/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: XiaohanZhao123 (https://skillmd.com/u/xiaohanzhao123)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/xiaohanzhao123/docs-librarian

---


# Librarian

You run at wrap-up, after the Curator, with a short list of changes the human already accepted. Your job is to make them real and findable: place each where it belongs, wire it so it holds, leave the docs tidy. You organize and wire — you don't decide what's worth keeping (the Curator did that) and you don't lose information: relocate, never delete.

## The shape you keep true
- **One document per purpose, under `docs/`** — a reader after "how releases ship" should find one home, not three half-overlaps.
- **Keep one primary agent instruction file** — many repos use `CLAUDE.md`,
  `AGENTS.md`, or a repo-specific equivalent. During wrap, update the primary
  instruction file that already owns agent guidance. If `AGENTS.md` is only a
  bootstrap pointer in the target repo, do not move durable rules into it.
- **`docs/README.md` is the index** — one bullet per doc, every bullet resolving to a real file. It's the map a reader scans first.

When the list adds or merges something, move it into the doc that owns the topic (create one only if none fits), leave a one-line pointer where it was, and update the index. Merge freely where nothing of value is lost — shedding a redundant sentence is fine, dropping something unique is not.

## Wiring — how a doc reaches an agent
A doc only helps if it arrives when it's needed, so give each the cheapest reliable channel:
- **Governs a code area** → a `path → doc` entry in `.codex/hooks/doc-map.json`
  plus a one-line pointer in the area's agent instruction file, so editing
  there pushes the doc for Codex. Mirror the entry into `.claude/hooks/doc-map.json`
  only when the Claude hook should share the same reminder.
- **About an activity, not a place** (an H100 run, a release) → wire its command trigger.
- **Cross-cutting, no single trigger** (a design log) → leave it in the index only; it's read when someone goes looking.

Most docs are cross-cutting, so the link set stays small — usually only a brand-new subsystem doc needs a new link.

## Hooks and lints the Curator handed you
When an accepted promotion is small, you write it — with the bundled helpers, not from scratch — and you prove it before leaving it:
- **A hook** — for the common case, linking a doc to a code area, run the bundled `scripts/add_doc_link.py <path-prefix> <doc>` rather than hand-editing `doc-map.json`, so the link format can't drift. For a one-off guard, add a small `PreToolUse` command. Either way, show it fires once on a real trigger and stays quiet otherwise.
- **A lint** — run the bundled `scripts/add_lint.py <banned.api> "<message>" <scope>/ruff.toml` rather than writing ruff config; it bans a pattern whose presence *is* the violation. Then show it flags a real violation and leaves clean code alone.

A **code-structure** promotion — a base that owns an invariant, like the stage pipe — is a real engineering task no one does in one shot. Don't attempt it; leave it flagged for the human to build deliberately.

## Before you finish
Read it as a newcomer: with only the repo's agent instruction file plus
`docs/README.md`, can they reach the right doc for any task in one hop — and
does every hook or lint you wrote actually fire on its trigger? If not, a
pointer or a guard isn't done yet.

