Skip to main content
skill CX Codex

rsbuild-best-practices — Claude Code skill: how to install

Provides rules for configuring, reviewing, and troubleshooting Rsbuild applications. Helps agents inspect builds, handle assets, and profile performance.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add rstackjs/agent-skills --skill rsbuild-best-practices -a claude-code
Open on GitHub

What rsbuild-best-practices does

This skill instructs the agent to write clean rsbuild.config.ts files using defineConfig. It treats direct modifications in tools.rspack or tools.bundlerChain as a last resort, prioritizing built-in Rsbuild options to prevent subtle configuration drift. For multi-page projects, the agent defines explicit entries in source.entry and resolves TypeScript paths through tsconfig.json.

Build optimization and asset handling follow strict guidelines. Type checking runs either via @rsbuild/plugin-type-check or standalone scripts with tsc --noEmit. Managed assets must be imported from project source folders rather than public, while public files are referenced by absolute path. When source maps are enabled for production, .map files must never be deployed to public CDNs.

Debugging requires hard verification instead of guesses. The agent inspects the final resolved configuration files in dist/.rsbuild or runs commands with DEBUG=rsbuild. For compiler bottlenecks, it relies on trace analysis triggered by RSPACK_PROFILE=OVERVIEW.

What it helps with

  • configure rsbuild.config.ts without raw Rspack overrides
  • verify generated build configs in dist/.rsbuild
  • wire up type checking with @rsbuild/plugin-type-check
  • optimize bundle size using dynamic import()
  • diagnose compiler bottlenecks using RSPACK_PROFILE=OVERVIEW

Example prompts for the agent

  • Inspect my rsbuild.config.ts and set up entry points for a multi-page setup.
  • Show me how to debug configuration resolution using DEBUG=rsbuild.
  • Configure production source maps without exposing .map files on public CDNs.

How to install rsbuild-best-practices

1Skills CLI (Vercel)

npx skills add rstackjs/agent-skills --skill rsbuild-best-practices -a claude-code

2Manually: put the files in place

~/.claude/skills/rsbuild-best-practices/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/rsbuild-best-practices/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about rsbuild-best-practices

How do I install rsbuild-best-practices in Claude Code?

Run npx skills add rstackjs/agent-skills --skill rsbuild-best-practices -a claude-code to install the skill. The file is placed in ~/.claude/skills/rsbuild-best-practices/SKILL.md.

What does rsbuild-best-practices do?

It establishes guidelines for configuring and debugging Rsbuild setups. The skill ensures agents use official options, manage assets cleanly, and avoid publishing production source maps.

How does the skill handle build profiling and diagnostics?

The rules direct the agent to check dist/.rsbuild directly instead of assuming values. For deep profiling, it uses --cpu-prof for JavaScript overhead and RSPACK_PROFILE=OVERVIEW for compiler stalls.

Source text

SKILL.md · MIT
---
name: rsbuild-best-practices
description: Configure, review, or troubleshoot Rsbuild applications, including build/dev commands, assets, type checking, and bundle optimization.
---

# Rsbuild best practices

Apply these rules when writing or reviewing Rsbuild projects.

## Configuration

- Use `rsbuild.config.ts` and `defineConfig`
- Use `tools.rspack` or `tools.bundlerChain` only when no first-class Rsbuild option exists
- Define explicit `source.entry` values for multi-page applications
- In TypeScript projects, prefer `tsconfig.json` path aliases first

## CLI

- Use `rsbuild` for local development
- Use `rsbuild build` for production build
- Use `rsbuild preview` only for local production preview
- Use `rsbuild inspect` to inspect final Rsbuild/Rspack configs

## Type checking

- Use `@rsbuild/plugin-type-check` for integrated dev/build type checks
- Or run `tsc --noEmit`/`vue-tsc --noEmit` as an explicit script step

## Bundle size optimization

- Prefer dynamic `import()` for non-critical code paths
- Prefer lightweight libraries where possible
- Keep browserslist aligned with real compatibility requirements

## Asset management

- Import source-managed assets from project source directories, not from `public`
- Reference `public` files by absolute URL path

## Security

- Do not publish `.map` files to public servers/CDNs when production source maps are enabled

## Debugging

- Run with `DEBUG=rsbuild` when diagnosing config resolution or plugin behavior
- Read generated files in `dist/.rsbuild` to confirm final config, not assumed config

## Profiling

- Use Node CPU profiling (`--cpu-prof`) when JavaScript-side overhead is suspected
- Use `RSPACK_PROFILE=OVERVIEW` and analyze trace output for compiler-phase bottlenecks

## Documentation

- For the latest (v2) docs, read http://rsbuild.rs/llms.txt
- For Rsbuild v1 docs, read http://v1.rsbuild.rs/llms.txt

© rstackjs · MIT · rstackjs/agent-skills

Similar skills

Everything for Frontend and UI →

From the same set9

rstest-best-practices Rules for setting up and writing Rstest tests: environments, mocks, snapshots, coverage and CI. Useful when a package moves to Rstest or its tests have drifted apart. CX Codex +1 1,400installs rslib-best-practices Provides guidelines for building JavaScript and TypeScript libraries with Rslib. Useful when configuring outputs, declaration files, and dependency bundling. CX Codex +1 1,000installs rspress-best-practices A skill that gives the agent rules for Rspress v2 sites: config, navigation, MDX, assets, search and deployment. Useful once the docs exist and the agent edits them. CX Codex +1 538installs rspack-v2-upgrade Walks a Rspack 1.x project through the v2 upgrade: dependencies, config, build checks. Useful when a major bump is too fiddly to do by hand. CX Codex +1 515installs rspress-description-generator A skill that fills in the description frontmatter field on Rspress pages that lack one. Useful when the docs site has grown and meta descriptions are missing in places. CX Codex +1 498installs rsbuild-v2-upgrade Walks a Rsbuild 1.x project through the v2 migration: dependencies, config, breaking options. Useful when a major bump would otherwise eat an evening. CX Codex +1 476installs migrate-to-rstest Migrates Jest, Vitest, or Playwright Test suites to Rstest while keeping test discovery, assertions, mocks, snapshots, and coverage intact. For moving a runner without rewriting scenarios. CX Codex +1 420installs rspress-custom-theme A skill that walks your agent through Rspress v2 theme changes, from CSS variables up to replacing built-in components. CX Codex +1 408installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor