About tsdown
A workflow skill for TypeScript library builds with tsdown, for developers configuring builds, declarations, exports, dependencies, or migrations from tsup. It focuses on current APIs and checking build artifacts and package consumption.
Key features
- 01Build configuration and CLI guidance
- 02Type declarations and exports guidance
- 03Dependency bundling controls
- 04Plugin, CSS, and workspace guidance
- 05tsup and version migration guidance
Use cases
- 01Configuring a TypeScript library build
- 02Checking generated declarations and exports
- 03Adjusting dependency externalization
- 04Migrating a project from tsup
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ dobroslavradosavljevic/ skills --skill tsdownAfter installing, type/tsdownin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
agents/openai.yamlreferences/config-cli.mddts-exports-deps.mdmigrate-from-tsup.mdplugins-css-workspace.mdsource-map.mdusage-guide.mdDetails
From the project READMEtsdown
Use this skill when work touches tsdown: library builds, tsdown.config, dts/exports, dependency externalization, watch/unbundle, CSS/plugins/workspace, upgrading 0.22 → 0.23, or migrating from tsup.
Snapshot: [email protected] (2026-10-01). Refresh from source-map.md if versions differ.
Workflow
- Inspect the local tsdown surface:
- Package version (
[email protected]preferred; snapshot 0.23.0). Node to run the tool:^22.18.0 || ^24.11.0 || >=26.0.0(Node 25 dropped in 0.23). - Config:
tsdown.config.ts/package.json#tsdown; peers (typescript,@tsdown/css,publint, …). package.jsontype,exports,types,engines.node(feeds target/dts auto-detect).- Whether migrating from tsup (
external,entryPoints,bundle: false, …).
- Package version (
- For day-to-day how-to, follow usage-guide.md first.
- Refresh docs when versions drift. Start from source-map.md.
- Route deeper detail:
- Config/CLI/defaults: config-cli.md.
- dts, package exports, deps: dts-exports-deps.md.
- Plugins, CSS, copy, workspace, programmatic: plugins-css-workspace.md.
- tsup migration and 0.22 → 0.23 upgrade: migrate-from-tsup.md.
- Prefer current APIs:
entry,deps.neverBundle/alwaysBundle/onlyBundle,unbundle,copy,cjsDefault,dts.generator. Treat CJS as maintenance; prefer ESM-only for new libraries. - Verify with
bunx tsdown(or projectbuild), checkdist+exports/types, then consume the package from a smoke import.
Core Judgment
- tsdown = library bundler on Rolldown + Oxc — spiritual successor to tsup, not an app bundler.
- Defaults differ from tsup:
format: 'esm',clean: true, dts often auto frompackage.jsontypes/exports, target fromengines.node. - Prefer
deps.neverBundle/alwaysBundleover deprecatedexternal/noExternal(still accepted in 0.23; setting both forms throws). - 0.23 removed the tsup-compat options (
bundle,outExtension,publicDir,removeNodeProtocol,injectStyle,inlineOnly,skipNodeModulesBundle,deps.onlyAllowBundle,dts.cjsReexport); they fail typecheck and are ignored at runtime. - Default dep policy: package dependencies/peers are externalized; used devDependencies may be bundled — override with
depswhen wrong. - Install
typescriptfor dts. Pick the generator only withdts.generator: 'oxc' | 'tsc' | 'tsgo'(omitted →oxcwhenisolatedDeclarations,tsgowhen TypeScript 7 is installed, elsetsc).dts.oxc: true/dts.tsgo: trueno longer select a generator. deps.resolveDepSubpathdefaults tofalsein 0.23 — external subpaths stay as written.build()returns a handle:const { bundles, watch } = await build(...).@tsdown/css/@tsdown/exemust match thetsdownversion when used.- No stub mode — use
--watchand/orexports.devExports. - Code splitting is always on — no
splitting: false. - Upgrading from 0.22 or tsup: build once on 0.22.14 with zero deprecation warnings, then move to 0.23 (
tsdown-migratepins 0.22.14 for that first stage). - Prefer
bun/bunxin command examples.
Verification
Prefer repository-owned commands. For meaningful tsdown work, cover the relevant subset:
bunx tsdown --versionand confirm Node engine for the CLI.- Clean build:
bunx tsdown/bun run build; inspectdistformats and extensions (.mjs/.cjs/.js). - Types: consume
.d.ts/exports.typesfrom a dependent package ortsc. - Dual-format: require + import smoke when
formatincludes both. - After
exports: true: validatepackage.jsonwith publint/attw if enabled. - Migration: zero deprecation warnings on 0.22.14 before upgrading to 0.23; after upgrading, no removed options remain and
attwstill passes (default profile is nowesm-only).
Report which checks ran, which did not, and any version assumptions that remain.