Skip to content

skills: move skills_lint's link, heading and test-name checks into archtest #2381

Done

Description

@OmarAlJarrah

Problem

skills_lint.py makes four checks on the skills that internal/archtest already makes on every other Markdown document. archtest's walks go through keydoc.Walk, which passes over every directory whose name starts with a dot, so .claude/skills falls to a second implementation in Python. The two can drift, as the retired-page check's two copies did until #2379 moved it into archtest.

Lint check (.claude/skills/morphic-curating-skills/scripts/skills_lint.py) archtest test that already makes it
links: LINK, "link target X does not exist" TestDocuments_LinksResolve (documentLinkProblems), which also holds the heading a link names
design-document headings: DESIGN_SECTION with Linter.design_anchors, "docs/X has no heading Y" TestDocuments_LinksResolve, a docs/…md#heading citation on any line (docPath), for every document under docs/, not only docs/ir and docs/emitters
keyed entries: KEY, "docs/X.md has no entry Y" TestDocuments_LinksResolve, the same docPath citation: an entry is a heading, and every one the skills cite spells docs/ (git ls-files '.claude/skills/*.md' | xargs grep -ohE '[A-Za-z0-9_./-]*(parser-library|compilers/openapi)\.md#[a-z0-9-]+' | sed -E 's/#.*//' | sort | uniq -c → 9 docs/compilers/openapi.md, 9 docs/parser-library.md)
test names: TEST, held to the names load_tree reads with TEST_DECL, "no test named X" TestDocuments_NameOnlyTestsThatExist (testNameProblems), which reads test files' syntax and a pkg.TestName qualifier

The lint's copy of the test-name check also misreads: TEST takes any Test and a capital after a non-word character, so a go list template field reads as a test. A skill writing `go list -f '{{.TestImports}}' ./ir` draws no test named TestImports. No skill writes it today (git grep -n TestImports -- .claude prints nothing), so it is latent; archtest's reader, which takes a span that is a test's name alone, passes it.

Reproduction at abe969678, planting one of each in a skill:

printf '%s\n' 'See [gone](references/nope.md), `docs/ir/models.md#no-such-heading` and `TestNoSuchTestAnywhere`.' \
  "List with \`go list -f '{{.TestImports}}' ./ir\`." \
  'Cite `docs/parser-library.md#no-such-entry`.' \
  >> .claude/skills/morphic-curating-skills/references/rule-format.md
python3.14 .claude/skills/morphic-curating-skills/scripts/skills_lint.py
go test ./internal/archtest -run 'TestDocuments_LinksResolve|TestDocuments_NameOnlyTestsThatExist' -count=1

The lint reports all five, the last a false one:

.claude/skills/morphic-curating-skills/references/rule-format.md:11: link target references/nope.md does not exist
.claude/skills/morphic-curating-skills/references/rule-format.md:11: no test named TestNoSuchTestAnywhere
.claude/skills/morphic-curating-skills/references/rule-format.md:11: docs/ir/models.md has no heading no-such-heading
.claude/skills/morphic-curating-skills/references/rule-format.md:12: no test named TestImports
.claude/skills/morphic-curating-skills/references/rule-format.md:13: docs/parser-library.md has no entry no-such-entry

archtest prints ok. With keydoc.Walk letting .claude through (its dot-directory case given && d.Name() != ".claude"), the same two tests report the four real plants and not TestImports:

testnames_test.go:53: .claude/skills/morphic-curating-skills/references/rule-format.md:11 names "TestNoSuchTestAnywhere", which no test file declares
doclinks_test.go:72: .claude/skills/morphic-curating-skills/references/rule-format.md:11 cites docs/ir/models.md#no-such-heading, whose file has no such heading
doclinks_test.go:72: .claude/skills/morphic-curating-skills/references/rule-format.md:11 links "references/nope.md", which names no file
doclinks_test.go:72: .claude/skills/morphic-curating-skills/references/rule-format.md:13 cites docs/parser-library.md#no-such-entry, whose file has no such heading

With the walk widened and nothing planted, both pass, so the skills already meet archtest's checks.

Direction

A proposal:

  1. Widen the walks of TestDocuments_LinksResolve and TestDocuments_NameOnlyTestsThatExist to .claude/skills, as TestDocuments_OpenNoLineWithAPlus and TestDocuments_CiteNoRetiredPage walk it beside the root.
  2. Before deleting the lint's test-name check, close the one place archtest reads less. archtest reads a span that is a test's name alone, while the skills write 19 test names inside a go test … -run span, which the lint holds and archtest would not (git ls-files '.claude/skills/*.md' | xargs grep -ohE '`[^`]*-run [^`]*Test[^`]*`' | wc -l → 19). The same reader passes the 5 such spans in the other documents (git ls-files '*.md' ':!.claude/**' ':!**/testdata/**' | xargs grep -ohE '`[^`]*-run [^`]*Test[^`]*`' | wc -l → 5), CLAUDE.md's go test ./internal/archtest -run TestDocComments among them. Reading a -run pattern's names in archtest holds both; the alternative, accepting the loss, leaves those spans unheld. The lint also reads test names in prose, which no skill writes today (git ls-files '.claude/skills/*.md' | xargs perl -ne 's/`[^`]*`//g; print "$ARGV:$.\n" if /(?:^|[^A-Za-z0-9_])Test[A-Z]/; close ARGV if eof' | wc -l → 0).
  3. Delete the lint's LINK, DESIGN_SECTION with design_anchors and HEADING, KEY, and TEST with load_tree's test scan, and their test rows. The {{.TestImports}} misreading goes with TEST.

Out of scope

The lint's checks archtest has no counterpart for: frontmatter and word caps, the rule format, rule citations (#1539), paths in spans, prose and commands (#1580 covers archtest's side of code paths), Go names placed in a file, architecture §N sections, diagnostic codes, machine-specific paths and the scripts' checks.

Related: #1539, #1580, #2379

Priority: P4, rule 1 (housekeeping: moves checks of the skills from one checker to another and changes no lowering, validation, IR or emit-contract behaviour). Reproduction above at morphic @abe969678.

Activity

  1. added
    type:chore
    priority:P4
    on Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P4type:chore

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions