Repository navigation
Description
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=1The 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:
- Widen the walks of
TestDocuments_LinksResolveandTestDocuments_NameOnlyTestsThatExistto.claude/skills, asTestDocuments_OpenNoLineWithAPlusandTestDocuments_CiteNoRetiredPagewalk it beside the root. - 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 … -runspan, 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'sgo test ./internal/archtest -run TestDocCommentsamong them. Reading a-runpattern'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). - Delete the lint's
LINK,DESIGN_SECTIONwithdesign_anchorsandHEADING,KEY, andTESTwithload_tree's test scan, and their test rows. The{{.TestImports}}misreading goes withTEST.
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.
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