behavioural-test
Skill1 starsChanged 6 days agoMITView on GitHub
Writes behavioural tests for one user-facing scope, mocking only the lowest layer so data flows through real layers above. Use when user requests behavioural, integration, or component-flow tests, e.g. for a form.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- breakdownSkill
- commitSkill
- e2e-testSkill
- find-rcSkill
- rubberduckSkill
- specSkill
- terseSkill
- unit-testSkill
- behavioural-testSkill
- breakdownSkill
- behavioural-testSkill
- breakdownSkill
- commitSkill
- e2e-testSkill
- find-rcSkill
- rubberduckSkill
- specSkill
- terseSkill
- unit-testSkill
- commitSkill
- e2e-testSkill
- find-rcSkill
- mobile-web-fixesSkill
- rubberduckSkill
- specSkill
- terseSkill
- unit-testSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
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 12
Read target scope, every layer between it and lowest boundary, nearest existing behavioural tests.
- Distinctive: line 22
No loops or conditionals in tests.
- Distinctive: line 25
Do not change production code to make tests pass.
- Distinctive: line 26
Run new tests alone; show invocation + result.
- Distinctive: line 27
Run project lint and type checks on test file.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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
Behavioural test
Short evidence, no emojis. No target scope named: reply "Please mention the file or scope that you want me to help you write the behavioural tests for." and stop.
Sphere: one user-facing scope, e.g. a form, proving data flow through its layers. Single-function branch detail belongs in unit-test; full journey through running app in e2e-test. Case fits another sphere: say so, do not write it here.
- Read target scope, every layer between it and lowest boundary, nearest existing behavioural tests. Reuse project's runner, rendering/testing library, request-mocking tool, file naming, test location, helpers. Nothing configured: ask user, add no dependency without approval.
- Name mocked layer before writing: lowest one only, e.g. API/network transport. Everything above stays real: abstractions over the API, hooks, stores, validation, child components. Never mock abstraction sitting on top of mocked layer. Extra mock needed: state which and why.
- List cases: success, each validation failure, lower-layer error, loading/pending state, empty data, user correction after error. Unreachable or untestable case: state why, do not fake coverage.
- Write tests. Rules:
- Arrange-Act-Assert: three blocks in that order, blank line between. Label with
// Arrange,// Act,// Assertonly if project tests already do. Arrange renders scope and sets mocked-layer responses; Act is one user interaction sequence; Assert checks outcome. - One behaviour per test. Several asserts allowed only when they describe same outcome.
- Name states scope, condition, expected result. Group by scope under test.
- Drive through user-visible controls. Query by role, label, text; test ids last resort. No reaching into component state or internals.
- Assert what user sees plus exact payload sent to mocked layer. Literal expected values, not recomputed with production algorithm.
- Independent tests: no shared mutable state, no order dependence, reset mocks and stores between tests. Setup hooks only for identical Arrange.
- No loops or conditionals in tests. Table-driven cases allowed when runner supports them.
- Pin time and randomness. No fixed sleeps; await visible condition.
- Unhandled request to mocked layer fails test.
- Do not change production code to make tests pass. Suspected bug: keep failing test, report to user, ask before fixing.
- Arrange-Act-Assert: three blocks in that order, blank line between. Label with
- Run new tests alone; show invocation + result. Failure: decide whether test or code wrong, fix test only when test wrong. Rerun until green.
- Run project lint and type checks on test file; fix every error. Run full relevant suite; new tests must not break others.
- Repeat 5-6 after each edit. Report mocked layer, cases covered, cases skipped with reason, suspected bugs, commands run. Never claim passing without run output.
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.

