{"slug":"testing-codegen","title":"testing-codegen","summary":"Use this skill when selecting or running Biome test fixtures, quick tests, `insta` snapshot workflows, expectation comments, orphan checks, or required code generators. Do not use for subsystem implementation design.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-20T08:01:13.776247Z","repo":{"url":"https://github.com/modem-dev/ossrules","stars":29,"forks":1,"license":"MIT","updatedAt":"2026-09-19T19:28:02Z"},"bodyHtml":"<hr>\n<h2>name: testing-codegen\ndescription: Use this skill when selecting or running Biome test fixtures, quick tests, <code>insta</code> snapshot workflows, expectation comments, orphan checks, or required code generators. Do not use for subsystem implementation design.\ncompatibility: Designed for coding agents working on the Biome codebase (github.com/biomejs/biome).</h2>\n<h1>Testing and Code Generation</h1>\n<p>Choose the narrowest test that exercises the changed behavior, then broaden only when shared infrastructure or integration risk justifies it.</p>\n<h2>Test Selection</h2>\n<table>\n<thead>\n<tr>\n<th>Change</th>\n<th>Start with</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Lint rule</td>\n<td><code>just test-lintrule &lt;ruleName&gt;</code></td>\n</tr>\n<tr>\n<td>One crate</td>\n<td><code>cargo test -p &lt;crate&gt;</code> or the crate's focused test target</td>\n</tr>\n<tr>\n<td>Parser or formatter investigation</td>\n<td><code>just qt &lt;package&gt;</code></td>\n</tr>\n<tr>\n<td>CLI migration</td>\n<td>focused <code>biome_cli</code> migration tests</td>\n</tr>\n<tr>\n<td>Documentation code</td>\n<td><code>just test-doc</code></td>\n</tr>\n</tbody>\n</table>\n<p>Use <code>-- --show-output</code> or <code>--nocapture</code> only when the test's diagnostic output is needed.</p>\n<p>Quick tests are scratch space for inspecting CST, formatter IR, or one analyzer query. Persistent behavior belongs in the subsystem's normal fixture directory before finishing.</p>\n<h2>Snapshot Workflow</h2>\n<p>Run the focused test to produce snapshots, then review every changed section:</p>\n<pre><code>cargo insta review\n</code></pre>\n<p>Use <code>cargo insta accept</code> or <code>cargo insta reject</code> only after inspecting the pending changes. A passing snapshot test proves output matches the checked-in snapshot, not that the snapshot describes correct behavior.</p>\n<h3>Orphaned Snapshots</h3>\n<p>Do not delete suspected orphan snapshots manually. Deletion is safe only after running the complete workspace snapshot suite without package, target, or test filters:</p>\n<pre><code>cargo insta test --workspace --unreferenced delete\n</code></pre>\n<p>For a scoped run, use <code>--unreferenced warn</code> or <code>--unreferenced reject</code>; incomplete test selection cannot prove that a snapshot is orphaned. Inspect every deletion from a complete run.</p>\n<h2>Analyzer Fixtures</h2>\n<p>Place rule fixtures under the language analyzer's current <code>tests/specs/&lt;group&gt;/&lt;rule&gt;/</code> hierarchy. The directory group must match the rule declaration.</p>\n<p>Use focused source files for parser-dependent cases. Use <code>.jsonc</code> arrays when multiple independent script snippets share the same configuration and module semantics are not required. Use <code>options.json</code> in a subdirectory when tests need different rule configuration.</p>\n<h3>Diagnostic Expectation Comments</h3>\n<p>The test utilities recognize these marker texts in source comments:</p>\n<pre><code>should generate diagnostics\nshould not generate diagnostics\n</code></pre>\n<p>Current enforcement:</p>\n<ul>\n<li>a filename containing <code>valid</code> but not <code>invalid</code> must contain one of the expectation markers;</li>\n<li>when either marker is present, actual diagnostics must match it;</li>\n<li>an <code>invalid</code> or neutral filename without a marker is accepted, but adding the correct marker makes intent explicit;</li>\n<li><code>.snap</code>, <code>.json</code>, <code>.jsonc</code>, and <code>.md</code> are exempt from the mandatory valid-file marker check;</li>\n<li>HTML-family workspace fixtures are checked from raw file content and should use a top-level HTML comment.</li>\n</ul>\n<p>Put the marker at the top of a primary fixture. Sidecar files with neutral names do not need a marker unless they are independently analyzed as cases.</p>\n<h2>Parser Fixtures</h2>\n<p>Use the parser crate's established <code>ok/</code> and <code>error/</code> directories. A recovery regression should include valid syntax after the malformed construct to prove the parser resumes at the intended boundary.</p>\n<p>Use <code>just qt &lt;parser-package&gt;</code> to inspect a CST during development; do not leave the quick test as the only regression coverage.</p>\n<h2>Formatter Fixtures</h2>\n<p>Use internal specs for behavior introduced or fixed by the change. External Prettier snapshots record comparison results but do not replace focused internal coverage.</p>\n<p>The formatter harness performs its idempotency reformat during one test invocation for eligible files. Inspect both formatted output and any IR shown for a mismatch.</p>\n<h2>Required Code Generation</h2>\n<table>\n<thead>\n<tr>\n<th>Changed source</th>\n<th>Command</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>.ungram</code> grammar</td>\n<td><code>just gen-grammar &lt;lang&gt;</code></td>\n</tr>\n<tr>\n<td>Formatter source</td>\n<td><code>just gen-formatter &lt;lang&gt;</code></td>\n</tr>\n<tr>\n<td>Lint rule or assist</td>\n<td><code>just gen-rules</code> and <code>just gen-configuration</code></td>\n</tr>\n<tr>\n<td>Bindings needed locally</td>\n<td><code>just gen-bindings</code></td>\n</tr>\n</tbody>\n</table>\n<p>Root <code>AGENTS.md</code> is canonical for which artifacts must be committed and which full outputs CI Autofix may provide.</p>\n<p>Do not run <code>just ready</code> in a dirty working tree: the recipe checks for a clean diff before and after its full verification sequence. Use the focused commands required by the current task, then <code>just f</code> and <code>just l</code>.</p>\n<h2>Completion Checklist</h2>\n<ul>\n<li>A code change has focused persistent coverage.</li>\n<li>A bug fixture fails without the fix.</li>\n<li>Snapshot contents were inspected.</li>\n<li>Expectation comments match fixture intent.</li>\n<li>Orphan snapshots were pruned through <code>insta</code>.</li>\n<li>Required generated artifacts are present.</li>\n<li>Narrow tests pass before broader checks run.</li>\n</ul>\n<h2>References</h2>\n<ul>\n<li>Main test guide: <code>CONTRIBUTING.md#testing</code></li>\n<li>Analyzer guide: <code>crates/biome_analyze/CONTRIBUTING.md</code></li>\n<li>Expectation enforcement: <code>crates/biome_test_utils/src/lib.rs</code></li>\n<li>Formatter harness: <code>crates/biome_formatter_test/src/spec.rs</code></li>\n<li>Generator recipes: <code>justfile</code></li>\n</ul>\n","files":[{"path":"SKILL.md","sizeBytes":5160,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-20T08:02:43.230738Z","sha256":"605FB9875C7A13972139F836E44622DFC0890E760D66AD4958DC7D07C12039F8","sizeBytes":2381},"review":null,"source":{"repositoryUrl":"https://github.com/modem-dev/ossrules","path":"public/files/biomejs/.claude/skills/testing-codegen","license":"MIT","commit":"d2b677576df8803ab897e1cfe53e240ed4db8ecb","subtreeSha":"11D0CE076E427CFB69A686E1565F4029D8D0011B42DBDA1605D1FFDC479A190A","lastSyncedAt":"2026-09-20T08:01:11.564965Z"},"reviewedAt":"2026-09-20T08:09:30.442866Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/modem-dev/ossrules/tree/main/public/files/biomejs/.claude/skills/testing-codegen"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install modem-dev-ossrules@llmmart"},{"target":"git","command":"git clone https://github.com/modem-dev/ossrules.git"}]}