Skip to content

fix(skills): resolve references/ links from the skill directory - #469

Merged
addyosmani merged 2 commits into
addyosmani:mainfrom
coolTheWorld:fix/skill-reference-paths
Aug 8, 2026
Merged

addyosmani merged 2 commits into
addyosmani:mainfrom
coolTheWorld:fix/skill-reference-paths

Conversation

@coolTheWorld

Copy link
Copy Markdown

Closes #468.

Problem

All 18 links from skills/*/SKILL.md to the shared references/ 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 where references/ is present:

$ P=~/.claude/plugins/cache/addy-agent-skills/agent-skills/7829ffd90d97
$ ls $P/references/ | wc -l
7
$ test -f $P/skills/using-agent-skills/references/definition-of-done.md \
    && echo FOUND || echo "NOT FOUND"
NOT FOUND

An agent that follows the guidance — using-agent-skills pointing 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:

  1. fix — rewrite the 18 links to ../../references/<file>.md. Text-only, one line each across 11 skills; structure and tone untouched.
  2. ci — add scripts/validate-reference-links.js plus tests, wired into the validate-skills job.

The gate resolves every references/*.md link in skills/*/SKILL.md against that skill's own directory. It accepts both conventions in CLAUDE.md: shared checklists reached via ../../references/, and a skill's own colocated references/.

Scope is deliberately narrow, following the precedent validate-artifact-paths.js sets 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

  • Gate run against the pre-fix tree (d2478bf): 18 error(s), exit 1 — matching exactly the 18 links changed here.
  • Gate run on this branch: 0 error(s), exit 0.
  • 7 unit tests: 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.
  • bash hooks/session-start-test.sh → session-start JSON payload OK, required by CONTRIBUTING.md because skills/using-agent-skills/SKILL.md is touched.
  • validate-skills, validate-versions, validate-commands, validate-artifact-paths and their --test companions all pass.

Relationship to #366

#366 addresses an overlapping problem a different way — absolute GitHub URLs, so per-skill npx installs can reach the checklists too. Two observations rather than a claim of precedence:

  • It is currently dirty against main, 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.
  • It converts 17 of the 18 links. skills/security-and-hardening/SKILL.md line 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/*.md links 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.

coolTheWorld and others added 2 commits August 7, 2026 07:27
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 codeCraft-Ritik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coolTheWorld

Copy link
Copy Markdown
Author

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 addyosmani left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@addyosmani
addyosmani merged commit 7676817 into addyosmani:main Aug 8, 2026
zeekay pushed a commit to Dream-AI-4444/addys-agent-skills that referenced this pull request Sep 9, 2026
…yosmani#468)

fix(skills): resolve references/ links from the skill directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shared references/ links in 11 SKILL.md files do not resolve, even in a full plugin install

3 participants