
Tsdown
Configure tsdown to bundle a TypeScript library with correct formats, declarations, exports, and framework entry points.
Overview
tsdown is an agent skill for the Build phase that configures the tsdown library bundler—formats, types, exports, and framework builds—for solo TypeScript package authors.
Install
npx skills add https://github.com/rolldown/tsdown --skill tsdownWhat is this skill?
- Covers config formats, workspace setups, entry points, and multi-format outputs (ESM, CJS, IIFE, UMD)
- Dependency externalization and inline rules with auto-externalization behavior
- Type declaration generation, export maps, shims, and CJS default interop
- Framework paths for React, Vue, Solid, and Svelte component libraries
- CLI command reference plus programmatic API, plugins, hooks, and Rolldown options
- Documents 4 output formats: ESM, CJS, IIFE, UMD
- Framework integration coverage for 4 stacks: React, Vue, Solid, Svelte
Adoption & trust: 897 installs on skills.sh; 4.1k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your TypeScript library build is split across ad-hoc scripts and you cannot get ESM, CJS, and declarations to publish cleanly.
Who is it for?
Indie maintainers shipping npm libraries, design systems, or framework wrappers who want Rolldown speed with opinionated defaults.
Skip if: Full-stack app bundling with Vite or Next where application serving—not library packaging—is the main job.
When should I use this skill?
Building TypeScript/JavaScript libraries, configuring bundlers, generating type declarations, multi-format builds, or migrating from tsup.
What do I get? / Deliverables
You leave with a tsdown config, CLI workflow, and export strategy that produces publishable artifacts and a clear tsup migration path if needed.
- tsdown config file
- Build scripts and CLI invocation
- Export map and declaration output layout
Recommended Skills
Journey fit
Library bundling and package exports are core Build work before you ship a consumable npm package or component kit. Frontend shelf fits ESM/CJS/IIFE outputs, React/Vue/Svelte integration, and publishable UI or SDK packages—even when consumed by backends.
How it compares
Skill package for library bundling with tsdown, not a hosted CI service or generic app vite config tutor.
Common Questions / FAQ
Who is tsdown for?
Solo builders and small teams packaging TypeScript or JavaScript libraries who want agent-guided tsdown setup and maintenance.
When should I use tsdown?
During Build frontend packaging when you define entry points, generate types, tune externals, or migrate from tsup before Ship launch prep.
Is tsdown safe to install?
Use the Security Audits panel on this Prism page and pin tsdown versions in package.json after reviewing the skill’s suggested install commands.
SKILL.md
READMESKILL.md - Tsdown
# tsdown Skills Agent skills that help AI coding agents understand and work with [tsdown](https://tsdown.dev), the elegant library bundler. ## Installation ```bash npx skills add rolldown/tsdown ``` This will install all tsdown skills (including the migration skill). To install only the tsdown skill: ```bash npx skills add rolldown/tsdown --skill tsdown ``` ## What's Included The tsdown skill provides Claude Code with knowledge about: - **Core Concepts** - What tsdown is, why use it, key features - **Configuration** - Config file formats, options, multiple configs, workspace support - **Build Options** - Entry points, output formats, type declarations, targets - **Dependency Handling** - External/inline dependencies, auto-externalization - **Output Enhancement** - Shims, CJS defaults, package exports - **Framework Support** - React, Vue, Solid, Svelte integration - **Advanced Features** - Plugins, hooks, programmatic API, Rolldown options - **CLI Commands** - All CLI options and usage patterns - **Migration** - Migrating from tsup to tsdown ## Usage Once installed, Claude Code will automatically use tsdown knowledge when: - Building TypeScript/JavaScript libraries - Configuring bundlers for library projects - Setting up type declaration generation - Working with multi-format builds (ESM, CJS, IIFE, UMD) - Migrating from tsup - Building framework component libraries ### Example Prompts ``` Set up tsdown to build my TypeScript library with ESM and CJS formats ``` ``` Configure tsdown to generate type declarations and bundle for browsers ``` ``` Add React support to my tsdown config with Fast Refresh ``` ``` Help me migrate from tsup to tsdown ``` ``` Set up a monorepo build with tsdown workspace support ``` ## Related Skills - **[tsdown-migrate](https://github.com/rolldown/tsdown/tree/main/skills/tsdown-migrate)** - Dedicated skill for migrating from tsup to tsdown, with complete option mappings, config transformations, and troubleshooting guidance. ## Documentation - [tsdown Documentation](https://tsdown.dev) - [GitHub Repository](https://github.com/rolldown/tsdown) - [Rolldown](https://rolldown.rs) - [Migration Guide](https://tsdown.dev/guide/migrate-from-tsup) ## License MIT # Benchmark tsdown delivers exceptional performance: - **~2x faster** than tsup for standard builds - **Up to 8x faster** for TypeScript declaration generation For detailed comparisons, see [bundler-benchmark](https://gugustinette.github.io/bundler-benchmark/). # CI Environment Support Automatically detect CI environments and toggle features based on local vs CI builds. ## Overview tsdown detects CI from the `CI` environment variable. CI mode is enabled when `process.env.CI` is set to a value other than `0` or `false` (case-insensitive). ## CI-Aware Values Several options accept CI-aware string values: | Value | Behavior | |-------|----------| | `true` | Always enabled | | `false` | Always disabled | | `'ci-only'` | Enabled only in CI, disabled locally | | `'local-only'` | Enabled only locally, disabled in CI | ## Supported Options These options accept CI-aware values: - `dts` - TypeScript declaration file generation - `publint` - Package lint validation - `attw` - "Are the types wrong" validation - `report` - Bundle size reporting - `exports` - Auto-generate `package.json` exports - `unused` - Unused dependency check - `devtools` - DevTools integration - `failOnWarn` - Fail on warnings (defaults to `false`) ## Usage ### String Form ```ts export default defineConfig({ dts: 'local-only', // Skip DTS in CI for faster builds publint: 'ci-only', // Only run publint in CI failOnWarn: 'ci-only', // Fail on warnings in CI only (opt-in) }) ``` ### Object Form When an option takes a configuration object, set `enabled` to a CI-aware value: ```ts export default defineConfig({ publint: { enabled: 'ci-only', level: 'error', }, attw: { enabled: 'ci-only', profile: 'node16', }, })