Repository navigation
fix(skills): resolve references/ links from the skill directory - #469
Conversation
Every SKILL.md linked the shared checklists as `references/<file>.md`, a path relative to the skill's own directory. Those files live in the repo root `references/`, two levels up, so all 18 links across 11 skills resolved to paths that do not exist -- in the repo and in every plugin-install layout (~/.claude/plugins/cache/..., ~/.codex/...). An agent following the guidance -- using-agent-skills pointing at the Definition of Done, for example -- hit a file-not-found on every one. Rewrite the 18 links to `../../references/<file>.md`, which resolves correctly from `skills/<name>/`. Text-only; no structure or tone changed. Verified: all 18 links resolve; hooks/session-start-test.sh passes (required by CONTRIBUTING.md when touching using-agent-skills/SKILL.md); validate-skills, validate-versions, validate-commands and validate-artifact-paths all pass. Refs #468 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The path fix has no regression guard: nothing in CI resolves references/ links, so all 18 were broken while CI stayed green. validate-artifact- paths.js is scoped to spec/plan/todo artifacts and says in its own header that it is not a general markdown path linter. Add validate-reference-links.js, which resolves every `references/*.md` link in skills/*/SKILL.md against that skill's own directory. This accepts both conventions in CLAUDE.md: shared checklists reached via ../../references/, and a skill's own colocated references/ directory. Scope stays narrow on purpose. Skills legitimately name paths that do not exist yet -- tasks/todo.md, PERF.md, docs/ideas/[idea-name].md -- and a general markdown linter would fail the build on them. A test pins that. Proven against the pre-fix tree: 18 error(s), exit 1, matching the 18 links fixed in the previous commit. After the fix: 0 error(s), exit 0. 7 unit tests cover the regression itself, colocated references/, markdown-link syntax, a renamed target, multiple violations in one skill, and the non-reference paths that must be ignored. Wired into the validate-skills job, alongside the other skill-content checks. Known limitation: fenced code blocks are not stripped, so a SKILL.md that documents the anti-pattern inside a fence would be flagged. Nothing does today. Sharing stripFencedCodeBlocks looks right once #444 lands. Refs #468 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
codeCraft-Ritik
left a comment
There was a problem hiding this comment.
Great job on the CI validation as well. Adding a targeted validate-reference-links.js check is a strong follow-up because it prevents the same class of broken links from silently returning later without turning the validator into an overly broad Markdown path linter.
|
Thanks! I wanted to make sure we caught this specific issue automatically moving forward without slowing down the team with unnecessary linting rules. Glad to hear it hits the mark! |
addyosmani
left a comment
There was a problem hiding this comment.
This is the direction we're committing to. It fixes the actual bug #468 found (the links were wrong even in a full install, pointing at references/ instead of ../../references/), and the CI validator keeps it from regressing. Verified locally: all 18 links corrected, 0 bare references/ links left, validator and full suite green. The CI gate is fine by me, it's the same shape as the version and artifact-path checks. Merging.
…yosmani#468) fix(skills): resolve references/ links from the skill directory
Closes #468.
Problem
All 18 links from
skills/*/SKILL.mdto the sharedreferences/checklists are written relative to the skill's own directory, but those files live in the repo root, two levels up. They resolve to paths that do not exist — including in a full Claude Code marketplace install wherereferences/is present:An agent that follows the guidance —
using-agent-skillspointing at the Definition of Done, for example — gets a file-not-found and stalls. The same 404 reproduces on the Codex 0.6.6 plugin cache.Change
Two commits:
../../references/<file>.md. Text-only, one line each across 11 skills; structure and tone untouched.scripts/validate-reference-links.jsplus tests, wired into thevalidate-skillsjob.The gate resolves every
references/*.mdlink inskills/*/SKILL.mdagainst that skill's own directory. It accepts both conventions in CLAUDE.md: shared checklists reached via../../references/, and a skill's own colocatedreferences/.Scope is deliberately narrow, following the precedent
validate-artifact-paths.jssets in its own header ("It is not a general markdown path linter"). Skills legitimately name paths that do not exist yet —tasks/todo.md,PERF.md,docs/ideas/[idea-name].md— and a general linter would fail the build on them. A test pins that.If you would rather take only the path fix, the second commit drops cleanly.
Verification
d2478bf):18 error(s), exit 1 — matching exactly the 18 links changed here.0 error(s), exit 0.references/, markdown-link syntax, a renamed target, multiple violations in one skill, and the non-reference paths that must be ignored.bash hooks/session-start-test.sh→session-start JSON payload OK, required by CONTRIBUTING.md becauseskills/using-agent-skills/SKILL.mdis touched.validate-skills,validate-versions,validate-commands,validate-artifact-pathsand their--testcompanions all pass.Relationship to #366
#366 addresses an overlapping problem a different way — absolute GitHub URLs, so per-skill
npxinstalls can reach the checklists too. Two observations rather than a claim of precedence:dirtyagainstmain, and its stated premise — that relative paths "work only with the full repo present (Claude Code marketplace plugin, whole-repo clone)" — does not hold. That is what Shared references/ links in 11 SKILL.md files do not resolve, even in a full plugin install #468 documents.skills/security-and-hardening/SKILL.mdline 303 (use the matrix in references/security-checklist.md, inside a numbered list item) is not covered by it.If you prefer the URL direction, drop this PR's first commit and rebase #366; the CI gate in the second commit still applies either way, since it only inspects relative
references/*.mdlinks and passes trivially once they are absolute URLs. Happy to reshape this in whichever direction you want.Known limitation
The validator does not strip fenced code blocks, so a SKILL.md that documents the anti-pattern inside a fence would be flagged. Nothing in the repo does that today. I left it out rather than duplicating
stripFencedCodeBlocks, whose fence parsing is the subject of #437 and #444 — once that lands, sharing it looks like the right move.