sync-references
Skill2 starsChanged 5 months agoMITView on GitHub
Audits, relinks, and synchronizes documentation references in a project; detecting broken links, stale paths, orphan files, llms.txt inconsistencies, skills-directory desync (skills folder vs README/SKILLS.md/llms.txt), READMEs, AGENTS.md, SKILL.md, HANDOFF.md, and CHANGELOG.md. Generates updated indexes and validates YAML frontmatter. Use when the user mentions "broken links", "relink docs", "update refs", "sync llms.txt", "index files", "document references", "tag files", "orphan files", "audit documentation", "validate llms.txt", or "sync skills".
In this repository11 other files it gives its agents.
- llms.txtllms.txt
- ai-daily-briefSkill
- career-boostSkill
- commit-guidedSkill
- crisis-investingSkill
- figma-shadcn-hygieneSkill
- figma-shadcn-visual-matchSkill
- screen-contractSkill
- security-auditorSkill
- standardize-md-skillsSkill
- write-handoffSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 8 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Run the audit script against the project directory:
- Very specific: line 57
Search for the file with Glob by base name
- Very specific: line 62
README.md: ensure every folder under docs/ and every active subproject has an entry in the index with a link and a one-line description.
- Very specific: line 64
Skills directory: when adding or renaming a skill, update in the same pass SKILLS.md (table and contracts), README.md ("Available skills" …
- Distinctive: line 66
llms.txt: follow the spec in llms-spec.md:
- Distinctive: line 71
Remove entries for files that no longer exist
- Distinctive: line 72
Add entries for new unindexed files
- Distinctive: line 86
Don't overwrite existing frontmatter, only add missing fields.
- Very specific: line 90
When changes are applied, append an entry to CHANGELOG.md:
- Distinctive: line 107
Always deliver at the end:
- Distinctive: line 138
If the user asks for an audit only, without applying fixes, generate the report above but do not modify any file.
- Distinctive: line 188
Remove the hooks manually:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
sync-references
Audits and synchronizes a project's documentation reference graph. Operates on Markdown files and LLM context files.
Target artifacts
| File | Role |
README.md | Project root index |
llms.txt | Structured LLM context (spec: llms-spec.md) |
AGENTS.md | Instructions for AI agents |
SKILL.md | Skill definition |
HANDOFF.md | Task handoff |
CHANGELOG.md | Change history |
docs/**/*.md | Internal documentation |
Configuration
This skill defaults to scanning a project's skills/ directory (auto-detected: tries .claude/skills/, then .cursor/skills/, then skills/ at the project root, in that order; first one found wins). If your project uses a different convention, pass it explicitly: "sync references, skills are in packages/*/skills/".
Workflow
1. Audit
Run the audit script against the project directory:
zsh <skill-dir>/scripts/audit-refs.sh <project-root>Where <skill-dir> is wherever this skill is installed (e.g. .claude/skills/sync-references, ~/.claude/skills/sync-references, or a project-local path). Resolve it relative to how the skill was invoked, don't assume a fixed location.
The script returns:
- broken-links: Markdown links with a non-existent target
- orphan-files:
.mdfiles with no inbound reference - missing-from-llms: files present on disk but absent from
llms.txt - stale-llms: paths in
llms.txtthat don't exist on disk - skill-sync: each skill folder (containing a
SKILL.md) must appear inllms.txt(link containing the skill'sSKILL.mdpath), inREADME.md(skill name in backticks in the table), and inSKILLS.md(link with the same relative path) - missing-frontmatter: files in
docs/without a YAML block (---) when expected
2. Relink
For each reported broken-link:
- Locate the referenced file using
Globwith name variations - Compute the correct relative path from the source file
- Apply the fix with
Edit - Log it in the final report
For stale-refs in @path mentions:
- Search for the file with
Globby base name - Replace the stale path
3. Index
README.md: ensure every folder under docs/ and every active subproject has an entry in the index with a link and a one-line description.
Skills directory: when adding or renaming a skill, update in the same pass SKILLS.md (table and contracts), README.md ("Available skills" table), and llms.txt (skills section). Run the audit script to validate SKILL-SYNC-*.
llms.txt: follow the spec in llms-spec.md:
# Title(single h1)> description(blockquote)## Section(h2 per category)- [Name](path): description(one line per artifact)- Remove entries for files that no longer exist
- Add entries for new unindexed files
4. Tagging (YAML frontmatter)
For files in docs/ without frontmatter, inject a minimal block:
---
title: <infer from the file's h1>
tags: [<folder-category>]
updated: <YYYY-MM-DD>
---Don't overwrite existing frontmatter, only add missing fields.
5. CHANGELOG
When changes are applied, append an entry to CHANGELOG.md:
## [sync-references] YYYY-MM-DD
### Fixed
- `path/to/file.md`: broken link `old-ref` → `correct-ref`
### Added
- `llms.txt`: entry added for `docs/new-file.md`
### Tagged
- `docs/file.md`: frontmatter injectedOutput
Always deliver at the end:
## sync-references Report: <date>
**Project**: <root>
**Files audited**: N
**Issues found**: N
### Broken links fixed (N)
- `file.md:12`: `../old/path` → `../correct/path`
### Orphan files (N)
- `docs/unreferenced-file.md`: suggestion: add to README.md#section
### llms.txt: synchronized (N additions, N removals)
- ➕ `docs/new.md`
- ➖ `docs/deleted.md` (file no longer exists)
### Skill sync (N)
- `skill-name` missing from `llms.txt` / `README.md` / `SKILLS.md`: suggested fix: …
### Frontmatter injected (N)
- `docs/file.md`
### No action needed
- (list of files that are ok)Report-only mode
If the user asks for an audit only, without applying fixes, generate the report above but do not modify any file. Flag each issue with the suggested fix for manual application.
Automation (Git Hooks)
For automatic synchronization when .md files are renamed/moved, install the git hooks:
Installation
From your project's git root:
zsh <skill-dir>/hooks/install.shThe installer will:
- Copy 3 hooks to
.git/hooks/(post-commit, post-merge, post-rewrite) - Configure the default mode (
silent) - Validate the installation
Operating modes
Configure via git config (local to the repository):
# Silent mode (default): only logs to .git/sync-refs.log
git config sync-refs.mode silent
# Report mode: shows the report in the terminal after commits
git config sync-refs.mode report
# Fix mode: auto-fixes references (not implemented yet)
git config sync-refs.mode fixView the execution log
tail -f .git/sync-refs.logInstalled hooks
| Hook | When it runs | Behavior |
post-commit | After each commit | Detects changed .md files → runs sync |
post-merge | After pulls/merges | Always runs sync (--force) |
post-rewrite | After rebases | Runs sync on rebases |
Uninstall
Remove the hooks manually:
rm .git/hooks/post-commit
rm .git/hooks/post-merge
rm .git/hooks/post-rewrite
git config --unset sync-refs.modeAdditional resources
- Full
llms.txtspec: llms-spec.md - Audit script: scripts/audit-refs.sh
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

