agentleFS
udaysharmadevudaysharmadev/Skills/skills/proof/SKILL.md

proof

Skill12 starsChanged 56 days agoMITView on GitHub

Chooses and implements the cheapest trustworthy test boundary for a behavior or invariant, including regression, property, contract, integration, and end-to-end tests. Use when adding tests, protecting a bug fix, or proving changed behavior without optimizing for coverage counts.

17 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

22 rules. 0 are common, 20 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 16 edited versions we read keep these.

  • 20

    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 replace a suite or add a framework to test one small behavior.

    line 43
  2. Distinctive:

    Do not weaken/remove a test, assertion, timeout, or coverage gate merely to make a change green.

    line 44
  3. Distinctive:

    Do not report a test as passed unless its actual runner exited successfully in the stated environment.

    line 47
  4. Distinctive:

    Keep secrets, production identifiers, and proprietary captures out of test fixtures and failure output.

    line 50
  5. Distinctive:

    Before writing code, write one compact record per behavior:

    line 55
  6. Distinctive:

    If the oracle is vague, write a narrow acceptance example or route to the decision owner.

    line 67
  7. Very specific:

    Read references/boundary-picker.md for the full decision table.

    line 81
  8. Distinctive:

    Do not mutate a user's dirty worktree or require mutation tools for trivial changes.

    line 94
  9. Distinctive:

    Property-based tests: Use generators for stable invariants over a broad input space when the existing stack supports them.

    line 96
  10. Distinctive:

    Run the relevant suite and classify its actual outcomes: passed, assertion failure, setup/error, skipped, expected failure, unexpected …

    line 116
  11. Distinctive:

    Read result semantics when partial execution, mutation, quarantine, or retries could make a green exit misleading.

    line 118
  12. Distinctive:

    Every confirmed bug gets a test that fails without the fix and passes with it: this is the rule that converts debugging into permanent …

    line 125
  13. Distinctive:

    Read the test as a future failure detector.

    line 131
  14. Distinctive:

    Use the real database engine when SQL dialect, constraints, locking, transactions, migrations, triggers, or query semantics matter.

    line 155
  15. Distinctive:

    Use end-to-end only for the small set of user-critical cross-boundary paths.

    line 171
  16. Distinctive:

    Keep data setup explicit, selectors stable, environment/viewport documented, and failures diagnosable.

    line 172
  17. Distinctive:

    No test setup at all → smallest honest harness for the stack first, then the tests.

    line 180
  18. Distinctive:

    No runner executable here → tests delivered + run command stated, suite status marked unverified, never "should pass".

    line 184
  19. Very specific:

    Every report states each tested boundary on a line starting with the literal singular word boundary (e.g.

    line 191
  20. Distinctive:

    Test names state behavior.

    line 194
  21. Distinctive:

    No runner/CI available → deliver the harness + tests runnable locally, mark CI integration as the known gap.

    line 206
  22. Distinctive:

    Read references/research.md when a decision depends on an external standard, a numerical claim, or a fast-moving practice.

    line 218

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

proof: the right test at the right boundary

The skill is the boundary choice. A large unit suite can miss a broken checkout; focused API tests can catch the actual boundary failure. Test count is not the goal, catching real regressions is.

When to use

  • "add tests for the checkout flow"
  • "we need regression coverage for that bug you fixed"
  • "just add a regression test for this bug, leave the suite alone"

When NOT to use

  • The bug isn't understood yet → sleuth finds the cause; you lock it down with a regression test after.
  • The question is whether the flow works in a real browser → roadtest.
  • Pure performance → hotpath.

Prerequisites

A runnable way to execute the chosen layer (framework, runner, CI or local commands). If the repo has no test setup at all, that's the first deliverable: the smallest honest harness for this stack: not a framework tour.

Also identify the behavior owner, public contract or invariant, risk surface, existing test convention, deterministic fixture strategy, and execution environment. The behavior may be confirmed by code, a bug report, contract, or user-provided acceptance rule; do not infer it from a test name alone.

Authority and preservation boundaries

  • Tests may create isolated fixtures, temporary directories, test schemas, or local processes within the repository convention. Never target production, shared customer data, paid third parties, or a live account without approval.
  • Preserve existing test style, runner, fixtures, and naming where they work. Do not replace a suite or add a framework to test one small behavior.
  • Do not weaken/remove a test, assertion, timeout, or coverage gate merely to make a change green. Diagnose or label the reason and seek approval for any intentional expectation change.
  • Do not report a test as passed unless its actual runner exited successfully in the stated environment. A compile-only, collection-only, or mocked check is a different evidence class.
  • Keep secrets, production identifiers, and proprietary captures out of test fixtures and failure output.

Test design record

Before writing code, write one compact record per behavior:

FieldRequired answer
Behavior/invariantobservable expected result and prohibited result
Riskuser/data/auth/money/compatibility/operational consequence
Boundarylowest faithful test boundary and why lower layers miss it
Oracleexact result, state, side effect, or property that proves outcome
Fixturesmallest representative setup and isolation/reset method
Negative casesmalformed, unauthorized, boundary, concurrency, or failure cases that apply
Mutationa deliberate implementation break expected to make this test fail

If the oracle is vague, write a narrow acceptance example or route to the decision owner. A test cannot prove "better" or "works" without an observable condition.

Workflow

1. Name the behavior and its risk

"Anonymous users cannot read another user's orders": a behavior, a stake, a failing condition. If you can't name the behavior, you're about to test trivia.

2. Pick the cheapest boundary that would catch a real regression

Read references/boundary-picker.md for the full decision table. Rule of thumb: push the test down (unit for pure logic) until the behavior genuinely crosses a boundary (HTTP, DB, queue, browser): then test at that boundary and stop. Two classic errors:

  • everything end-to-end → slow, flaky, nobody runs it;
  • everything unit → green suite, broken product (the mocks lied).

3. Write tests that survive refactors

  • Failure sensitivity: For a confirmed bug, run the test against the known broken implementation and the fix. For new high-risk behavior, use the smallest reversible mutation in an isolated copy when it adds evidence. Do not mutate a user's dirty worktree or require mutation tools for trivial changes. A setup/import error is not the expected assertion failure.
  • Property-based tests: Use generators for stable invariants over a broad input space when the existing stack supports them. A few well-chosen boundary examples can be sufficient; do not add a framework solely for one simple test.
  • Names state behavior: rejects orders over the credit limit, not processOrder_v2_works.
  • Arrange–act–assert, one behavior per test.
  • Edge/error paths are first-class: empty, zero, negative, huge, malformed, unauthorized, concurrent, offline.
  • Assertions on observable outcomes (returned data, state, side effects the user cares about): not on internal call sequences.

4. Mocking discipline (Anti-Over-Mocking)

Mock only boundaries you don't own and can't run (network, clock, RNG, third-party APIs). Never mock the unit under test, the database in a database test, or so much that the test verifies the mock arrangement rather than the behavior. Use production-shaped data (or captured real traffic) instead of simplistic, hallucinated stubs. A test that fails only because a mock drifted is a liability: delete or ground it in a contract test.

5. Run and classify

Run the relevant suite and classify its actual outcomes: passed, assertion failure, setup/error, skipped, expected failure, unexpected pass, or flake. Read result semantics when partial execution, mutation, quarantine, or retries could make a green exit misleading. Fix a flake when possible; propose quarantine with an owner and tracked reason when it fits project policy. Do not open an external issue without authorization.

6. Regression lock

Every confirmed bug gets a test that fails without the fix and passes with it: this is the rule that converts debugging into permanent value. The regression test lands in the same change as the fix.

7. Review test trustworthiness

Read the test as a future failure detector. Verify setup cannot satisfy the assertion by itself; fixture state is reset; clocks, randomness, ordering, and network are controlled; failures show enough relevant diagnostic context; and the assertion would fail for the known incorrect behavior. Use the lightest mutation: remove the guard, flip an operator, return an invalid status, or break the critical contract, then restore it immediately.

For a high-risk change, test the happy result, a nearby valid case, and the critical rejection/failure boundary. Do not expand into every scenario without an identified risk. Put generated cases behind a property when the invariant is stable and the generator/shrinker will produce interpretable failures.

Boundary-specific expert rules

Contracts, APIs, and authorization

Exercise the real route/application boundary with a realistic identity and assert status, response shape, headers/error contract where public, persistent outcome, and absence of forbidden side effect. Test the authorization matrix at the enforcement point: unauthenticated, lower-privilege, wrong tenant/object, and permitted cases as applicable. Client-side hiding is not evidence.

Databases, migrations, and jobs

Use the real database engine when SQL dialect, constraints, locking, transactions, migrations, triggers, or query semantics matter. Test migration up and the approved rollback/recovery path where the project supports it; verify existing rows and new writes preserve invariants. For jobs, assert idempotency, retry/dead-letter behavior, duplicate delivery, scheduling boundary, and observable completion only where relevant.

Time, concurrency, and nondeterminism

Inject or freeze a clock, seed a random source, use deterministic IDs, and wait for conditions rather than sleeping. For concurrency, assert an invariant under a controlled interleaving or repeated bounded run, then record its limitation. A passing race test on one machine is not proof of universal safety.

Browser and end-to-end scope

Use end-to-end only for the small set of user-critical cross-boundary paths. Keep data setup explicit, selectors stable, environment/viewport documented, and failures diagnosable. Hand browser visual, console, network, and real-flow evidence to roadtest rather than duplicating its deliverable.

Tool selection/fallback

  • Project runner (pytest, vitest, go test, unittest…) → real runner output only; counts and coverage quoted from it, never estimated.
  • No test setup at all → smallest honest harness for the stack first, then the tests; framework tour refused.
  • Mutation tooling or a known broken revision → use selectively for meaningful failure sensitivity; isolate changes and retain expected assertion output.
  • No runner executable here → tests delivered + run command stated, suite status marked unverified, never "should pass".

Quality gates

  • Boundary choice justified in one line per test group ("API-level: the behavior is the contract").
  • Every report states each tested boundary on a line starting with the literal singular word boundary (e.g. boundary: empty-cart total at API layer); the plural alone does not satisfy the contract.
  • Test names state behavior; assertions are on outcomes, not internals.
  • Edge/error paths covered for new public surfaces.
  • Suite green as run by the actual runner: coverage/counts quoted only from real runner output, never estimated.
  • Regression test exists for every bug fixed in this change.

Stop conditions

  • Coverage delivered at the justified boundaries, suite green → summary, stop.
  • Writing the test reveals a bug → route to sleuth with the failing signal you just built.
  • No runner/CI available → deliver the harness + tests runnable locally, mark CI integration as the known gap.

Output contract

Chat: the boundary map (behavior → boundary, one line each starting with boundary:), evidence (N tests passing via <command>), gaps deliberately left uncovered and why. On disk: test files in the project's convention: never a parallel __tests_dump__ folder.

Research basis

Read references/research.md when a decision depends on an external standard, a numerical claim, or a fast-moving practice. The ledger records what the source supports, what it does not support, and when to reverify.

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.

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.