Skip to content

docs(skills): document bare-specifier vs scorer hermeticity (swamp-club#161)#1220

Merged
stack72 merged 1 commit intomainfrom
fix/skill-zod-bare-specifier-issue-161
Apr 24, 2026
Merged

docs(skills): document bare-specifier vs scorer hermeticity (swamp-club#161)#1220
stack72 merged 1 commit intomainfrom
fix/skill-zod-bare-specifier-issue-161

Conversation

@stack72
Copy link
Copy Markdown
Contributor

@stack72 stack72 commented Apr 24, 2026

Summary

Closes swamp-club#161. Following #1218 shipping swamp extension quality, authors now discover locally that the scorer strips the tarball's deno.json and writes a controlled one with no imports map — so bare "zod" imports fail with deno doc --json failed: Import "zod" not a dependency before factor scoring even begins. This PR teaches that pattern to authors through the two skills that previously led them into the trap.

Three files, +50/-7 lines:

  • swamp-extension-quality/references/templates.md — the JSDoc entrypoint skeleton was showing bare "zod"; switched to "npm:zod@4" with a rationale bullet explaining hermeticity. An author who copies the template literally now produces an extension that scores.
  • swamp-extension-publish/references/publishing.md — the Import Rules had two contradictory bullets ("npm:zod@4" is "always required" vs. bare specifiers "can be used" with deno.json). Rewritten into one coherent paragraph that carries both load-bearing signals: hermeticity at score time AND zod-specific externalization (why zod in particular is called out, not merely a consequence of hermeticity).
  • swamp-extension-quality/SKILL.md — added a gotcha block under "Essential mechanics authors get wrong" that names the failure mode explicitly, calls out the Deno no-import-prefix default that activates when a deno.json with imports is present (which is every swamp repo's default state, creating a catch-22), and gives concrete mitigations: either global "lint": { "rules": { "exclude": ["no-import-prefix"] } } in deno.json, or per-import // deno-lint-ignore no-import-prefix. Also added a one-sentence cross-link from the new "Self-check your score locally" section and a symptom→fix row to "Common patterns" so a reader landing anywhere in the skill finds the fix.

Test Plan

Three-layer verification:

  • deno fmt --check clean on all three files
  • deno check clean
  • deno lint clean (1088 files)
  • deno run test4803 passed, 0 failed
  • Executable round-trip in /tmp/swamp-issue-161-verify:
    • Bare "zod" import → swamp extension quality throws the exact error documented in the gotcha (deno doc --json failed: Warning Import "zod" not a dependency)
    • Switch to "npm:zod@4" → scorer runs and reports 11/12 (91%) factor results
    • The test also surfaced the Deno no-import-prefix default rule firing as predicted, and the documented mitigation (lint.rules.exclude) unblocked the round-trip — confirming both halves of the gotcha match the tool's actual behaviour.

Follow-up (not in this PR)

The deadlock between the scorer (strips deno.json) and Deno's default lint rules (forbid npm: prefix when an imports map is present) is ultimately a swamp-club server-side concern. A future follow-up issue could make the analyzer honour the tarball's files/deno.json with appropriate hardening — the README/LICENSE promotion logic already does similar. Until then, the gotcha documents the author-side workaround.

🤖 Generated with Claude Code

…mp-club#161)

Following #1218 shipping `swamp extension quality`, authors now see locally
that the scorer strips the tarball's `deno.json` and writes a controlled one
with no imports map — so bare `"zod"` imports fail with
`deno doc --json failed: Import "zod" not a dependency`. Three files teach
authors the pattern that was silently breaking their scores.

- `swamp-extension-quality/references/templates.md` — switch the JSDoc
  entrypoint skeleton from bare `"zod"` to `"npm:zod@4"` and add a
  rationale bullet.
- `swamp-extension-publish/references/publishing.md` — rewrite the
  contradictory Import Rules (one bullet said inline was "always required",
  another said bare was fine with an import map). Single coherent paragraph
  now carries both the hermeticity and zod-externalization signals.
- `swamp-extension-quality/SKILL.md` — add a gotcha block under "Essential
  mechanics authors get wrong" covering the bare-specifier failure mode,
  the Deno `no-import-prefix` default catch-22 when a `deno.json` with
  `imports` is present, and concrete mitigations (global `lint.rules.exclude`
  or per-import `// deno-lint-ignore`). Cross-link from the new
  "Self-check your score locally" section to the gotcha. Add a symptom→fix
  row to "Common patterns".

Verified via executable round-trip in /tmp: bare `"zod"` fails the quality
command with the documented error; `"npm:zod@4"` plus the lint exclusion
scores 11/12.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Code Review

Blocking Issues

None.

Suggestions

  1. In SKILL.md, the sentence "The deadlock goes away entirely once the scorer honours the tarball's files/deno.json" is forward-looking — consider adding a tracking reference (e.g. a follow-up issue number) so it can be cleaned up when the server-side fix lands. Minor, and the PR body already calls this out as a follow-up.

  2. The publishing.md rewrite is thorough but the section is now notably longer than the other Import Rules it sits alongside. Not a problem for correctness, but if it ever feels heavy, the hermeticity explanation could move to a references/ file with a one-line pointer. Fine as-is given the complexity of the trap being documented.

Overall: well-structured fix that resolves a real contradiction in the import rules docs and documents a non-obvious failure mode with concrete mitigations. The template fix ("zod""npm:zod@4") is the highest-value change — authors who copy the skeleton literally now produce extensions that score.

@stack72 stack72 merged commit 03130a3 into main Apr 24, 2026
10 checks passed
@stack72 stack72 deleted the fix/skill-zod-bare-specifier-issue-161 branch April 24, 2026 18:08
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.

1 participant