node-packaging
Skill1 starsChanged 3 months agoMITView on GitHub
Configures npm package artifacts - package.json exports maps, ESM-first vs dual format decisions, tsdown/tsup bundling, publint and arethetypeswrong gates, files whitelist, engines. Use when the user asks to package a library for npm, fix consumer import or type-resolution errors, or check publish-readiness. Not for version bumps, changelogs, releases, or registry auth.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-skillSkill
- publish-repoSkill
- nextjs-qualitySkill
- node-ciSkill
- node-lintSkill
- node-releaseSkill
- node-supply-chainSkill
- node-testingSkill
- node-typescriptSkill
The file
Files
node-packaging
Makes a package that installs and resolves correctly for every consumer you claim to support — module format, exports map, types, and tarball contents. The failures this skill fixes: models declare "ESM-only is fine now" without checking the consumer Node range, write exports maps whose types don't resolve, and publish tarballs full of source and CI junk.
When NOT to use
- Version bumps, changelogs, publishing, OIDC →
node-release. - Declaration emission / tsconfig →
node-typescript(this skill owns how consumers resolve what was emitted). - Dependency hygiene →
node-supply-chain.
Workflow
- Decide format from evidence, not fashion — ESM-first, not ESM-always:
read
package.json#enginesand the consumer reality.require(esm)exists only on specific Node lines and has real constraints (no top-level await in the required graph) — the support matrix and decision framework live inreferences/packaging-playbook.md. Dual ESM+CJS when older engines, tooling, or stated consumers demand it — with the dual-package hazard mitigation from the playbook. - Write the exports map explicitly (playbook blocks for ESM-only and dual):
correct
typescondition placement, subpath exports only for supported API,sideEffectswhere true. - Build: tsdown as the current default (tsup acceptable with rationale) —
declarations on, target matching
engines. - Tarball hygiene:
fileswhitelist (never.npmignorearchaeology),engines,packageManagerwhere the repo pins one. - Gate — never skip:
(npm pack dry-run inspection +bash "${CLAUDE_SKILL_DIR}/scripts/check_package.sh"publint+arethetypeswrong— exact commands in the script; it exits non-zero on any finding.) - Consumer-error diagnosis (
ERR_REQUIRE_ESM, "types not found"): playbook has the decision tree — identify the consumer's Node/module context first; options are documented support-range, genuine dual build, or exports fix. Never blind-add CJS.
Output spec
Explicit exports map; format decision written down with the engines evidence;
build emitting exactly what exports declares; files whitelist; both gates
(publint, attw) clean; npm pack --dry-run tarball reviewed. Changing format or
exports of a published package is semver-major — say so.
Gotchas
- The dual-package hazard (two module instances) is real — singleton/state packages need the playbook's mitigation or ESM-only with a documented range.
- attw failures read cryptically; the playbook maps its codes to concrete exports-map fixes.
enginesdrives everything downstream (CI matrix innode-ci, format here) — set it deliberately, never inherit it silently.- Version-gate the
require(esm)support matrix — re-verify Node ranges against nodejs.org docs at use time.
Files
references/packaging-playbook.md— require(esm) matrix, format decision framework, exports blocks, bundler status, hazard mitigations, error decision tree.scripts/check_package.sh— pack dry-run + publint + attw gate; non-zero exit on findings; degrades with a clear message when Node/npx is unavailable.
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
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.

