Oxc Agent Rules

A Rust toolchain for parsing, linting, formatting, and transforming JavaScript and TypeScript.

Overview

Oxc gives each tool in its Rust workspace its own verification path. The guide names crate-specific tests, generators, external conformance suites, and Node bindings, with contribution responsibilities stated before development commands.

Documents

├── 
├──  · imports AGENTS.md
├── apps
│   └── oxfmt
│       ├── 
│       └──  · same content as CLAUDE.md · imports AGENTS.md
├── crates
│   ├── oxc_formatter
│   │   ├──  · imports ../oxc_formatter_core/FORMATTER_POLICY.md
│   │   └──  · same content as CLAUDE.md · imports AGENTS.md
│   ├── oxc_formatter_core
│   │   ├── 
│   │   ├──  · same content as CLAUDE.md · imports AGENTS.md
│   │   └── 
│   ├── oxc_formatter_css
│   │   ├──  · imports ../oxc_formatter_core/FORMATTER_POLICY.md
│   │   └──  · same content as CLAUDE.md · imports AGENTS.md
│   ├── oxc_formatter_graphql
│   │   ├──  · imports ../oxc_formatter_core/FORMATTER_POLICY.md
│   │   └──  · same content as CLAUDE.md · imports AGENTS.md
│   ├── oxc_formatter_json
│   │   ├──  · imports ../oxc_formatter_core/FORMATTER_POLICY.md
│   │   └──  · same content as CLAUDE.md · imports AGENTS.md
│   ├── oxc_formatter_tests
│   │   ├── 
│   │   └──  · same content as CLAUDE.md · imports AGENTS.md
│   ├── oxc_formatter_yaml
│   │   ├──  · imports ../oxc_formatter_core/FORMATTER_POLICY.md
│   │   └──  · same content as CLAUDE.md · imports AGENTS.md
│   ├── oxc_formatter*
│   │   └── AGENTS.mdThe target formatter crate's AGENTS.md
│   ├── oxc_minifier
│   │   └── docs
│   │       └── 
│   ├── oxc_parser
│   │   └── 
│   ├── oxc_semantic
│   │   └── 
│   └── oxc_transformer
│       └── 
└── 

Techniques in this file

01 / Verification by change type

Choose verification by crate

The testing section distinguishes parser conformance, inline linter cases, minifier size snapshots, and Node binding tests. A single successful Rust test command is therefore not presented as coverage for every tool.

Source excerpt starting at line 169.
- **Conformance only** via `tasks/coverage`- **Command**: `cargo coverage -- parser`- **Suites**: Test262, Babel, TypeScript

02 / Behavioral framing

Explain an empty search result before it misleads

External suites are cloned by scripts and excluded from Git. The file warns that ripgrep respects those ignore rules and supplies the flag needed to search the actual cases.

Source excerpt starting at line 273.
NOTE: These suites are script-cloned and fully gitignored. ripgrep respects `.gitignore`, so a plain `rg` inside them silently returns nothing.Use `rg --no-ignore` (or `-u`) when searching them.

03 / Generated file guards

Keep generated rule metadata and timing data together

Linter code-generation changes require two commands rather than a generic instruction to regenerate files. The rule names both the generator inputs and generated runner paths that trigger the pair.

Source excerpt starting at line 318.
When changing linter codegen files such as `tasks/linter_codegen/**` or generated linter rule runner files under `crates/oxc_linter/src/generated/`, run `cargo lintgen` and `cargo lint-timings` so generated rule metadata and linter timing data stay in sync.

04 / Router files

Delegate formatter details to the target crate

The shared guide points formatter work to the relevant crate's AGENTS.md. That keeps language-specific behavior and verification close to the implementation while the root remains a workspace map.

Source excerpt starting at line 189.
- Read the target crate's `AGENTS.md`; it includes the shared formatter policy plus language-specific rules and verification commands

Ideas for your repo

  1. Map each subsystem to the test suite that actually covers it.
  2. Document when ignored files require different search commands.
  3. Keep coupled generated artifacts in one regeneration instruction.
  4. Route language-specific work to the local guide.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in Oxc. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works