Rsbuild best practices for config, CLI workflow, type checking, bundle optimization, assets, and debugging. Use when writing, reviewing, or troubleshooting Rsbuild projects.
Rsbuild Best Practices is a concise convention-and-guidance skill for writing, reviewing, and troubleshooting projects built with Rsbuild, the Rspack-based build tool. It solves the problem of scattered, easily-missed best practices by consolidating opinionated rules for configuration, CLI usage, type checking, bundle optimization, asset handling, debugging, and profiling into one reference an agent can apply while editing or reviewing code.
The guidance covers using `rsbuild.config.ts` with `defineConfig` and preferring first-class options over raw Rspack/bundler-chain escapes, explicit multi-page entries, and TypeScript path aliases. It documents the CLI workflow (dev, build, preview, inspect), integrated type checking via the type-check plugin or explicit `tsc`/`vue-tsc` steps, bundle-size tactics like dynamic imports and browserslist alignment, and asset-management rules distinguishing source-managed assets from the public directory. It includes a security note to avoid publishing source-map `.map` files to public servers or CDNs, plus debugging via `DEBUG=rsbuild`, inspecting generated config in `dist/.rsbuild`, and profiling with Node `--cpu-prof` and `RSPACK_PROFILE`. It points to the official v1 and v2 llms.txt documentation for the latest details.
This is a lightweight, read-and-apply reference skill rather than a tool that executes builds. Target users are frontend and full-stack developers using Rsbuild who want their configuration and workflow to follow current best practices, and reviewers checking Rsbuild projects for common mistakes.
A curated set of best-practice rules for Rsbuild covering configuration, CLI workflow, type checking, bundle optimization, asset management, debugging, and profiling. It is guidance to apply while writing or reviewing code, not a build runner.
Only when no first-class Rsbuild option exists. The skill recommends using tools.rspack or tools.bundlerChain as an escape hatch and preferring built-in Rsbuild options otherwise.
Use the @rsbuild/plugin-type-check for integrated dev and build type checks, or run tsc --noEmit / vue-tsc --noEmit as an explicit script step.
Yes. It advises not publishing .map source-map files to public servers or CDNs when production source maps are enabled, to avoid exposing source.
It links to the official machine-readable docs: rsbuild.rs/llms.txt for the latest v2 docs and v1.rsbuild.rs/llms.txt for v1.
Quick Setup:
.claude/skills/Repository
rstackjs/agent-skills