Ts packaging
Skill fusengine/agents/plugins/typescript-expert/skills/ts-packaging
Use when publishing a TypeScript library — exports map, JSR vs npm, dual ESM/CJS, type validation, provenance. Covers modern package.json, jsr.json, and release CI. Do NOT use for application deployment (not a library) or framework build pipelines (use the framework expert's skills).From its SKILL.md
npx -y skills add fusengine/agents --skill ts-packagingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 22 stars22 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.8 KB, 851 tokens by cl100k_base, as published. Nobody here has run it
TypeScript Packaging
Ship a TypeScript library with a correct exports map, on the right registry.
Agent Workflow (MANDATORY)
Before ANY implementation, use TeamCreate to spawn 3 agents:
- fuse-ai-pilot:explore-codebase - Inspect package.json, build output, targets
- fuse-ai-pilot:research-expert - Verify latest JSR / npm / Node exports docs via Context7/Exa
- mcp__context7__query-docs - Check conditions ordering, attw usage
After implementation, run fuse-ai-pilot:sniper for validation.
Overview
| Registry | Format | Publishes | Best for |
|---|---|---|---|
| JSR | ESM only | TS source directly | Deno/Node/Bun libs, doc-rich APIs |
| npm | ESM (or dual ESM/CJS) | Built .js + .d.ts | Broadest public reach, CJS consumers |
Rule of thumb: internal or Bun/Deno/ESM-only consumer → ESM-pure; broad public library still serving CommonJS → dual ESM/CJS.
Critical Rules
"types"first,"default"last - Conditions match in object order- Match
import↔ESM andrequire↔CJS - Never pointrequireat ESM - One subpath per module - Consistent specifier; set
"type": "module"explicitly - Validate with attw -
arethetypeswrongbefore every publish - Provenance on public releases - Publish from CI with
id-token: write
Decision Guide
Publishing a TS library?
├── Consumers on Deno/Bun/Node ESM, want source + docs → JSR (ESM only)
│ └── Fix "slow types" (explicit return/prop/const types)
└── Public npm audience
├── ESM-only consumers → ESM-pure package.json
└── Some consumers still on CJS → dual ESM/CJS exports
→ See references/exports-map.md for the conditions model
Reference Guide
Concepts
| Topic | Reference | Load when |
|---|---|---|
| Exports map & conditions | references/exports-map.md | Writing the exports field |
| JSR publishing | references/jsr-publishing.md | Publishing TS source to JSR |
| npm publishing | references/npm-publishing.md | Publishing to npm (dual/ESM) |
| Type validation | references/validation.md | Checking types resolve correctly |
Templates
| Template | Use Case |
|---|---|
references/templates/package-json-dual.md | Dual ESM/CJS + ESM-pure package.json |
references/templates/jsr-json.md | jsr.json with multi-entry exports |
references/templates/publish-workflow.md | GitHub Actions release with provenance |
Quick Start
Modern exports (ESM-pure)
{
"type": "module",
"exports": {
".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
}
}
Validate before publish
npx @arethetypeswrong/cli --pack
→ See references/validation.md
Best Practices
DO
- Set
"type"explicitly, even for CJS packages - Provide
typesin every conditional branch - Publish from CI so provenance is automatic
DON'T
- Ship dual CJS when every consumer is ESM (dead weight)
- Order
"default"before"types"(breaks type resolution) - Use
--allow-slow-typeson JSR as a habit (degrades docs + npm compat)
What ships with it: 8 files
15.3 KB alongside SKILL.md
references/
- exports-map.md2.5 KB
- jsr-publishing.md2.6 KB
- npm-publishing.md2.3 KB
- templates/jsr-json.md1.6 KB
- templates/package-json-dual.md2.3 KB
- templates/publish-workflow.md2.0 KB
- validation.md1.9 KB
- .gitkeep0 B
Gives 0 of the 12 instructions most ship operate skills give in 851 tokens
Counted across 779 of the 1,178 authors here whose files we hold, read 2026-08-07
- Document a rollback plan before deploymentin 41 of 779, across 22 files
- Update the changelogin 21 of 779, across 19 files
- Run the test suitein 20 of 779
- Create an annotated git tagin 20 of 779
- Clean up feature flags after full rolloutin 18 of 779, across 10 files
- Verify deployment health after launchin 18 of 779, across 10 files
- Test both feature flag statesin 17 of 779, across 9 files
- Verify the working tree is cleanin 17 of 779
- Make database migrations backward-compatiblein 16 of 779, across 8 files
- Set up error monitoring before launchin 15 of 779, across 7 files
- Monitor metrics at each rollout stagein 14 of 779, across 5 files
- Create a GitHub releasein 14 of 779
Said here and by no other author read
- spawn 3 agents before implementation
- place types condition before default condition
- match import to ESM and require to CJS
- set type field explicitly
- use one subpath per module
- fix slow types in JSR packages
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.