# Configure tsdown Library Builds

Modern TypeScript libraries need fast builds, clean package exports, and reliable type declarations. This skill gives Claude, Codex, and Claude Code practical tsdown guidance for configs, migrations, and troubleshooting.

## Install

```bash
npx skillstore add antfu/tsdown
```

## Metadata

- - Slug: antfu-tsdown
- - Version: 1.0.0
- - Author: antfu
- - GitHub username: antfu
- - License: MIT
- - Repository: https://github.com/antfu/skills/tree/main/skills/tsdown/
- - Ref: main
- - Supported tools: Claude, Codex, Claude Code
- - Risk level: medium
- - Risk factors: network, external\_commands, env\_access, filesystem, scripts
- - Quality score: 50
- - Quality tier: warning
- - Public page: https://skillstore.pages.dev/skills/antfu-tsdown
- - Manifest: https://skillstore.pages.dev/api/skills/antfu-tsdown/manifest

## Capabilities

- Create tsdown configurations for ESM, CJS, IIFE, and UMD library output.
- Explain entry points, output directories, source maps, minification, and clean options.
- Guide migration from tsup to tsdown with option mapping and compatibility notes.
- Configure declaration file generation, declaration maps, and Vue type support.
- Help set up React, Vue, and WebAssembly library build recipes.
- Document CI-aware options, hooks, plugins, and programmatic build usage.

## Use Cases

- Set Up a New Library Build: Create a tsdown config that emits ESM, CJS, type declarations, and package exports for npm publishing.
- Migrate from tsup: Map existing tsup options to tsdown and identify behavior changes before replacing the build command.
- Tune Framework Packages: Configure React, Vue, or WASM package builds with correct externals, declaration output, and source maps.

## Prompt Templates

### Create a Basic Config

```
Create a tsdown config for my TypeScript library. It should build ESM and CJS output, generate declaration files, and clean dist first.
```

### Explain Build Options

```
Review my tsdown configuration and explain what each option does. Point out settings that affect package exports, source maps, and type declarations.
```

### Migrate a Project

```
Help me migrate this package from tsup to tsdown. Compare the current build options, propose a tsdown config, and list behavior changes to test.
```

### Design a Release Build

```
Design a tsdown release build for a monorepo package. Include CI-aware validation, external dependency handling, declaration maps, and safe prepublish checks.
```

## Limitations

- It provides guidance and examples, not a bundled tsdown executable.
- It cannot verify every project dependency or package export without reading the repository.
- Some examples include shell commands that should be reviewed before execution.
- Experimental tsdown features may change as Rolldown and Oxc evolve.

## Best Practices

- Review generated build commands before running clean, publish, or shell-backed workflows.
- Keep package exports, declaration files, and emitted formats aligned with package.json.
- Use CI-aware validation for package linting, type checks, and release builds.

## Anti Patterns

- Do not load broad .env files into browser bundles without a strict prefix filter.
- Do not copy release-script examples into projects without checking paths and publish targets.
- Do not assume tsup behavior is identical without testing output files and package exports.

## Security Audit

- - Safe to publish: true
- - Audited at: 2026-06-28T09:36:52.446\+00:00
- - Summary: Static analysis produced a very high score because it treated Markdown command examples, package links, and build configuration snippets as executable behavior. Review found no malicious intent, prompt injection, hidden network calls, or credential exfiltration, but the skill does include shell, publish, env-file, and filesystem examples that warrant a user warning.

## Stats

- - Views: 353
- - Downloads: 5
- - Favorites: 0
- - Popularity score: 0
