testing-codegen
testing-codegen guides you through snapshot testing with insta and code generation for the Biome codebase. It covers running tests for specific crates, fast iteration with quick-test workflows, and safely managing snapshots—including pruning orphaned files and reviewing changes interactively. Use this skill when testing lint rules, inspecting AST structure, or regenerating parser and analyzer code.
testing-codegen helps you run snapshot tests and manage insta snapshots when developing Biome lint rules.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-27
testing-codegen helps you run snapshot tests and manage insta snapshots when developing Biome lint rules. testing-codegen guides you through snapshot testing with insta and code generation for the Biome codebase. It covers running tests for specific crates, fast iteration with quick-test workflows, and safely managing snapshots—including pruning orphaned files and reviewing changes interactively. Use this skill when testing lint rules, inspecting AST structure, or regenerating parser and analyzer code.
Use it when
- testing-codegen covers the complete insta snapshot cycle in Biome.
- testing-codegen supports rapid AST inspection via the quick-test workflow.
Verify before relying
Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.
Install
biomejs/biome/testing-codegen · repository language: Rust
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I run snapshot tests in Biome?
testing-codegen helps you execute snapshot tests using insta. Run `cargo test` in the relevant crate to trigger snapshot tests. For faster iteration, use `cargo test quick_test` to run a focused subset. When snapshots differ from expected output, insta prompts you to review and accept or reject changes interactively. This workflow is essential for testing lint rules and validating parser behavior.
What is the Biome insta snapshot testing workflow?
testing-codegen covers the complete insta snapshot cycle in Biome. Write test cases, run `cargo test`, and insta captures actual output as snapshots. Review diffs in your terminal or editor—accept changes with `cargo insta accept` or reject them. For cleanup, use `cargo insta test --unreferenced delete` to prune orphaned snapshot files. This iterative process ensures lint rules, formatters, and analyzers produce correct output.
How can I quickly inspect AST structure and debug parser behavior?
testing-codegen supports rapid AST inspection via the quick-test workflow. Use `cargo test quick_test` to run focused parser tests and examine output. Add the `dbg` macro in test code to print intermediate values. Organize test files in the `specs` folder with clear naming conventions so you can locate and modify parser tests efficiently. This approach accelerates debugging during parser development.
What does the Biome 'just gen-rules' command do?
testing-codegen explains that `just gen-rules` regenerates code for analyzers, formatters, and grammar after you modify rule definitions or parser logic. Run this command to automatically generate updated analyzer implementations and formatter code. Pair it with snapshot testing to validate that generated code produces expected output, ensuring consistency across the codebase.
How should I name and organize test files in Biome?
testing-codegen guides you through Biome's test file structure and naming conventions. Store tests in the `specs` folder with descriptive names that reflect the rule or feature being tested. Include comments in test files to document test-specific options and expected behavior. Follow the convention of grouping valid and invalid test cases together, making it easy for the test runner to validate both passing and failing scenarios.
How do I manage and prune orphaned snapshot files?
testing-codegen covers snapshot maintenance with insta. After refactoring or removing tests, orphaned snapshot files may remain. Run `cargo insta test --unreferenced delete` to automatically identify and remove snapshots no longer referenced by active tests. This keeps your snapshot directory clean and prevents confusion during code review. Always review the list of files to be deleted before confirming.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
Purpose
Use this skill for testing and code generation. Covers snapshot testing with
insta and code generation commands.
Prerequisites
- Install required tools:
just install-tools(installscargo-insta) - Install pnpm:
curl -fsSL https://get.pnpm.io/install.sh | sh -in repo root - Understand which changes require code generation
Common Workflows
Run Tests
# Run all tests
cargo test
# Run tests for specific crate
cd crates/biome_js_analyze
cargo test
# Run specific test
cargo test quick_test
# Show test output (for dbg! macros)
cargo test quick_test -- --show-output
# Run tests with just (uses CI test runner)
just test
# Test specific crate with just
just test-crate biome_cli
Quick Test for Rules
Fast iteration during development:
```rust // In
(truncated - see the full file via the links below)
File tree — 1 file
.claude/skills/testing-codegen/SKILL.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Run snapshot tests and manage insta snapshots for lint rules”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
This skill guides you through building option migrators for the `biome migrate eslint` command, preserving ESLint rule configurations beyond severity alone. Learn to model ESLint options in Rust, convert them to Biome equivalents, wire typed rule variants into the migration pipeline, and test through fixture-driven specs.
This skill guides you through building new lint rules and assist actions for Biome. It covers rule scaffolding across multiple languages, implementation patterns with semantic analysis, code action setup, and the three-pillar diagnostic framework required for all rules. Use it when adding custom rules like noVar or useConst to Biome's codebase.
Learn to implement and modify Biome's formatters using its trait-based IR system. This skill covers generating formatter boilerplate, writing FormatNodeRule implementations, managing comments in formatted output, and validating your work against Prettier using snapshot tests and idempotency checks.
This skill walks you through the pull request workflow for the Biome project, covering branch selection based on change type, conventional commit title formatting, and the required PR template structure. It ensures you disclose any AI assistance used and prepare your code for review with the right context and test documentation.
This skill teaches you how to add parsing support for new languages to Biome by authoring grammars in ungrammar format, implementing lexers and token sources, and writing parse rules with robust error recovery. It covers list parsing patterns, conditional syntax handling, and testing workflows for the Biome codebase.
Build effective error messages, warnings, and hints for Biome lint rules using the Diagnostic trait and advice system. Learn to craft messages that explain what went wrong, why it matters, and how to fix it—with rich markup, code frames, and actionable guidance.
More skills biome-developer (Apache-2.0) · code-linting (MIT) · changeset (Apache-2.0)