Skip to content
rstackjs avatar

Rspack Best Practices

Opinionated checklist for configuring, reviewing, and troubleshooting Rspack builds across config, CSS, assets, and profiling.

CCM score
56 of 100
skills.sh installs
722
GitHub stars
101
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers Rspack configuration with rspack.config.ts and defineConfig, plus narrow rule conditions and built-in plugin preferences
  • Includes CLI workflow guidance for rspack dev, rspack build, and rspack preview, plus type checking via ts-checker-rspack-plugin or tsc --noEmit
  • Enforces one CSS strategy (built-in CSS, css-loader with CssExtractRspackPlugin, or style-loader) and asset modules over legacy file-loader and url-loader
  • Designed for reviewing and troubleshooting Rspack projects, with profiling via --cpu-prof and RSPACK_PROFILE=OVERVIEW and a security rule against publishing source maps

Install

$ npx -y skills add rstackjs/agent-skills --skill rspack-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Rspack best practices

Apply these rules when writing or reviewing Rspack projects.

Configuration

  • Use rspack.config.ts and defineConfig
  • Define explicit entry values for multi-page applications
  • Keep one main config and branch by process.env.NODE_ENV only when needed
  • Keep rule conditions narrow and explicit (test, include, exclude, resourceQuery)
  • Prefer built-in Rspack plugins/loaders over community JS alternatives when equivalent features exist

CLI

If @rspack/cli is installed:

  • Use rspack dev for local development
  • Use rspack build for production build
  • Use rspack preview only for local production preview

Type checking

  • Use ts-checker-rspack-plugin for integrated dev/build type checks
  • Or run tsc --noEmit/vue-tsc --noEmit as an explicit script step

CSS

Choose one strategy:

  • Built-in CSS (type: 'css' | 'css/auto' | 'css/module') for modern setups
  • css-loader + CssExtractRspackPlugin for webpack migration compatibility
  • style-loader for pure style-in-JS runtime injection scenarios

Optional:

Details

Repository
github.com/rstackjs/agent-skills
Category
Frontend & UI Code
First seen
Jun 3, 2026

Questions

What does the rspack-best-practices skill do?

The rspack-best-practices skill gives agents rules for writing, reviewing, or troubleshooting Rspack builds. It covers config with rspack.config.ts, CSS strategy, asset modules, type checking, bundle size, and profiling.

How do I install the rspack-best-practices skill?

Run npx -y skills add rstackjs/agent-skills --skill rspack-best-practices -y in your project. Once installed, rspack-best-practices guides the agent through Rspack configuration and build workflow decisions.

Where does rspack-best-practices stand in Frontend & UI Code?

The rspack-best-practices skill is listed in the Frontend & UI Code category alongside vercel-react-best-practices, web-design-guidelines, and design-taste-frontend. It focuses narrowly on Rspack build tooling rather than general UI design.

Who should use the rspack-best-practices skill?

Developers working on Rspack projects who want an agent to follow established practices benefit most from rspack-best-practices. It helps with multi-page entries, narrow loader rules, and choosing between CSS strategies.

Does rspack-best-practices require any tools or accounts?

The skill's SKILL.md lists no accounts or API keys, but Rspack CLI commands assume @rspack/cli is installed in the project. Profiling steps use Node CPU profiling and RSPACK_PROFILE tracing.

More from rstackjs/agent-skills

All 12

Similar to Rspack Best Practices

More Frontend & UI Code