agentleFS
medy-gribkovmedy-gribkov/arcana/skills/testing/SKILL.md

testing

Skill1 starsChanged 8 months agoApache-2.0View on GitHub

Writes, fixes and reviews tests for TypeScript and JavaScript projects, which means vitest unit and DOM tests, Playwright end-to-end specs, coverage thresholds, regression tests that reproduce the bug state, and tests of Cloudflare Workers code on real bindings. Use when adding or fixing a test, a coverage gate is red, a spec is flaky or fails in CI, a bug fix needs its regression test, a test passes but you doubt it can fail, or asked "how do we test this". Not for Go tests (go-dev), Lighthouse audits or manual QA scripts.

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 172 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never add a delay to fix a flaky test (setTimeout, waitForTimeout, a longer timeout).

    line 55
  2. Distinctive:

    Do not raise the worker count to make a flaky suite finish sooner.

    line 58

“Common” is measured: kept by at least 6 in 10 of the 172 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

Testing TypeScript and JavaScript projects

This skill is the how-to: which kind of test, how to wire it, how to prove it can fail. If the project already has test conventions, a runner config and sibling tests, those win over the examples here. The Go equivalent is the go-dev skill.

The contract

  • A test earns its place only if it can catch a real regression. Delete the line under test and a test must fail.
  • Assert outcomes, not execution: concrete values, the stored state after a transition, exact call counts and payloads, the role and name of what the user sees.
  • Mock what you do not own or cannot run (a third-party API, the clock, the framework's request context). Never mock the module under test, and never fake a database in a state test when a real one can run.
  • A bug fix ships with a regression test that builds the bug's exact state and fails on the old code.
  • Tests never touch production, real mail, real payment or real calendar accounts.

Pick the test kind first

The code under testWriteRuns inReference
Pure logic: schemas, formatting, guards, i18n, route handlers with mocked seams*.test.ts[x]node (vitest)references/unit-and-dom.md
A component or hook with logic, a control that calls a server action*.dom.test.tsx with // @vitest-environment jsdomjsdomreferences/unit-and-dom.md
Cloudflare Workers code that reads or writes D1, KV, R2 or a Durable Object*.workerd.test.tsWorkers vitest pool, REAL bindingsreferences/cloudflare-workers.md
A user journey, an a11y or layout audite2e/*.spec.tsPlaywright against a built appreferences/e2e-playwright.md
A coverage threshold is red, or a file must join the measured settests to the threshold, then the include listv8references/coverage-gates.md
A bug fix, or a test you doubtthe mutation check and the regression recipeanyreferences/regression-and-golden.md

Database code is tested against a real database (SQLite in memory, a container, or the platform's own test runtime), not a hand-written fake. A component is never snapshotted to lift a number.

Workflow

  1. Classify the change with the table. Find the nearest sibling test (same folder) and copy its structure, setup and helpers; do not invent a second way.
  2. Write the behavior test first when fixing a bug. Build the exact state of the bug, call the real entry, assert the corrected value, name the bug in a comment. It must go red on the old code.
  3. Assert outcomes, not execution. Replace toBeTruthy, toHaveBeenCalled() alone and tests with no expect (the table in references/regression-and-golden.md lists the replacements). Lint rules from @vitest/eslint-plugin catch the worst of them.
  4. Prove it can fail (the mutation check in references/regression-and-golden.md): break the line under test, watch the right test go red, undo exactly that edit.
  5. Run once. The affected package's suite and coverage once; the integration suite when a database or binding is touched; the e2e suite once per change-set when a journey changed. Read all failures from that run, fix, run once more.
  6. Report what ran and what did not. State each suite with its result, and name any suite you could not run (for example e2e without a free port) so green is never claimed on a partial run.

Rules that bite

  • Hold the coverage threshold the project set (100 on lines, branches, functions and statements is the recommended bar for a logic layer) and never lower it, exclude around it or ignore a line without a reason. See references/coverage-gates.md.
  • Never add a delay to fix a flaky test (setTimeout, waitForTimeout, a longer timeout). Wait on the user-visible state. CI retries hide flakiness, so a spec that passes on retry is still broken; read the run summary, not only the final colour.
  • A spec that changes its account or its rows owns them. Specs run in parallel workers, so two specs must never share a changing account. Do not raise the worker count to make a flaky suite finish sooner.
  • Mocks follow the code. When a mocked module changes shape, update the mock in the same change; when the code makes N calls, mock N.
  • A test that passes alone and fails beside others shares state: find the shared module-level state instead of turning parallelism off.

Boundaries

A security review of guards and actions is security-review; accessibility rules are accessibility-wcag (the e2e reference covers running axe inside a spec); page-speed scores come from Lighthouse runs, not from a unit test; building the feature itself is the framework skill (nextjs-16, api-design); wiring the suites into CI is ci-cd-pipelines.

Download now (ZIP)

  • Other versions192 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 192

    1. modelcontextprotocol/servers★ 92ksame name
    2. lobehub/lobe-chat★ 84ksame name
    3. lobehub/lobehub★ 84ksame name
    4. penpot/penpot★ 62ksame name
    5. meteor/meteor★ 45ksame name
    6. iOfficeAI/AionUi★ 34ksame name
    7. garrytan/gbrain★ 31ksame name
    8. OpenZeppelin/openzeppelin-contracts★ 27ksame name
    9. tursodatabase/turso★ 25ksame name
    10. redis/go-redis★ 22ksame name

    182 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 bundle-dependency-prs, update-library-template and 8 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.
    • MicrosoftSkill

      bundle-dependency-prs

      Fix broken dependency update PRs and aggregate the ones that work into one PR.

      Also in 6 projects that use this

    • MicrosoftSkill

      update-library-template

      Merges the latest Library.Template into this repo (at position of HEAD) and resolves conflicts.

      Also in 6 projects that use this

    • zetaloopSkill

      assign-copilot

      Assigns a GitHub issue to the Copilot coding agent, optionally specifying a custom agent. Use this when asked to assign an issue to Copilot or delegate an issue to CCA.

      Also in 3 projects that use this

    • timmo001Skill

      changeset-scope

      Keep all scoped code work contained to the user-defined changeset. Use for implementation, fixes, diagnosis, refactoring, cleanup, and review when explicit instructions, named files, diffs, branches, pull requests, or injected work scopes define the boundary.

      Also in 3 projects that use this

    • JetBrainsSkill

      module-dependencies

      Add or modify IntelliJ module dependencies in `.iml` files.

      Also in 3 projects that use this

    • CES-LtdSkill

      oss-pr

      Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.

      Also in 3 projects that use this

  • In this repository21 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.

Reviews can't be read right now.

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.