agentleFS
VercelKnown publishervercel/next.js/.agents/skills/rust-turbopack/SKILL.md

rust-turbopack

Skill144k starsChanged 7 months agoMITView on GitHub

Build, test, verify, and benchmark Rust changes in the Next.js repository, including Turbopack crates and next-napi-bindings. Use for native-binding rebuilds before e2e tests, clippy or Miri, Turbopack snapshot and execution fixtures, UPDATE=1 snapshot refreshes, fixture discovery, analyzer graph snapshots, wasi test failures, worktree target directory mistakes, Rust disk usage, TURBO_ENGINE_IGNORE_DIRTY, persistent cache benchmarks, RSS measurements, or Criterion runs.

Trending

Less talk lately.about the whole repository

Jan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 3 mentionsApr 2026: 2 mentionsMay 2026: 4 mentionsJun 2026: 4 mentionsJul 2026: 3 mentionsAug 2026: 2 mentionsSep 2026: 3 mentionsOct 2026: 3 mentionsNov 2026: 1 mentionDec 2026: 0 mentions
Jan 2026Jul 2026Dec 2026
Mentions a month of the vercel/next.js repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about vercel/next.js

The biggest 5 of 92 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 92

Talked about on Bluesky, GitHub and Hacker News (92 times).

On Bluesky · 50

45 more on Bluesky

On GitHub · 26

21 more on GitHub

On Hacker News · 16

11 more on Hacker News

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Use this skill when changing or verifying Rust code.

    line 17
  2. Very specific:

    Check that the test uses the binding you built.

    line 34
  3. Very specific:

    Use scripts/wasi-test-host/README.md for host setup and commands.

    line 90
  4. Very specific:

    Don't share one CARGO_TARGET_DIR between worktrees.

    line 100

≈ “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

Rust and Turbopack

Use this skill when changing or verifying Rust code. Code-level turbo_tasks rules live in turbopack/AGENTS.md. Benchmark guidance is in benchmarking.md.

Rebuild before Next.js tests

Next.js e2e tests use the compiled native binding, not Rust source. After a Rust change, rebuild before running Next.js tests, even when cargo check passes:

(cd packages/next-swc && CARGO_PROFILE_DEV_DEBUG=0 pnpm build-native)
pnpm build-all
  • The first command is a faster debug native build. The second matches the normal full JS and Rust build.
  • Check that the test uses the binding you built. The test harness logs swcNativeDirectory.
  • A debug native build can make build-heavy tests slower than CI.
  • Native builds can update packages/next/src/build/swc/generated-native.d.ts. Commit only intended changes.
  • @napi-rs/cli is a dependency of packages/next-swc. Run it through pnpm --filter @next/swc exec napi ..., and pass --cwd as an absolute path.

Run CI-equivalent checks

  • Format with cargo fmt --all, then gate with cargo fmt --all -- --check. Re-run formatting after the last edit, including mechanical renames.
  • CI clippy uses warnings as errors. The packages/next-swc script is: cargo clippy --workspace --all-targets -- -D warnings -A deprecated. For a focused check, also run clippy for affected dependents with --all-targets.
  • turbopack depends on turbopack-node without default features. For a standalone cargo check -p turbopack, enable --features turbopack-node/process_pool.
  • CI runs Miri on a fixed package allowlist with specific flags. Run it with pnpm --filter @next/swc run test-cargo-unit-miri (see packages/next-swc/package.json) from the checkout so rust-toolchain.toml selects the pinned nightly. A bare cargo miri test -p <crate> omits those flags and can abort on filesystem access. Add a crate to the allowlist only after confirming it runs under Miri.
  • Cargo commands can update Cargo.lock. Check git status and revert unrelated changes.
  • For an internal compiler error related to incremental compilation, delete the affected */incremental directories in the target directory and retry.

Turbopack fixtures

  • Refresh snapshot tests with UPDATE=1 cargo nextest run -E 'test(snapshot)', as documented in turbopack/crates/turbopack-tests/README.md. Without nextest, use UPDATE=1 cargo test -p turbopack-tests --test snapshot <filter>. Then run again without UPDATE and review the diff.
  • Snapshot output/ files are tracked. Execution-test output/ directories are ignored. Use a snapshot fixture when exact generated code matters.
  • Fixture tests are generated from directory globs at compile time. After adding or deleting a fixture directory, touch the relevant harness (for example tests/snapshot.rs, tests/execution.rs, or turbopack-ecmascript/src/references/tests.rs) so Cargo rebuilds it.
  • Execution fixtures enable scope hoisting by default. Add a "scopeHoisting": false fixture when testing generated cross-module code.
  • Prettier can rewrite syntax-sensitive fixture input. Use // prettier-ignore when the exact syntax is what the test checks.
  • Snapshot tests embed the workspace root at compile time (TURBO_PNPM_WORKSPACE_DIR in .cargo/config.toml). Run them from the checkout that built the test binary.
  • Analyzer graph snapshots include Effect debug output. After changing it, run UPDATE=1 cargo test -p turbopack-ecmascript --lib analyzer::tests and check that the snapshot diff contains only the intended change.

wasi tests

Use scripts/wasi-test-host/README.md for host setup and commands.

  • The test next-swc wasi job runs Rust tests on a target that aborts on panic. A failing assertion can stop the whole test binary. Tests that require unwinding need a wasm-specific ignore, like existing examples.
  • A contended parking_lot lock panics on wasm. Tests that need blocking locks must account for that platform limitation.

Target directories

  • Don't share one CARGO_TARGET_DIR between worktrees. Cargo can reuse a workspace crate built from another worktree and test the wrong source. Use one target directory per worktree.
  • Rust targets can become very large. Check free disk space before broad builds. target/debug/incremental is disposable when it causes disk pressure.
  • For a test binary, use the executable path printed by cargo test --no-run.
  • Rust's test harness hides output from passing tests. Pass -- --nocapture when you need instrumentation output.
  • Parallel copies of tests that use a persistent cache need separate cache or target directories.

Related Skills

  • $pr-status-triage - CI failure triage
  • $sandbox-bench - end-to-end render-pipeline A/B benchmarks

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.