Rslib Best Practices
Rules and workflow guide for configuring, building, and troubleshooting Rslib library projects.
- CCM score
- 55 of 100
- skills.sh installs
- 1.1K
- GitHub stars
- 101
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers Rslib config, CLI workflow, output formats, declaration files, dependency handling, and build optimization
- Includes
rslib.config.tssetup,rslib --watchfor development, andrslib inspectfor verifying resolved configs - Enforces pure-ESM output and
package.jsonexportsthat match emitted JavaScript and declaration files - Designed for library authors integrating Rstest, Rspress, and
DEBUG=rsbuildtroubleshooting
Install
$ npx -y skills add rstackjs/agent-skills --skill rslib-best-practices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Rslib best practices
Apply these rules when writing or reviewing Rslib library projects.
Configuration
- Use
rslib.config.tsanddefineConfig - Check Rslib-specific configurations first (e.g.,
lib.*), and also leverage Rsbuild configurations (e.g.,source.*,output.*,tools.*) as needed - For deep-level or advanced configuration needs, use
tools.rspackortools.bundlerChainto access Rspack's native configurations - In TypeScript projects, prefer
tsconfig.jsonpath aliases
CLI
- Use
rslibto build - Use
rslib --watchto build in watch mode for local development - Use
rslib inspectto inspect final Rslib/Rsbuild/Rspack configs
Output
- Prefer to build pure-ESM package with
"type": "module"inpackage.json - Prefer to use bundleless mode with
output.targetset to'web'when building component libraries - Prefer to use bundle mode when building Node.js utility libraries
- Ensure
exportsfield inpackage.jsonis correctly configured and matches the actual JavaScript output and declaration files output of different formats (ESM, CJS, etc.)
Declaration files
Details
- Repository
- github.com/rstackjs/agent-skills
- Category
- Frontend & UI Code
- First seen
- Jun 3, 2026
More from rstackjs/agent-skills
All 12Similar to Rslib Best Practices
More Frontend & UI Codersbuild-best-practicesrstackjs/agent-skills3K installsBest-practices guide for writing, reviewing, and troubleshooting Rsbuild config, CLI use, type checks, and bundle size.
rspack-best-practicesrstackjs/agent-skills708 installsOpinionated checklist for configuring, reviewing, and troubleshooting Rspack builds across config, CSS, assets, and profiling.
rollup-bundlermindrally/skills696 installsBest-practices guide for Rollup.js configuration, ES modules, and library bundling with tree-shaking focus.
mikrotik-routeros-rscalexandre-machado/ai-stuffs350 installsGuide for writing, editing, and reviewing idempotent MikroTik RouterOS .rsc scripts with validation before import.