agentleFS
BlockKnown publisherblock/buzz-app/.agents/skills/test-audit/SKILL.md

test-audit

Skill82 starsChanged 41 days agoApache-2.0View on GitHub

Invoke whenever writing, changing, reviewing, or sweeping tests in buzz-app. Authoring gate for new tests plus audit workflow for low-value, implementation-coupled, or duplicative tests and the test-only production seams they demand.

We split this skill into the rules it gives an agent

12 rules. 0 are common, 8 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 67 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before adding any test, answer four questions.

    line 19
  2. Distinctive:

    Prefer extending a table-driven case or shared fixture over a near-duplicate test.

    line 29
  3. Distinctive:

    Before judging a candidate, read the complete test and production owner, its entry point, callers, callees, sibling implementations, …

    line 87
  4. Distinctive:

    Keep discovery read-only and report evidence before editing.

    line 101
  5. Distinctive:

    Keep a test when it independently enforces a public API, plugin API, protocol (Nostr events, NIP-AB pairing, NIP-PS signing, relay …

    line 116
  6. Distinctive:

    call ordering when order is observable behavior.

    line 122
  7. Distinctive:

    Prefer net-negative production LOC.

    line 169
  8. Very specific:

    Never edit source or tests while a test runner or hook is running in the checkout.

    line 175
  9. Very specific:

    Run the smallest owner and sibling tests in every runner and project they use: bin/pnpm exec vitest run <path>.

    line 181
  10. Very specific:

    Run the changed gate: the lefthook pre-push hook (scripts/check-push.mjs).

    line 193
  11. Very specific:

    After final audit edits, run an independent agent review under the root AGENTS.md Reviewing rules, for example with the code-review skill.

    line 201
  12. Distinctive:

    Commit, push, open a PR, or land only when authorized.

    line 206

“Common” is measured: kept by at least 6 in 10 of the 67 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Audit

Three modes, one value bar. Authoring mode gates every new or changed test at write time. Audit mode runs focused sweeps of tests that re-assert source, duplicate stronger proof, couple behavior to implementation, or keep test-only production seams alive. Continue broad audits as separate coherent follow-up PRs; optimize for confidence, not deletion count. Campaign mode prunes one whole subsystem's test surface (every test file one src/features/* area, bundled plugin, host, or crate owns); before starting one, or before taking on a numeric target such as "remove N% of tests", read CAMPAIGN.md.

Authoring gate

Before adding any test, answer four questions; a missing answer means do not add it yet:

  1. What observable behavior, invariant, or independent contract does it protect?
  2. What credible regression makes it fail?
  3. Why does existing coverage not already catch that failure? Each contract has one primary test owner at the strongest boundary; another layer needs its own distinct risk, such as a transport or lifecycle failure the owner cannot reach. Pick the layer from Choosing a test layer. Prefer extending a table-driven case or shared fixture over a near-duplicate test; consolidate duplicated setup in the same change.
  4. Does it need a production seam (export, flag, wrapper, injection hook) that no production caller needs? If yes, move the test to the real boundary instead.

Then check the test against every junk pattern; a match fails the gate unless the retention bar names the contract it independently guards. A test that would break under behavior-preserving refactoring is asserting implementation, not behavior; rewrite it at the owning boundary before landing it. The root AGENTS.md sections "Choose tests by behavior" and "Deterministic tests" are part of this gate.

Bug regression tests must fail on the pre-fix code for the intended reason and pass after the owner-boundary repair. A regression test that never demonstrably failed proves the mock, not the fix. One regression at the owner boundary covers the bug; do not replay the same scenario at every layer it crosses.

Junk patterns

The shared checklist for both modes: the authoring gate rejects a new test that matches one, and audits hunt for existing tests that do.

  • assertion-free coverage probes;
  • self-comparisons and identity copiers;
  • copied fixtures, inventories, manifests, or export lists;
  • exact source, import, or string greps, such as a JS test that regexes Rust source for behavior a Rust test could run;
  • private predicate or call-shape tests duplicated at real boundaries;
  • duplicate invocations of the same contract;
  • bundled-plugin or host-local replays of shared src/features/* helpers;
  • tests whose only purpose is preserving test-only exports, globals, or wrappers;
  • dead production code whose only callers are tests;
  • expected values produced by the helper or renderer under test;
  • mocks that implement the asserted behavior, or one identical mock standing in for different APIs;
  • mocked React or hook modules, or components called as plain functions, instead of React Testing Library over real mounting;
  • fixtures that supply the signed admission, relay acknowledgement, or callback ordering the owner should produce, or persistence asserted against a store the path never writes;
  • capability tests that restate declared flags instead of exercising the delivery or enforcement the flag promises (least-privilege checks over src-tauri/capabilities/ are a retained contract, not this);
  • negative controls that pass for an unrelated reason, such as a denial from a different guard or a rejection the production path never reaches;
  • names or fixtures that promise more than the input exercises, such as a "retires the window" test asserting the window was not cleared;
  • browser journeys that replay a state matrix a lower layer owns, or freeze cosmetic recipes (exact pixels, colors, durations) instead of paint, hit testing, focus, or layout behavior.

Value bar

Tests justify their maintenance cost by protecting behavior, a credible regression, or an independently meaningful contract. In an audit, an existing test that must change for behavior-preserving source reorganization is suspect, not automatically deletable; the authoring gate still rejects new ones.

Before judging a candidate, read the complete test and production owner, its entry point, callers, callees, sibling implementations, overlapping tests, CI routing, and relevant history. Read root and scoped AGENTS.md files first, then docs/contributing.md (Test organization, Choosing a test layer, Shared logic and host boundaries), docs/browser-testing.md for browser cases, and the owning design doc under docs/. When the test claims dependency-backed behavior, inspect the dependency source or types directly.

Files headed FOUNDATION: (git grep -l "FOUNDATION:" -- . ':!docs') need explicit human guidance before editing. Treat tests whose owner is one the same way: list them as candidates and escalate rather than editing them.

Discovery

Keep discovery read-only and report evidence before editing. For broad scope, run parallel discovery lanes when available:

  • shared capabilities (src/features/, src/shared/);
  • bundled plugins, plugin runtime, and app shell (src/bundled/, src/plugins/, src/app/);
  • hosts and crates (browser-host/, src-tauri/, crates/);
  • browser journeys, integration, and tooling (tests/, scripts/);
  • a cross-cutting pattern sweep.

Outside campaign mode, prefer a few high-confidence candidates over a large speculative inventory. Hunt for the junk patterns.

Retention bar

Keep a test when it independently enforces a public API, plugin API, protocol (Nostr events, NIP-AB pairing, NIP-PS signing, relay queries), config, migration, storage, security (signing, Tauri capabilities and command ACLs), platform, default, generated or cross-language, package, release, or architecture contract. Also keep:

  • call ordering when order is observable behavior;
  • regressions with a credible failure mode;
  • source inspection when it is the cheapest independent guard: it fails when the contract changes (the user-facing key, byte, or path) and survives an identifier-only refactor, such as the Tabler-only icon boundary and design token registries;
  • shared contract cases both hosts consume, and host-side enforcement in src-tauri/ and browser-host/: necessary host validation is not duplication of frontend checks;
  • regression sources a design doc names, such as the shared agent selection tests in docs/agents.md;
  • CI selection contracts: tests/integration/browser-ci.test.mjs, the measurement and @local-webkit cases docs/browser-testing.md lists, and the only case behind a project tag;
  • protocol vectors ported from block/buzz (such as crates/pairing); changing one diverges from upstream, so escalate it;
  • a retained test that fails on the baseline: treat it as a possible product bug, reproduce it, and with human agreement repair the owner rather than deleting it.

Static or slow is not a deletion reason. A test that resembles implementation may still be the independent contract; prove otherwise before removing it.

Candidate evidence

Record every field below before editing. A missing field means the candidate is not ready for deletion:

  • exact test name and location;
  • what failure it can actually detect;
  • non-test callers of the covered production or support seam;
  • stronger remaining owner-boundary proof, or why no proof is needed;
  • relevant history and the reason the test or seam exists;
  • docs that cite it as coverage (git grep docs/ for the file name and the case title);
  • production or test-support deletion unlocked;
  • risk and the focused validation command.

Edit shape

Choose one coherent owner-boundary batch. Delete obsolete test-only exports, globals, wrappers, and dead production paths instead of preserving aliases. Move retained regressions to their canonical owners. Consolidate repeated package or dependency assertions into one generic contract. Move browser permutations, not whole journeys, down a layer. Update docs that cite deleted tests in the same change.

Prefer net-negative production LOC. Do not add replacement tests that restate the same implementation, and do not convert uncertain candidates into cleanup to increase deletion counts.

Validation

Never edit source or tests while a test runner or hook is running in the checkout. Use the pinned bin/ tools and the commands in docs/contributing.md and docs/browser-testing.md. Run just scan only when explicitly requested or needed to reproduce a broad integration failure; hosted CI owns broad validation.

  1. Run the smallest owner and sibling tests in every runner and project they use: bin/pnpm exec vitest run <path>; Playwright with --no-deps in both engines, and in the tag's own project for tagged cases; bin/node --test <file>; bin/cargo test -p <package> (bare cargo test runs only buzzodz-plugins).
  2. For a moved assertion, make one deliberate mutation of the production owner and confirm the replacement fails (in both engines for browser cases), then restore the source byte for byte.
  3. For removed source greps or plan assertions, run the executable script or test that owns the real contract.
  4. Run bin/pnpm exec biome check --write --error-on-warnings <paths> (and bin/cargo fmt for Rust), then git diff --check.
  5. Run the changed gate: the lefthook pre-push hook (scripts/check-push.mjs). Deleting any file under src/ or browser-host/, test files included, makes it run the full Vitest suite; report failures that also fail on the baseline to the human, and never bypass the hook. After any browser-routing change, including moving or deleting a spec or tagged case, also run bin/node --test tests/integration/browser-ci.test.mjs.
  6. Inspect git diff --numstat; report production/tooling separately from tests and test support.
  7. After final audit edits, run an independent agent review under the root AGENTS.md Reviewing rules, for example with the code-review skill.

Landing and continuation

Commit, push, open a PR, or land only when authorized. Follow the root AGENTS.md worktree, DCO, PR-readiness, and pushing rules. The PR description maps each removed item to its retained or replacement proof, as PR #410 does. Land one coherent PR at a time; after landing, refresh from current main and rerun read-only discovery for the next high-confidence batch.

Handoff

Report:

  • root cause and removed low-value categories;
  • production owner simplifications;
  • retained false positives and why they remain valuable;
  • focused and full proof actually run;
  • collected test counts per runner, before and after;
  • production versus test LOC;
  • PR and merge state;
  • named follow-ups, including escalated FOUNDATION or upstream-vector tests.

Download now (ZIP)

  • Other versions70 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 30

    1. molt-bot/clawdbot★ 391k81% same
    2. simstudioai/sim★ 30k21% same
    3. every-app/open-seo★ 26k35% same
    4. superplanehq/superplane★ 8.5k75% same
    5. BuilderIO/agent-native★ 7.6k68% same
    6. vercel/eve★ 5.8k58% same
    7. wannabespace/conar★ 1.5k58% same
    8. friuns2/openclaw-android-assistant★ 55681% same
    9. OpenClawAndroid/openclaw-android-assistant★ 55681% same
    10. Genshin-bots/gsuid_core★ 35680% same

    20 more not listed

    Wrote their own version · 40

    1. moltbot/moltbot★ 394ksame name
    2. clawdbot/clawdbot★ 394ksame name
    3. steipete/clawdis★ 394ksame name
    4. openclaw/openclaw★ 394ksame name
    5. steipete/warelay★ 392ksame name
    6. moltbot/clawdbot★ 392ksame name
    7. garrytan/gstack★ 139ksame name
    8. paperclipai/paperclip★ 110ksame name
    9. udecode/plate★ 17ksame name
    10. supabase/cli★ 2.4ksame name

    30 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use how, cleanup and 10 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • jaydubya818Skill

      how

      Use for runtime, ownership, layering, code-walkthrough, and placement questions.

      Also in 4 projects that use this

    • MicrosoftSkill

      cleanup

      Also in 3 projects that use this

    • AnthropicSkill

      eli5

      Explain a topic like I'm a 5 year old. Use when the user types /eli5 <topic> or asks for a dead-simple picture explainer of how something works.

      Also in 3 projects that use this

    • dragonflydbSkill

      benchmark

      Benchmark Dragonfly (and compare against Valkey/Redis) on local or remote cloud instances, then produce a performance + memory report with charts and a raw-data appendix. Use this whenever the user runs /benchmark, or asks to benchmark / load-test / measure throughput, QPS, latency, or memory efficiency of Dragonfly or another Redis-compatible server, to compare Dragonfly vs Valkey or Redis, or to generate a benchmark report. Trigger it even when the user just describes the goal ("see how fast Dragonfly is on this box", "compare memory per key vs Valkey") without saying the word "benchmark".

      Also in 3 projects that use this

    • SentrySkill

      deslop

      Strip AI-generated noise from the diff before pushing — extra comments a human wouldn't write, defensive try/catch in trusted code paths, casts to any, inline imports in Python, and other style inconsistencies with the surrounding file. Use this immediately before commit so the diff stays clean.

      Also in 3 projects that use this

    • SentrySkill

      review

      Fixture review skill.

      Also in 6 projects that use this

  • In this repository5 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.