agentleFS
keyreylaakeyreylaa/universal-agent-framework/skills/testing/strategy/SKILL.md

strategy

Skill1 starsChanged 27 days agoMITView on GitHub

Choose and write the right kind of test for a change by first finding the project's existing runner, test directories, and CI command, then matching its conventions. Use when adding, repairing, or reviewing tests, choosing between unit, integration, contract, end-to-end, regression, security, failure-path, or performance coverage, or when a change touches behaviour, boundaries, invariants, precedence, or error paths.

22 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use north-star, brand-voice and 4 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.
  • UMwaiSkill

    north-star

    Evaluate whether current work serves the project's ultimate goal. Scores branches, goals, and commits against declared pillars/objectives. Flags drift and misalignment.

    Also in 3 projects that use this

  • Dokkabei97Skill

    brand-voice

    Defines and enforces brand voice guidelines for startups. Creates tone, style, messaging frameworks and provides consistency checks across all content. Ensures every piece of communication sounds like it comes from the same brand.

    Also in 4 projects that use this

  • MetaSkill

    roadmap

    Build, continue, inspect, or visualize a source-grounded mathematical roadmap and theorem DAG in an existing Autoform Markdown blueprint. Use for source research, repository-wide inventories of existing and planned mathematics, scope, coverage, milestones, and roadmap articles; do not create repository infrastructure or prove Lean declarations.

    Also in 3 projects that use this

  • AnthropicSkill

    brief

    Generate contextual briefings for legal work — daily summary, topic research, or incident response. Use when starting your day and need a scan of legal-relevant items across email, calendar, and contracts, when researching a specific legal question across internal sources, or when a developing situation (data breach, litigation threat, regulatory inquiry) needs rapid context.

    Also in 4 projects that use this

  • AWSSkill

    retro

    Conduct a retrospective on a coding session.

    Also in 3 projects that use this

  • OpenAISkill

    audit

    Audit or critique a product flow, journey, workflow, funnel, onboarding path, checkout path, settings path, screen, or multi-step product experience by capturing screenshots first, then reporting UX, design, and accessibility findings inline from that evidence. Use Figma only when the user explicitly asks for a board. Use when the user asks to audit, review, critique, inspect, assess, analyze, evaluate, or give feedback on a product experience.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 13 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 19 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not activate for: changes with no behaviour surface (comments, formatting, renames with mechanical call-site updates).

    line 18
  2. Distinctive:

    Read access to the repository, its manifest, and its CI configuration.

    line 22
  3. Distinctive:

    If no test infrastructure exists, say so and propose the smallest setup consistent with the ecosystem before adding dependencies (see …

    line 24
  4. Very specific:

    test configuration: jest.config.*, vitest.config.*, playwright.config.*, cypress.config.*, pytest.ini, tox.ini, phpunit.xml, and any test …

    line 30
  5. Distinctive:

    Run the relevant existing tests first, so the baseline is known before the change.

    line 34
  6. Distinctive:

    Do not duplicate implementation details in assertions: no private fields, no internal call order or call counts, no copied formulas, no …

    line 50
  7. Distinctive:

    Never weaken or delete an existing test to make a build pass.

    line 51
  8. Distinctive:

    Run the new test against the pre-change code where practical to confirm it fails for the right reason.

    line 52
  9. Distinctive:

    Run the affected suite, then broader suites when the change is shared or the current mode warrants it.

    line 53
  10. Very specific:

    Run the project's own command from the manifest or CI file (npm test, pytest, go test ./...), not one you invented.

    line 57
  11. Distinctive:

    No test infrastructure: state that plainly, propose the smallest setup the ecosystem supports, and ask before adding dependencies or a …

    line 64
  12. Distinctive:

    Do not disable TLS verification, authentication, or permission checks to make a test run.

    line 115
  13. Distinctive:

    Treat snapshot and fixture files as commit-visible: they can capture secrets, tokens, or personal data.

    line 116
  14. Distinctive:

    Read the manifest, the one relevant config file, and one sibling test to learn the convention, not the whole test tree.

    line 121
  15. Distinctive:

    Keep test output to the failing case.

    line 122

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

Purpose

Tests earn their place by pinning behaviour a consumer can observe, not by existing. This skill makes the agent inspect the project's test infrastructure and follow it before creating anything new, then pick the test type that matches the behaviour changed. The goal is a test that fails when the behaviour breaks and survives refactoring of the implementation.

When this activates

Activate when: adding a test for new or changed behaviour; a bug fix needs a regression test; deciding which kind of test a change requires; reviewing whether an existing test is meaningful; a build is red and tests are involved.

Do not activate for: changes with no behaviour surface (comments, formatting, renames with mechanical call-site updates); throwaway local exploration that will not be committed; pure documentation edits.

Prerequisites

  • Read access to the repository, its manifest, and its CI configuration.
  • The ability to run the project's existing test command.
  • If no test infrastructure exists, say so and propose the smallest setup consistent with the ecosystem before adding dependencies (see Failure behavior).

Procedure

  1. Inspect what already exists, before writing any test. Look for, and read, the files this project actually has:
    • manifest and scripts: package.json (scripts.test, scripts.lint, scripts.ci), pyproject.toml, Cargo.toml, go.mod, Makefile, build.gradle, pom.xml;
    • test configuration: jest.config.*, vitest.config.*, playwright.config.*, cypress.config.*, pytest.ini, tox.ini, phpunit.xml, and any test key in the manifest;
    • existing tests: tests/, test/, spec/, __tests__/, *_test.go, test_*.py, *.spec.ts, *.test.ts;
    • CI: .github/workflows/*.yml, .gitlab-ci.yml, .circleci/config.yml - the command CI runs is the authoritative one.
  2. Match the convention you found. Put the new test beside its siblings and use their naming, assertion style, and existing fixtures, factories, and helpers. Do not introduce a second runner, a new assertion library, or a parallel fixture system.
  3. Run the relevant existing tests first, so the baseline is known before the change.
  4. Choose the test type from the behaviour changed:
Behaviour changedTest typeWhere it belongs
Pure function, branch, or parser ruleunitbeside the module's unit tests
Two components, a database, or a queue togetherintegrationintegration suite with a real or containerised dependency
Request/response shape, schema, or versioned interfaceAPI contractcontract suite; assert the shape seen by the caller
A user-visible flow across the whole systemend-to-endthe E2E suite; keep the count small
A previously broken behaviourregressionnext to the code it protects
Auth, input validation, injection, or secret handlingsecuritya dedicated case with hostile input
An error, timeout, retry, or partial failurefailure-pathbeside the success case
Latency, throughput, or memory budgetperformancebenchmark suite, tracked separately
  1. Add a permanent test only for a plausible consumer-visible bug: wrong behaviour, a boundary, a broken invariant, an illegal state transition, precedence, or an error path. For anything else - a one-off exploration, a timing curiosity, a value only visible internally - verify with a throwaway script and delete it instead of committing a test nobody needs.
  2. Assert meaningful behaviour. The assertion must fail when the code is wrong. Prefer one assertion on the returned or persisted value over probing internals, and cover boundaries (empty, one, many, maximum, duplicate) and invariants where they exist.
  3. Do not duplicate implementation details in assertions: no private fields, no internal call order or call counts, no copied formulas, no snapshot of an object whose shape is incidental.
  4. Never weaken or delete an existing test to make a build pass. If a test now contradicts the intended behaviour, that is a contract change: say so, get agreement, then change the expectation deliberately and state which expectation changed and why.
  5. Run the new test against the pre-change code where practical to confirm it fails for the right reason; a regression test that passes before the fix pins nothing.
  6. Run the affected suite, then broader suites when the change is shared or the current mode warrants it.

Verification

  • Run the project's own command from the manifest or CI file (npm test, pytest, go test ./...), not one you invented.
  • The new test passes with the change and fails without it (revert, run, restore).
  • The affected suite is green with no newly skipped or disabled tests.
  • Report the exact command and its observed result; do not claim a suite passed that you did not run.

Failure behavior

  • No test infrastructure: state that plainly, propose the smallest setup the ecosystem supports, and ask before adding dependencies or a runner.
  • The suite fails before your change: isolate the pre-existing failures, record them, and keep them out of your result; do not "fix" them by weakening assertions.
  • Tests cannot run here because a service, credential, or environment is missing: say exactly what is missing and what you verified instead, and label unrun checks as unrun.
  • The only available assertion would be a no-throw check: it proves little; assert the value or state that must result instead.
  • A test is flaky: do not add retries to hide it; treat it as a defect and find the cause (see the root-cause skill).

Anti-patterns

Poor, pins a copied implementation detail:

it("computes the quote", async () => {
  const repo = { findCart: vi.fn().mockResolvedValue(cart), findRate: vi.fn().mockResolvedValue({ rate: 0.1 }) };
  const quote = await new PricingService(repo).quote("cart-1");
  expect(repo.findCart).toHaveBeenCalledWith("cart-1");
  expect(repo.findRate).toHaveBeenCalledAfter(repo.findCart);   // internal ordering
  expect(quote).toBe(18);
});

This asserts how the service is built, not what it promises: batching the two lookups, adding a cache, or renaming findRate breaks it while the price a customer sees never changed - and it still passes if tax is applied off the wrong base.

Improved, pins the observable contract:

it("charges the discounted total and never exceeds the subtotal", async () => {
  const pricing = makePricingService();                  // the project's own factory
  pricing.seedCart({ id: "cart-1", items: [{ price: 10, qty: 2 }], discountRate: 0.1 });

  const quote = await pricing.quote("cart-1");

  expect(quote.subtotal).toBe(20);
  expect(quote.total).toBe(18);
  expect(quote.total).toBeLessThanOrEqual(quote.subtotal);   // invariant the ordering must keep
});

This survives refactoring of the internals because it asserts prices a caller can see plus an invariant, and it fails the moment the discount is dropped or the rounding regresses.

Poor, asserts only that nothing threw:

it("parses the config", () => { expect(() => parseConfig(input)).not.toThrow(); });

Improved: assert the parsed result, for example expect(parseConfig(input).retries).toBe(3). A not-throw test passes for a function that silently returns undefined.

Poor, weakens a failing test to get a green build:

-  expect(quote.total).toBe(18);
+  expect(quote.total).toBeLessThan(100);

Improved: leave it failing, find the cause, and fix the code - or, if the contract truly changed, record the decision and update the exact expected value with agreement.

Security

  • Tests must not use real credentials, real customer data, or production endpoints; use fixtures, factories, and local or containerised dependencies.
  • Do not disable TLS verification, authentication, or permission checks to make a test run; that removes the very check the test exists to make.
  • Treat snapshot and fixture files as commit-visible: they can capture secrets, tokens, or personal data; review them before committing.
  • Hostile-input tests are valuable, but never point the hostile input at a live system.

Token notes

  • Read the manifest, the one relevant config file, and one sibling test to learn the convention, not the whole test tree.
  • Keep test output to the failing case; a full suite log rarely needs to enter context.
  • Reuse existing fixtures and factories rather than writing new setup, which is both longer to write and more context to hold.
  • Record a durable decision with uaf remember "<test convention>" when you discover a project-specific rule, so later sessions do not re-derive it.

Known limitations

  • The mapping from behaviour to test type is a default, not a law; a project's existing arrangement wins where it differs.
  • Whether an integration or E2E suite can run here depends on services and credentials that may be unavailable; the skill cannot create them.
  • Coverage percentages are not evidence of correctness and are not used here as an acceptance criterion.
  • This skill cannot judge the intended behaviour; it only ensures the chosen test pins behaviour someone has agreed on.

Download now (ZIP)

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.