---
name: "tsup-zero-config-typescript-bundler"
description: "Bundle TypeScript libraries into ESM and CommonJS formats with generated declaration maps in seconds."
metadata:
  author: "EGOIST"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "bundle typescript library tsup"
  - "tsup generate d.ts"
  - "dual package cjs esm tsup"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# tsup Zero-Config TypeScript Library Bundler

Configures tsup: bundling with esbuild under the hood, emitting dual ESM and CJS formats (format: ['cjs', 'esm']), generating .d.ts type definitions, cleaning output folders, and building CLI executables with shebang support.

## When to Invoke
Invoke this skill whenever you need to:
- bundle typescript library tsup
- tsup generate d.ts
- dual package cjs esm tsup

## Execution SOP & Rules
1. Create tsup.config.ts declaring entry: ['src/index.ts'], format: ['cjs', 'esm'], dts: true, clean: true.
2. Configure package.json exports mapping 'import' to dist/index.mjs and 'require' to dist/index.js.
3. Enable minification and sourcemaps for production release builds: minify: true, sourcemap: true.
4. Execute build: npx tsup to compile entire library in sub-500ms.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
