add-oxlint-rule

Author custom oxlint rules with plugin registration, fixture tests, and baseline rollout.

7|12|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/OpenRouterTeam/docs --skill add-oxlint-rule-openrouterteam
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: add-oxlint-rule
Source: https://github.com/OpenRouterTeam/docs/tree/main/.agents/skills/add-oxlint-rule
Command: npx skills add https://github.com/OpenRouterTeam/docs --skill add-oxlint-rule-openrouterteam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding a custom lint rule to an oxlint-based repo involves wiring across several files — rule modules, plugin registration, config enablement, and fixture tests — and missing any one of them silently disables the rule. This Skill walks through the complete authoring workflow so a new rule actually runs, is tested, and rolls out cleanly over existing violations. ## Core Features & Use Cases - Rule Authoring: Build rules with the rule(description, create) helper, AST accessors from plugin-helpers.ts, and report() for diagnostics, grouped by domain in rules-*.ts modules. - Registration & Enablement: Wire rules into openrouter-plugin.ts, enable them in oxlint.config.ts (openrouterRules or path-scoped overrides), and register names in test.config.ts so the fixture harness picks them up. - Fixture Testing & Rollout: Add should trigger: / should not trigger fixtures, run bun run test:oxlint-rules, and handle pre-existing violations via baseline modules or registry files before flipping a rule to 'error'. - Use Case: You want to forbid a deprecated API across the monorepo. Write the rule in the right domain module, enable it, add a fixture with positive and negative cases, scan the repo, and check in a baseline for the grandfathered hits — all in one PR. ## Quick Start Help me write a new custom oxlint rule that bans direct fetch calls in route handlers, including its fixture test and rollout plan.

Frequently Asked Questions about add-oxlint-rule

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a custom oxlint rule?▼

Create the rule in the appropriate `rules-*.ts` domain module using the `rule(description, create)` helper, read paths with `getFilename(context)`, and emit diagnostics via `report()`. Export it under a kebab-case name, then register it in the plugin, config, and test config.

How do I test a custom oxlint rule with fixtures?▼

Add a fixture at `scripts/oxlint/fixtures/<rule-name>.fixture.ts` marking expected violations with `should trigger:` comments and allowed patterns with `should not trigger`. Run `bun run test:oxlint-rules`, which compares diagnostic counts per rule against the markers.

Why is my custom oxlint rule not running?▼

A rule must be listed in three places: the plugin's rules map via its domain module, `oxlint.config.ts` to be enabled, and the `ruleNames` array in `test.config.ts` for the fixture harness. Missing any one means it silently never fires.

How do I enable a new lint rule when the repo already has violations?▼

Scan the whole repo with oxlint and grep for your rule's code. Fix a small number of hits in the same PR; for many hits, check in a baseline module listing grandfathered paths that the rule exempts, documented as never accepting new entries.

Should custom oxlint rules use 'warn' or 'error' severity?▼

Use `'error'` — the repo runs at a zero-warning baseline, so `'warn'` is effectively invisible. Rules not yet ready to enforce are checked in as `'off'` with a comment explaining what unblocks them.