migrate-to-rslib

$npx mdskill add rstackjs/agent-skills/migrate-to-rslib

Migrates tsc or tsup library projects to Rslib while preserving behavior and following official guides.

  • Helps developers transition from tsc or tsup build tools to Rslib with minimal disruption.
  • Integrates with tsc via tsconfig.json and tsup via tsup.config.*, depending on the source framework.
  • Decides actions by detecting the source tool and applying migration deltas from official references.
  • Presents results by validating builds and summarizing changes after successful migration.

SKILL.md

.github/skills/migrate-to-rslibView on GitHub ↗
---
name: migrate-to-rslib
description: Migrate tsc or tsup library projects to Rslib.
---

# Migrate to Rslib

## Goal

Migrate `tsc` and `tsup` projects to Rslib with minimal behavior changes and clear verification.

## Supported source frameworks

- tsc
- tsup

## Migration principles (must follow)

1. **Official guide first**: treat Rslib migration docs as source of truth.
2. **Smallest-change-first**: complete baseline migration first, then migrate advanced or custom behavior.
3. **Do not change business logic**: avoid touching source or business logic unless user explicitly asks.
4. **Validate before cleanup**: keep old tool dependencies/config temporarily if needed; remove only after Rslib is green.

## Workflow

1. **Detect source tool**
   - `tsup`
     - Config: `tsup.config.*`
     - Dependency: `tsup`
     - Build script: uses `tsup` to build projects
   - `tsc`
     - Config: `tsconfig.json` or `tsconfig.*.json`
     - Dependency: `typescript`
     - Build script: uses `tsc` to build projects. And it should be noted that `tsc` used only for type checking (e.g., `tsc --noEmit`) does not make it a `tsc` build project.

2. **Apply tool-specific migration deltas**
   - tsc: `references/tsc.md`
   - tsup: `references/tsup.md`

3. **Validate behavior**
   - Run build command to verify the project builds successfully.
   - If issues remain, compare the old project configuration with the migration guide and complete any missing mappings.

4. **Cleanup and summarize**
   - Remove obsolete dependencies/config only after validation passes.
   - Summarize changed files, mapped options, and any remaining manual follow-ups.

More from rstackjs/agent-skills

SkillDescription
migrate-to-rsbuildMigrate webpack, Vite, create-react-app (CRA/CRACO), or Vue CLI projects to Rsbuild.
migrate-to-rstestMigrate Jest or Vitest test suites and configs to Rstest. Use when asked to move from Jest/Vitest to Rstest, replace framework APIs with `@rstest/core`, translate test config to `rstest.config.ts`, or update test scripts and setup files for Rstest equivalents.
pr-creatorUse when asked to create a pull request for this repository. It helps the PR follow the repository's branch safety rules, title convention, pull request template, and concise English writing style.
rsbuild-best-practicesRsbuild best practices for config, CLI workflow, type checking, bundle optimization, assets, and debugging. Use when writing, reviewing, or troubleshooting Rsbuild projects.
rsbuild-v2-upgradeUse when upgrading a Rsbuild 1.x project to v2, including dependency and configuration updates.
rsdoctor-analysisUse when analyzing Rspack/Webpack bundles from local `rsdoctor-data.json` and producing evidence-based optimization recommendations.
rslib-best-practicesRslib best practices for config, CLI workflow, output, declaration files, dependency handling, build optimization and toolchain integration. Use when writing, reviewing, or troubleshooting Rslib projects.
rspack-best-practicesRspack best practices for config, CLI workflow, type checking, CSS, bundle optimization, assets and profiling. Use when writing, reviewing, or troubleshooting Rspack projects.
rspack-debuggingHelps Rspack users and developers debug crashes or deadlocks/hangs in the Rspack build process using LLDB. Use this Skill when users encounter "Segmentation fault" errors during Rspack builds or when the build progress gets stuck.
rspack-split-chunks>-