xh-update-doc-links — Documentation Consistency Check
Pre-commit skill to ensure documentation index files, inter-doc links, and cross-references stay consistent after editing READMEs or concept docs.
Step 1: Discover Documentation Files
Build a complete inventory of documentation files on disk.
- •Use
Globto find all**/README.mdfiles, excludingnode_modules/,public/, andstatic/directories. - •Use
Globto find all files underdocs/. - •Run
git diff --name-onlyandgit status --porcelainto identify which docs were recently changed or added. - •Build a master list of all documentation files, noting which are new or recently modified.
Step 2: Read Index Files
Read the two index files and parse their current entries.
- •
Read
docs/README.md— focus on the Package Documentation section (the tables under "Core Framework", "Components", "Utilities", "Concepts", and "Other Packages").- •Parse each table row to extract the package path and linked README path.
- •Parse the "Other Packages" paragraph to extract unlisted package names.
- •
Read
docs/README-ROADMAP.md— parse all priority tables and the Concepts table.- •Extract each package path, description, and status value.
- •Note which entries are
Planned,Drafted, or[Done](link).
Step 3: Reconcile Indexes
Compare documentation on disk against both index files.
docs/README.md Reconciliation
For each README on disk:
- •Check if it has an entry in the appropriate
docs/README.mdtable (Core Framework, Components, Utilities, Concepts, or Other Packages). - •Missing entries: Add a new table row in the correct section using this format:
(Note: paths are relative frommarkdown
| [`/package/`](../package/README.md) | One-sentence description | Key, Topics, Here |
docs/, so package READMEs use../prefix.) - •Stale entries: If an entry links to a README that no longer exists, remove it.
- •Promotion: If a package is listed in the "Other Packages" paragraph and now has a README, move it to the appropriate table and remove it from the paragraph.
- •AGENTS.md directive: Verify that
AGENTS.mdstill contains the directive pointing todocs/README.md(the "Hoist Documentation" section). Do not re-add package tables to AGENTS.md.
README-ROADMAP.md Reconciliation
For each README on disk:
- •Check if it has an entry in the roadmap with the correct status.
- •Status updates: Change
Planned→[Done](../path/README.md)for newly completed docs. ChangeDrafted→[Done](../path/README.md)if appropriate. - •Missing entries: Add entries for docs not yet on the roadmap.
- •Progress notes: Add a progress note entry for the current date if doc changes are detected. Follow the existing format in the "Progress Notes" section.
Step 4: Validate Inter-Doc Links
Scan every documentation file (READMEs + concept docs) for relative markdown links.
- •For each file, extract all markdown links matching
[text](path)wherepathis a relative path (not a URL). - •Resolve each relative path from the source file's directory.
- •Verify the target exists on disk.
- •Broken links: Report and fix. Common fixes include:
- •Correcting
../depth for moved files - •Updating paths for renamed files
- •Removing links to deleted files
- •Correcting
Step 5: Enhance Cross-Links
When new or recently changed docs are detected, look for cross-linking opportunities.
- •
Topic-based linking: Scan existing READMEs for sections that discuss the same topic as a new doc. Where an existing README has a brief treatment of a topic that now has dedicated documentation, add a contextual "See
/package/for details" link. - •
Related Packages sections: Check if a new README was created for a package that is referenced without a link in another doc's "Related Packages" section. Add the link using the format:
markdown- [`/package/`](path) - Brief description
- •
Be conservative: Only add links where the existing text already discusses the topic. Do not restructure existing content or add new sections just to create links.
Step 6: Report
Output a summary organized into these sections:
- •Index Updates —
docs/README.mdentries added, updated, or removed. - •Roadmap Updates — Status changes, new entries, progress notes added.
- •Broken Links Fixed — Source file, broken target, and fix applied.
- •New Cross-Links Added — Source file, target doc, and surrounding context.
- •Items Needing Review — Ambiguities or items requiring human judgment.
If no changes were needed in a category, note "None" for that section.