agentleFS
relvo-labsrelvo-labs/agent-runtime/.agents/skills/package-artifact-validation/SKILL.md

package-artifact-validation

Skill0 starsChanged 47 days agoApache-2.0View on GitHub

Validate what a package actually publishes by inspecting packed tarballs, exports maps, declarations, publint and Are The Types Wrong rather than trusting the source tree.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when a change touches any of:

    line 13
  2. Distinctive:

    Do not use this skill when:

    line 23
  3. Very specific:

    The source tree lies. The tarball does not: Never validate packaging by importing from packages/*/src.

    line 50
  4. Very specific:

    Always export ./package.json.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Package artifact validation

Trigger

Use this skill when a change touches any of:

  • a package exports, main, types, files, sideEffects or publishConfig field
  • tsdown.config.ts or build output layout
  • .npmignore / packing behaviour
  • tools/repo/check-artifacts.ts
  • any report from publint or @arethetypeswrong/cli

Counter-trigger

Do not use this skill when:

  • you are deciding whether a symbol should be public — use public-api-evolution
  • you are adding a package or a workspace dependency edge — use package-architecture
  • you are choosing a version number — use changesets-release

Owns

  • packages/*/package.json#exports — the exports, files, types and publishConfig fields
  • packages/*/tsdown.config.ts — build input, output layout and declaration emission
  • tools/repo/check-artifacts.ts — pack, inspect, install, smoke
  • docs/adr/ADR-0007-module-format-and-exports.md — the ESM-only decision record

Does not own

  • packages/protocol/src — owned by public-api-evolution for export decisions and by runtime-contract-evolution for schemas
  • pnpm-workspace.yaml#packages — owned by package-architecture
  • pnpm-workspace.yaml#catalog — owned by pnpm-supply-chain

Relationships

  • boundary-with → public-api-evolution — that skill decides the API; this skill proves the API survives publication.
  • boundary-with → package-architecture — that skill owns package existence and layering; this skill owns build and packaging mechanics.
  • boundary-with → local-ci-parity — this skill defines the artifact checks; that skill guarantees they run identically in CI.

Procedure

  1. The source tree lies. The tarball does not. Never validate packaging by importing from packages/*/src. Always pnpm pack, extract, install into a scratch project and import by package specifier.
  2. Required package.json shape for every publishable package:

    {
      "type": "module",
      "exports": {
        ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
        "./package.json": "./package.json",
      },
      "files": ["dist", "README.md", "LICENSE", "NOTICE"],
      "sideEffects": false,
      "publishConfig": { "access": "public", "provenance": true },
    }
    • types must be first in every export condition object.
    • Always export ./package.json; tooling reads it.
    • npm provenance must stay enabled so a future public release is attributable to its build environment; the artifact gate rejects false or omission.
    • No main/module/types top-level fallbacks that disagree with exports.
    • This repository is ESM-only. Do not add a CJS condition without an ADR amendment — dual publishing re-introduces the dual-package hazard for our stateful registry.
  3. Every entry point needs a declaration. tsdown emits .d.ts per entry. A subpath export without a matching types condition is invisible to node16/bundler resolution and will be reported by ATTW.
  4. Inspect the file list, not just the exit code:

    pnpm --filter <pkg> pack --pack-destination /tmp/artifacts
    tar -tzf /tmp/artifacts/<pkg>-<v>.tgz | sort

    Reject the tarball if it contains: src/, test/, *.tsbuildinfo, tsconfig*.json, *.map you did not intend, or a missing LICENSE/NOTICE.

  5. Run the two independent linters. They catch different classes:

    • publint — malformed exports, wrong file extensions, unresolvable paths
    • attw --pack — resolution-mode failures (FalseESM, NoResolution, MissingExportEquals, masked types)

    Neither may be waived by a config exclusion without an inline comment naming the reason and an issue link.

  6. Consumer smoke from the tarball. tools/repo/check-artifacts.ts installs the packed tarballs into a throwaway directory with a clean store and runs examples/consumer-smoke. This is what catches a missing runtime dependency that the workspace symlink was silently satisfying.

Verification

pnpm build
pnpm artifacts:check
pnpm gate

pnpm artifacts:check is expected to be slow (it performs a real install). It must never be skipped locally before requesting review, and it must never be given network access to a registry other than the one in .npmrc.

Provenance

  • Source: independent — authored for this repository against the Node.js "Modules: Packages" documentation, the npm package.json reference, the publint rule list and the Are The Types Wrong problem catalogue.
  • Incorporated: rolldown/tsdown@f7f0cc3adb70d2589216d479a59f226869ac4b08 (MIT) — the entry/exports/declaration expectations in step 2 and the "validate the packed artefact" ordering follow tsdown's documented publishing guidance.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.