skills/rslib-best-practices/SKILL.md
Rslib best practices for config, CLI workflow, output, declaration files, dependency handling, build optimization and toolchain integration. Use when writing, reviewing, or troubleshooting Rslib projects.
npx skillsauth add rstackjs/agent-skills rslib-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply these rules when writing or reviewing Rslib library projects.
rslib.config.ts and defineConfiglib.*), and also leverage Rsbuild configurations (e.g., source.*, output.*, tools.*) as neededtools.rspack or tools.bundlerChain to access Rspack's native configurationstsconfig.json path aliasesrslib to buildrslib --watch to build in watch mode for local developmentrslib inspect to inspect final Rslib/Rsbuild/Rspack configs"type": "module" in package.jsonoutput.target set to 'web' when building component librariesexports field in package.json is correctly configured and matches the actual JavaScript output and declaration files output of different formats (ESM, CJS, etc.)lib.dts: true or detailed configurationslib.dts.tsgo experimental feature with @typescript/native-preview installeddevDependencies in bundle mode and dependencies in dependencies and peerDependencies will be automatically externalized (not bundled) by defaultpackage.json carefully to ensure no missing dependency errors occur when consumers install and use this packagelib.syntax aligned with real compatibility requirements to enable better optimizations@rstest/adapter-rslib for writing tests@rspress/plugin-preview and @rspress/plugin-api-docgen for component previews and API docsDEBUG=rsbuild when diagnosing config resolution or plugin behaviordist/.rsbuild to confirm final Rsbuild/Rspack config, not assumed configdevelopment
Debug Rstest issues systematically, including performance regressions. First determine whether the slowdown is in build startup or test execution, then run controlled config or code experiments and compare before/after timings.
development
Opinionated Rslib recommendations for modern JS/TS npm package design covering pure ESM, strict TypeScript, explicit exports, small stable APIs, pragmatic dependencies, accurate sideEffects, correct declarations, package validation, provenance, README.md, and AGENTS.md. Use when the user wants to make a JS/TS package more modern, check whether the current package setup is healthy, review package.json/exports/types/dependencies/docs/release readiness, or apply a modern library baseline.
development
Create or update draft GitHub releases for the current project's main GitHub repository, then organize GitHub-generated release notes into user-friendly sections without rewriting release note items. Use for preparing, formatting, categorizing, creating, or updating GitHub release notes or draft releases, including optional highlights when the user asks for them.
tools
Migrate ESLint or other linters to Rslint. Use when asked to replace ESLint flat config, lint scripts, VS Code ESLint settings, inline directives, rules, presets, plugins, or lint dependencies with Rslint equivalents.