validate-refs
Validate all cross-references, includes, images, and IDs in the documentation. Works with any AsciiDoc project that follows the Red Hat modular documentation structure (assemblies/, topics/, snippets/).
Usage
/validate-refs ../my-project/ /validate-refs ../my-project/ --fix
What This Skill Does
Step 1: Determine Project Root
The argument should be the project root directory (the one containing
assemblies/, topics/, etc.).
Step 2: Run Validation
If the project has a scripts/validate-refs.py script, run it:
cd <project-root> python3 scripts/validate-refs.py
If no validation script exists, perform manual validation by scanning all
.adoc files for:
- •Broken xrefs — every
xref:ID_{context}[]must have a matching[id="ID_{context}"]in some file - •Missing includes — every
include::path[]must resolve to an existing file - •Missing images — every
image::path[]must resolve to a file underimages/ - •Duplicate IDs — no two files should declare the same
[id="..."]
Step 3: Report Results
Print a structured report of all issues found.
Step 4: Fix (if --fix passed)
For fixable issues:
Broken xrefs:
- •Read the target file to find the actual
[id="..."] - •If ID exists but doesn't match: fix the xref to match the actual ID
- •If target file doesn't exist: route to manual review
Missing includes:
- •Check if file was renamed (search for similar filenames)
- •If found: fix the include path
- •If not found: route to manual review
Missing images:
- •Search for the image in other directories
- •If found: fix the path
- •If not found: route to manual review
Duplicate IDs:
- •Always route to manual review — need to determine which file should keep the ID
Step 5: Generate Manual Review
If any issues can't be auto-fixed, add them to manual-review.md in the
project root.
ID Naming Caveats
Some files have IDs that don't include the filename prefix. The [id="..."] in
the file is canonical — xrefs must match it exactly.
ALWAYS read the target file to verify the actual ID before fixing an xref.
Rules
- •Never guess at IDs — always read the target file
- •Never modify IDs without checking all referencing xrefs
- •Route duplicate IDs to manual review (never auto-resolve)