Biome

From TerminalSkills/skills · View interactive version

Biome is an AI agent skill from the GitHub repository TerminalSkills/skills. Biome is a single Rust-based tool that formats code and lints JavaScript, TypeScript, JSX, JSON and CSS, and sorts imports, as a faster replacement for ESLint plus Prettier. Use when a user wants to set up biome.json, replace ESLint or Prettier, migrate their configs, run lint and format in CI or pr

How to use this skill

Skill file

Biome — Fast Linter and Formatter (ESLint + Prettier Replacement)

Overview

Biome (@biomejs/biome, current major version 2.x) formats, lints and organizes imports in one native binary with one config file, biome.json (or biome.jsonc). It covers JavaScript, TypeScript, JSX/TSX, JSON, CSS and more, and it is much faster than ESLint plus Prettier on large repositories. It does not run ESLint plugins, so projects that depend on plugin-specific rules may keep ESLint for those. Version 2 changed the config: import sorting is an "assist" action, files.ignore became files.includes, and rules.recommended became rules.preset.

Instructions

Install and initialize

npm install --save-dev --save-exact @biomejs/biome
npx biome init        # writes biome.json with the schema URL of the installed version

Pin the exact version: formatting and lint results can change between releases. After upgrading, run npx biome migrate --write to update the config to the new schema.

Configuration

{
  "$schema": "https://biomejs.dev/schemas/2.6.3/schema.json",
  "vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
  "files": { "includes": ["src/**", "!**/*.gen.ts"] },
  "assist": { "actions": { "source": { "organizeImports": "on" } } },
  "linter": {
    "enabled": true,
    "rules": {
      "preset": "recommended",
      "complexity": { "noForEach": "warn" },
      "correctness": {
        "noUnusedVariables": "error",
        "noUnusedImports": "error",
        "useExhaustiveDependencies": "warn"
      },
      "suspicious": { "noExplicitAny": "warn", "noConsole": "warn" },
      "style": { "noNonNullAssertion": "warn", "useConst": "error" }
    }
  },
  "formatter": { "indentStyle": "space", "indentWidth": 2, "lineWidth": 100, "lineEnding": "lf" },
  "javascript": {
    "formatter": { "quoteStyle": "single", "semicolons": "asNeeded", "trailingCommas": "all", "arrowParentheses": "always" }
  }
}

Set $schema to the installed version (npx biome --version). files.includes takes globs, and a leading ! excludes a path; with vcs.useIgnoreFile Biome also skips files listed in .gitignore. Rule severities are "off", "info", "warn" and "error". Rule names change between versions; npx biome explain <ruleName> prints the docs for one, and an unknown name makes biome check fail with a list of valid keys.

Commands

npx biome format --write .      # format only
npx biome lint .                # lint only
npx biome check --write .       # format + lint safe fixes + organize imports
npx biome check --write --unsafe .   # also apply fixes that may change behavior; review the diff
npx biome ci .                  # CI: same checks, never writes, non-zero exit on problems
npx biome check --staged        # only staged files (pre-commit)
npx biome check --changed --since=origin/main   # only files changed against a branch

--fix is an alias of --write. Diagnostics print as file:line:col lint/<group>/<rule>; a rule can be silenced on the next line with // biome-ignore lint/suspicious/noConsole: reason (a reason is required).

Migrating from ESLint and Prettier

npx biome migrate prettier --write     # imports .prettierrc and .prettierignore
npx biome migrate eslint --write       # imports rules from the ESLint config
npx biome check .

migrate eslint maps rules that have a Biome equivalent and skips the rest, including plugin rules, so read what it printed. In a run against an empty biome.json it also set linter.rules.preset to "none"; set it back to "recommended" if you want Biome's default rule set. Afterwards remove eslint, prettier and their configs and plugins from package.json.

Editor

{
  "editor.defaultFormatter": "biomejs.biome",
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.biome": "explicit",
    "source.organizeImports.biome": "explicit"
  }
}

Put this in .vscode/settings.json and install the biomejs.biome extension. The extension uses the Biome version in the project's node_modules.

Examples

Request: "Replace ESLint and Prettier in this React project with Biome."

Run npm install -D -E @biomejs/biome, npx biome init, npx biome migrate eslint --write and npx biome migrate prettier --write, then npx biome check --write .. Replace the lint script with "lint": "biome check ." and the CI step with npx biome ci .. The first check prints each remaining diagnostic with its rule name and location.

Request: "Only check the files I'm about to commit."

Add "pre-commit": "biome check --write --staged" to a husky or lefthook hook (or run npx biome check --staged in lint-staged). Staged files that fail unfixable rules abort the commit with the diagnostics.

Guidelines

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.