15 Commits
Author SHA1 Message Date
Anton YakutovichandClaude Opus 5.5 5220bf1602 fix(scripts): say when the shared source of a misspelled link is missing
Rewriting the spelling alone only trades the error for "resolves to ...,
which does not exist" when references/<name> is not at the repo root, so the
spelling message now names the missing source in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 14:29:22 +04:00
Anton YakutovichandClaude Opus 5.5 1688442a1a fix(scripts): fail reference links the shared sync cannot see
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 14:37:09 +04:00
Anton Yakutovich df50a6db53 Merge remote-tracking branch 'upstream/main' into fix/skill-local-reference-links 2026-11-14 22:55:31 +04:00
kevin 08fcd164ee fix(validator): keep markup inside code spans in heading slugs
slugify stripped anything that looked like an HTML tag or a link before
dropping punctuation, including inside code spans. GitHub renders a code
span's text as written, so a heading like `## Use `<dialog>` for modals`
gets the anchor #use-dialog-for-modals; the validator produced
#use--for-modals and rejected the real anchor.
2026-11-11 22:08:49 +09:00
Anton YakutovichandClaude Opus 5.5 50f1dbc5cb fix(skills): keep generated checklist copies in references/shared/
The copies sat next to each skill's own reference files and filled PR
diffs. They now live in skills/<name>/references/shared/, which holds
only generated files, and .gitattributes marks that directory
linguist-generated so GitHub collapses it in diffs and language stats.
The sync script refuses to overwrite or delete a hand-written file there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XTTwR4HS4sWgZ992ThEwmP
2026-10-19 11:10:55 +04:00
Anton YakutovichandClaude Opus 5.5 44e851440f fix(skills): generate skill-local copies of shared checklists
Git for Windows checks symlinks out as text files by default, so the
skill-local symlinks broke a full checkout there. Each skill now holds a
generated copy of the shared checklists it links, written from the root
references/ by scripts/sync-shared-references.js. CI runs it with --check
and fails when a copy is missing, stale, or no longer linked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XTTwR4HS4sWgZ992ThEwmP
2026-10-19 10:48:34 +04:00
Anton YakutovichandClaude Opus 5.5 490628900b fix(validate-reference-links): fail a link that leaves the skill directory
A per-skill install copies only skills/<name>/, so a link that resolves
outside it breaks after install even when the repo file exists. The
check now fails such links and its hint names the skill-local symlink.
Links from files inside a skill's references/ use ../references/<file>.md
so their anchors stay checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KepYXCwn74SMeQ8XcKPL31
2026-10-10 16:42:21 +04:00
Rudy Celekli 2d3fbcd2d2 Keep reference heading anchors unique
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
2026-10-03 10:58:25 -04:00
Joan Leon a831506ed1 fix(validator): check #anchor fragments on references/ links 2026-10-02 10:30:47 +02:00
Joan Leon cb4366f010 fix(validator): check references/ links inside a skill's own references/ files (#585)
A file under skills/<name>/references/ sits one directory deeper than SKILL.md, so a link to a shared checklist needs ../../../references/ from there. The validator only read SKILL.md, which left that off-by-a-level mistake unguarded in the one place it can now happen (hardening-patterns.md on main, optimization-patterns.md in #580).

The rule is unchanged: only references/*.md links, fenced blocks exempt, paths that do not exist yet ignored. The file set grows to include the markdown files directly inside each skill's references/ directory, and every link resolves from the file that contains it. The failure hint names the three-level prefix when the violation is in a reference file.
2026-09-20 23:24:42 +02:00
ayobamiseun 42d4c6085f fix(validator): share fence parsing to preserve reference-link checks
Reuse the skill linter's fence parser so inline backticks cannot hide broken references and trailing text cannot close a code fence. Cover both failures with LF and CRLF regression cases, preserving diagnostic line numbers.
2026-09-20 18:37:17 +01:00
Addy Osmani e79ff3bb0d Merge #517: exempt fenced examples from the references link check 2026-09-17 16:37:57 -07:00
dajiaohuang ef66f42509 test: normalize reference validator paths
Signed-off-by: dajiaohuang <mikewushuwen@outlook.com>
2026-09-16 07:57:15 +08:00
Abhishek Sharma 7bf5faec6f fix(validator): exempt fenced examples from the references/ link check
`validate-reference-links.js` scans every line of a SKILL.md, so a
`references/…md` path shown inside a fenced code block is treated as a link
to resolve. The rule this validator enforces therefore cannot be documented:
its own failure message tells authors to write `../../references/<file>.md`
rather than `references/<file>.md`, and a skill showing that contrast as an
example fails the check that is explaining it.

Reproduced on main by appending a fenced markdown example to
using-agent-skills/SKILL.md — exit 1, with the guidance text printed
underneath the very link it had just rejected.

Lines inside a fence are now skipped. The scan is line-by-line rather than
one regex over the document so the three CommonMark fence forms all hold:
tilde fences, up to three spaces of indent, and a closing fence longer than
its opener — and a ``` line inside a ~~~ block does not close it.

Line numbers are preserved by collecting fenced line indices and skipping
them during the scan, rather than stripping the text first, so the L<n> in
an error still points at the real line.

Deliberately local rather than shared with scripts/lib/skill-lint.js: that
module's stripFencedCodeBlocks is the single regex with the gaps described
in #437, and #444 is already rewriting it. Forking a rewrite in flight
costs more than the duplication; once #444 lands the two should collapse
into one helper under scripts/lib/.

Three tests added. All three fail against the current validator; the third
pins that a genuinely broken link outside a fence is still reported, so the
exemption cannot silently swallow real breakage.
2026-08-25 13:05:20 -07:00
coolTheWorldandClaude Opus 5 b293c02481 ci: add a gate for references/ links in skills
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>
2026-08-07 07:27:44 -04:00