agentleFS
rstackjsrstackjs/agent-skills/skills/rsbuild-best-practices/SKILL.md

rsbuild-best-practices

Skill95 starsChanged 4 months agoMITView on GitHub

Configure, review, or troubleshoot Rsbuild applications, including build/dev commands, assets, type checking, and bundle optimization.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 2 are distinctive, and 14 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 14

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use rsbuild.config.ts and defineConfig

    line 12
  2. Very specific:

    Use tools.rspack or tools.bundlerChain only when no first-class Rsbuild option exists

    line 13
  3. Very specific:

    Use rsbuild for local development

    line 19
  4. Very specific:

    Use rsbuild build for production build

    line 20
  5. Very specific:

    Use rsbuild preview only for local production preview

    line 21
  6. Very specific:

    Use rsbuild inspect to inspect final Rsbuild/Rspack configs

    line 22
  7. Very specific:

    Use @rsbuild/plugin-type-check for integrated dev/build type checks

    line 26
  8. Very specific:

    Prefer dynamic import() for non-critical code paths

    line 31
  9. Distinctive:

    Prefer lightweight libraries where possible

    line 32
  10. Distinctive:

    Keep browserslist aligned with real compatibility requirements

    line 33
  11. Very specific:

    Import source-managed assets from project source directories, not from public

    line 37
  12. Very specific:

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

    line 42
  13. Very specific:

    Run with DEBUG=rsbuild when diagnosing config resolution or plugin behavior

    line 46
  14. Very specific:

    Read generated files in dist/.rsbuild to confirm final config, not assumed config

    line 47
  15. Very specific:

    Use Node CPU profiling (--cpu-prof) when JavaScript-side overhead is suspected

    line 51
  16. Very specific:

    Use RSPACK_PROFILE=OVERVIEW and analyze trace output for compiler-phase bottlenecks

    line 52

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.