Use this skill when implementing or modifying Biome parser behavior, including `.ungram` grammars, lexers, token sources, parse rules, separated lists, error recovery, and parser fixtures. Do not use merely for consuming an existing AST/CST.
71
89%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Use crates/biome_parser/CONTRIBUTING.md as the canonical parser guide. Read the section matching the current grammar, lexer, parse-rule, or recovery task.
ok/ and error/ fixtures before changing recovery behavior..ungram changes.Grammar files under xtask/codegen/ define typed syntax nodes and fields. Follow existing language naming:
Any;Bogus nodes for recoverable invalid syntax;List;After a grammar change, run:
just gen-grammar <lang>This updates generated syntax nodes, syntax kinds, factories, macros, and language-specific mappings. Parser rules remain hand-written.
A parse function returns Absent only when it has consumed no tokens. Test the first distinguishing token before calling start, bump, eat, expect, or another parser that can advance.
Use:
expect for required tokens that should create a diagnostic when absent;eat for optional tokens;.ok() for optional nodes;.or_add_diagnostic(...) for required nodes;Do not use backtracking where a bounded lookahead or a more precise presence test can distinguish the syntax.
Recovery must preserve following valid syntax and produce a bogus node permitted by the grammar at that position.
A recovery set normally includes the nearest relevant:
Do not copy a recovery set from an unrelated grammar position. Verify which tokens the caller expects after the failed parse.
Use the parser infrastructure's list traits instead of open-coded loops when their contract matches the grammar.
For separated lists, verify:
Follow the current Lexer and buffered token-source traits from biome_parser; do not copy an old trait implementation from a skill or issue.
&str lexer tests for valid multibyte characters and character-boundary/index behavior. Test malformed byte sequences only through an existing byte-oriented API.Load testing-codegen for parser quick tests and snapshot mechanics.
quick_test to inspect a CST while developing.ok/ and error/ directories.Absent paths consume no input.crates/biome_parser/CONTRIBUTING.mdxtask/codegen/*.ungramcrates/biome_parser/src/crates/biome_*_parser/src/biomejs/biome
b62494a
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.