Source profileQuality 90/100Review permissions

vercel/next.js/.agents/skills/next-rspack/SKILL.md

next-rspack

Maintain @next/rspack-core and @next/rspack-binding packages. Use when editing rspack/package.json, rspack/crates/binding/Cargo.toml, rspack/rust-toolchain.toml, or packages/next-rspack/package.json. Covers upgrading @rspack/core npm version, rspack_* crate versions, Rust toolchain version, building and linking for local testing, and NEXT_RSPACK environment variable usage. Does NOT apply to root rust-toolchain.toml (that's for Turbopack).

Source repository stars
141,364
Declared platforms
0
Static risk flags
2
Last source update
2026-08-05
Source checked
2026-08-05

Decision brief

What it does—and where it fits

Maintain @next/rspack-core and @next/rspack-binding packages. json, rspack/crates/binding/Cargo.

Best for

  • Upgrade @rspack/core npm package version
  • Upgrade rspack crate dependency versions
  • Upgrade Rust version in rspack/rust-toolchain.toml (rspack directory only)

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/vercel/next.js --skill ".agents/skills/next-rspack"
Safe inspection promptEditorial

Inspect the Agent Skill "next-rspack" from https://github.com/vercel/next.js/blob/bcea67d4e96fbaf8c51f50951e497724d2a02cfb/.agents/skills/next-rspack/SKILL.md at commit bcea67d4e96fbaf8c51f50951e497724d2a02cfb. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Upgrade Process

    Query https://github.com/web-infra-dev/rspack to obtain:

    Target @rspack/core npm versionCorresponding rspack crate versionRust channel version from rust-toolchain.toml
  2. 02

    Step 1: Get Upstream Version Information

    Query https://github.com/web-infra-dev/rspack to obtain:

    Target @rspack/core npm versionCorresponding rspack crate versionRust channel version from rust-toolchain.toml
  3. 03

    Step 2: Update npm Dependencies

    Edit rspack/package.json:

    Edit rspack/package.json:
  4. 04

    Step 3: Update Cargo.toml

    Edit rspack/crates/binding/Cargo.toml, update all rspack crate versions:

    Edit rspack/crates/binding/Cargo.toml, update all rspack crate versions:toml [dependencies] rspackbindingbuilder = { version = "=" } rspackbindingbuildermacros = { version = "=" } rspackcore = { version = "=" } rspackerror = { version = "=" } rspackhook = { version = "=" } rspackpluginexter…
  5. 05

    Step 4: Update Rust Toolchain

    Edit rspack/rust-toolchain.toml:

    Edit rspack/rust-toolchain.toml:

Permission review

Static risk signals and limitations

Network access

medium · line 60

The documentation includes network, browsing, or remote request actions.

Query https://github.com/web-infra-dev/rspack to obtain:

Runs scripts

medium · line 119

The documentation asks the agent to run terminal commands or scripts.

cargo check

Runs scripts

medium · line 122

The documentation asks the agent to run terminal commands or scripts.

pnpm build

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score90/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars141,364SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
vercel/next.js
Skill path
.agents/skills/next-rspack/SKILL.md
Commit
bcea67d4e96fbaf8c51f50951e497724d2a02cfb
License
MIT
Collected
2026-08-05
Default branch
canary
View the original SKILL.md

Next.js with Rspack

When to Use

Use this skill when you need to:

  • Upgrade @rspack/core npm package version
  • Upgrade rspack crate dependency versions
  • Upgrade Rust version in rspack/rust-toolchain.toml (rspack directory only)
  • Fix Rspack-related compilation issues
  • Develop Rspack-specific features in Next.js

⚠️ Scope Limitation: This skill only applies to code and configuration under the rspack/ directory. The rust-toolchain.toml in the repository root is for Turbopack and is outside the scope of this skill.

Architecture Overview

Package Structure

rspack/                          # Independent workspace (separate rust toolchain and npm releases)
├── Cargo.toml                   # Rust workspace configuration
├── rust-toolchain.toml          # Rust version configuration
├── package.json                 # @next/rspack-core package definition
├── lib/
│   ├── index.js                 # Exports @rspack/core + custom plugins
│   └── index.d.ts               # Type definitions
└── crates/
    └── binding/
        ├── Cargo.toml           # Rust crate dependencies (rspack_* crates)
        └── package.json         # @next/rspack-binding package definition

packages/
└── next-rspack/
    └── package.json             # References @next/rspack-core

Dependency Graph

packages/next-rspack
    └── @next/rspack-core (rspack/package.json)
            ├── @rspack/core (npm dependency)
            └── @next/rspack-binding (rspack/crates/binding)
                    └── rspack_* crates (Cargo.toml dependencies)

Version Mapping Rules

@rspack/core npm versionrspack crate versionNotes
2.0.0-rc.00.100.0-rc.0npm major.minor maps to crate 0.(major*50+minor)
1.3.x0.53.xe.g., 1.3 → 0.53
1.2.x0.52.xe.g., 1.2 → 0.52

Upgrade Process

Step 1: Get Upstream Version Information

Query https://github.com/web-infra-dev/rspack to obtain:

  • Target @rspack/core npm version
  • Corresponding rspack crate version
  • Rust channel version from rust-toolchain.toml

Step 2: Update npm Dependencies

Edit rspack/package.json:

{
  "dependencies": {
    "@rspack/core": "<new version>",
    "@next/rspack-binding": "workspace:*"
  }
}

Step 3: Update Cargo.toml

Edit rspack/crates/binding/Cargo.toml, update all rspack crate versions:

[dependencies]
rspack_binding_builder        = { version = "=<new crate version>" }
rspack_binding_builder_macros = { version = "=<new crate version>" }
rspack_core                   = { version = "=<new crate version>" }
rspack_error                  = { version = "=<new crate version>" }
rspack_hook                   = { version = "=<new crate version>" }
rspack_plugin_externals       = { version = "=<new crate version>" }
rspack_regex                  = { version = "=<new crate version>" }
# rspack_sources version is managed separately, may not follow the main version

[target.'cfg(...)'.dependencies]
rspack_binding_builder = { version = "=<new crate version>", features = ["plugin"] }

[build-dependencies]
rspack_binding_build = { version = "=<new crate version>" }

Step 4: Update Rust Toolchain

Edit rspack/rust-toolchain.toml:

[toolchain]
profile = "default"
components = ["rust-src"]
channel = "<nightly version matching upstream rspack>"

Step 5: Verify Build

# Execute in rspack directory
cd rspack

# Check Rust code
cargo check

# Build binding (requires Rust installed)
pnpm build

Step 6: Link to packages/next-rspack

rspack/ is an independent workspace not included in the root pnpm-workspace, manual linking is required:

# Execute from repository root
cd packages/next-rspack

# Link locally built @next/rspack-core
pnpm link ../../rspack

Or modify packages/next-rspack/package.json to use local path (for local testing only, do not commit):

{
  "dependencies": {
    "@next/rspack-core": "link:../../rspack"
  }
}

Important: After linking, run pnpm install in the root directory to update dependency relationships.

Step 7: Run Tests

# Execute from repository root
pnpm test-rspack

Key Files Checklist

Files to check/modify during upgrade:

File PathModification
rspack/package.json@rspack/core version, package version
rspack/crates/binding/Cargo.tomlrspack_* crate versions
rspack/crates/binding/package.jsonbinding package version
rspack/rust-toolchain.tomlRust nightly version
packages/next-rspack/package.json@next/rspack-core version reference (update on release, use link for local testing)

Pre-requisites for Local Testing

Before running pnpm test-rspack, you must build and link @next/rspack-core:

# 1. Build @next/rspack-core
cd rspack
pnpm install
pnpm build

# 2. Link to packages/next-rspack
cd ../packages/next-rspack
pnpm link ../../rspack

# 3. Return to root and update dependencies
cd ../..
pnpm install

# 4. Run tests
pnpm test-rspack

Note: After modifying Rust code under rspack/, you need to re-run pnpm build from step 1.

Test Commands

# Full test suite (using Rspack compiler)
pnpm test-rspack

# Development mode tests
pnpm test-dev-rspack

# Production mode tests
pnpm test-start-rspack

# Run specific tests only
pnpm run with-rspack pnpm testonly -- <test-pattern>

All test commands set environment variables via with-rspack:

cross-env NEXT_RSPACK=1 NEXT_TEST_USE_RSPACK=1

Development Notes

Environment Variable Differentiation

Use the NEXT_RSPACK environment variable to differentiate compilers in packages/next/ code:

// Check if using Rspack
const isRspack = Boolean(process.env.NEXT_RSPACK)

if (process.env.NEXT_RSPACK) {
  // Rspack-specific logic
} else {
  // Webpack logic
}

Common Code Locations

  • Compiler selection logic: packages/next/src/lib/bundler.ts
  • Webpack configuration: packages/next/src/build/webpack-config.ts
  • Loader adaptations: packages/next/src/build/webpack/loaders/

Custom Plugins

@next/rspack-core exports = @rspack/core + custom plugins:

  • NextExternalsPlugin - externals handling plugin implemented in Rust

Release Process

Release via GitHub Actions workflow:

  • Workflow: .github/workflows/release-next-rspack.yml
  • Supports dry-run mode
  • Supports multiple npm tags (latest, alpha, beta, canary)

References

Alternatives

Compare before choosing