testing-principles
Skill1 starsChanged 39 days agoMITView on GitHub
Shared guidance for behaviour-focused tests in TDD, regression fixes, acceptance-test implementation, perceptual and visual requirements, property and generated-input coverage, flaky test fixes, and test review. Use when writing, updating, stabilizing, or reviewing tests, or briefing another agent about tests, especially when deciding whether a cleanup/removal request needs a new test.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Hakkadaikon/hymmetheir own version, first seen Oct 26, 2026
- Khuirul-Huda/clean-principlestheir own version, first seen Oct 25, 2026
- shinpr/claude-code-workflowstheir own version, first seen Mar 23, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- shinpr/claude-code-workflows★ 712same name
- Hakkadaikon/hymme★ 0same name
- Khuirul-Huda/clean-principles★ 0same name
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.
In this repository38 other files it gives its agents.
- agent-conductSkill
- bugfixSkill
- code-smellsSkill
- deliverSkill
- final-responseSkill
- frontend-designSkill
- go-conventionsSkill
- go-implementorSkill
- go-reviewerSkill
- go-test-strengthSkill
- implementation-principlesSkill
- nextflow-conventionsSkill
- nextflow-implementorSkill
- nextflow-reviewerSkill
- nextjs-fastapi-conventionsSkill
- nextjs-fastapi-implementorSkill
- nextjs-fastapi-reviewerSkill
- orchestratorSkill
- phase-creatorSkill
- phase-reviewerSkill
- prose-principlesSkill
- pr-resolverSkill
- pr-reviewerSkill
- python-conventionsSkill
- python-implementorSkill
- python-reviewerSkill
- spec-authorSkill
- spec-proofreaderSkill
- spec-reviewerSkill
- spec-writerSkill
- subagentsSkill
- swift-conventionsSkill
- swift-implementorSkill
- swift-reviewerSkill
- tightenSkill
- unslopSkill
- verificationSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 11 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use tests to declare desired behaviour and prove the system has that behaviour.
- Distinctive: line 17
When the requirement is perceptual (colour, contrast, spacing, a focus ring, a selection state, an animation end state), the supported …
- Distinctive: line 29
Before completing a user-visible behaviour change, prove the affected paths through the real app's supported interface.
- Distinctive: line 34
Follow verification for discovery, execution, evidence, and failure handling.
- Distinctive: line 40
Do not write tests whose only claim is an implementation detail: private helpers, source layout, filenames, imports, CSS classes, deleted …
- Distinctive: line 45
Do not test a dependency's behaviour (that belongs in its project), test-only helpers, or language features.
- Distinctive: line 71
Keep the generator deterministic, seeded from a fixed value, so a failure reproduces.
- Distinctive: line 77
Treat a flaky test as a bug in the test suite or product, not as a reason to skip coverage.
- Distinctive: line 88
If a user asks to remove obsolete implementation or get rid of a previously implemented feature, first identify the desired behaviour after …
- Distinctive: line 91
If supported behaviour changes, write a failing test for the new desired behaviour.
- Distinctive: line 93
If supported behaviour does not change, do not invent a new test that asserts old artifacts are gone.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Testing Principles
Core Rule
Use tests to declare desired behaviour and prove the system has that behaviour. Prefer supported boundaries: public APIs, CLI output, HTTP contracts, rendered UI, persisted state, emitted files, errors, or other effects visible to users, callers, or downstream steps.
Perceptual Requirements
When the requirement is perceptual (colour, contrast, spacing, a focus ring, a selection state, an animation end state), the supported boundary is the rendered result in a real browser. Source CSS, class names, and jsdom computed styles do not prove it.
Assert on a screenshot, or on sampled pixels and measured geometry, through the same theming mechanism production uses. Compare the element against its own fill and nearby surfaces rather than against token names. This holds for a test, for a review, and for a bug's red command alike.
User-Path Verification
Before completing a user-visible behaviour change, prove the affected paths through the real app's supported interface. Existing E2E tests count when they exercise those paths and assert the required outcomes. Keep targeted regression tests; run the full suite when project policy or change scope requires it.
Follow verification for discovery, execution, evidence, and failure handling. After later edits or rebases, refresh affected proof before completion or publication.
Avoid
Do not write tests whose only claim is an implementation detail: private helpers, source layout, filenames, imports, CSS classes, deleted files, removed functions, removed routes, removed modules/processes, or the mere absence of an old feature.
Do not test a dependency's behaviour (that belongs in its project), test-only helpers, or language features. Give every test synchronisation aid (sleep, channel, hook, wrapper) an evident purpose, and derive each wait's bound from what it waits on, never a guess.
Properties and Generated Input
A worked example the spec names earns a table test. A claim that must hold across a whole domain earns generated input as well: overflow safety over a numeric range, a round-trip that must return the original, a parser that must never panic on any input.
Name the property before generating anything. Four shapes carry most cases:
- Oracle. A slower obviously-correct version agrees with the fast one.
- Round-trip. Decoding an encoded value returns the input.
- Invariant. Output stays in range, a total is conserved, nothing panics.
- Two paths agree. A cached or optimised path matches the plain one.
Assert the property, never a second copy of the implementation. Generated input that recomputes the code the same way proves only self-consistency.
Generated input supplements the spec's worked examples and never replaces them. A named example is a requirement; a generator that happens to reach it today may not tomorrow.
Keep the generator deterministic, seeded from a fixed value, so a failure reproduces. A failing generated case is a finding, not flakiness: pin that exact input as a permanent regression case, then fix the code.
Flaky Tests
Treat a flaky test as a bug in the test suite or product, not as a reason to skip coverage. Do not skip, quarantine, xfail, delete, or loosen the test until it no longer proves behaviour.
You may reimplement a flaky test to make it deterministic when the replacement preserves the spirit of what the original test was trying to prove. Prefer stable user-visible boundaries and remove nondeterminism by controlling clocks, randomness, ordering, external services, async waits, or fixture setup.
Cleanup and Removal
If a user asks to remove obsolete implementation or get rid of a previously implemented feature, first identify the desired behaviour after the change.
- If supported behaviour changes, write a failing test for the new desired behaviour.
- If supported behaviour does not change, do not invent a new test that asserts old artifacts are gone. State why no new test is appropriate, then run the existing behavioural tests and quality gates.
Review Rule
Reject tests that pass by coupling to implementation details, hardcoded results, stubs that bypass the behaviour under test, or assertions that only prove old artifacts are absent. Accept a cleanup/removal with no new test only when the implementor explicitly justifies that no supported behaviour changed and the existing behavioural tests and quality gates pass. Reject flaky-test changes that merely skip, quarantine, delete, or weaken the check instead of preserving its behavioural intent. Reject generated-input tests whose assertion re-implements the code under test, and reject a generated failure that is silenced or re-seeded away instead of pinned as a regression case.
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
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.

