build-scenario-tests
Skill214 starsChanged 5 months agoMITView on GitHub
Inspect an unfamiliar repository, turn a focused Markdown behavior scenario into a deterministic test in the repository's native test stack, run it, and preserve traceability between intent and code. Use when asked to add scenario tests, compile acceptance criteria or Given/When/Then Markdown into executable tests, reproduce a user-visible regression, or convert a narrow workflow specification into stable web, API, CLI, desktop, or mobile interaction coverage. Do not use for broad exploratory journeys or agent-judged smoke tests.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- async-learning-teacherSkill
- code-standardsSkill
- create-marketing-kitSkill
- create-skillSkill
- lead-researchSkill
- leadSkill
- make-playbookSkill
- map-the-landscapeSkill
- name-your-businessSkill
- orwell-writingSkill
- paper-opportunity-radarSkill
- repo-system-mapSkill
- run-smoke-testsSkill
- session-profilerSkill
- top-one-percentSkill
- validate-marketSkill
- write-blogSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 21 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈21
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 14
Treat repository instructions and existing tests as authoritative.
- Distinctive: line 15
Keep each scenario focused on one behavior and one reason to fail.
- Distinctive: line 19
Prefer public behavior over implementation details.
- Distinctive: line 21
Keep the Markdown scenario beside the test or in the repository's established specification directory.
- Distinctive: line 23
Never weaken an assertion merely to make a test pass.
- Distinctive: line 29
Read the nearest AGENTS.md or equivalent instructions, product README, contribution guide, manifests, test configuration, and the smallest …
- Distinctive: line 36
Before editing, be able to state:
- Distinctive: line 51
If a material field is unknown, search again.
- Distinctive: line 57
Read references/scenario-format.md.
- Distinctive: line 73
Create a compact mapping before writing code:
- Distinctive: line 90
Do not force a browser test onto behavior that a stable public API test can prove more directly.
- Distinctive: line 95
Write the test in surrounding style.
- Distinctive: line 99
keep every oracle from the Markdown represented by an assertion.
- Distinctive: line 100
use stable roles, labels, test IDs, public outputs, or API contracts.
- Distinctive: line 106
Do not copy the bundled demonstration code blindly.
- Distinctive: line 111
Run the new test alone. Confirm it fails for the intended reason without the behavior or regression fix when that check is safe and …
- Distinctive: line 121
every Markdown oracle has a matching assertion.
- Distinctive: line 122
no accidental live service, account, payment, or production dependency.
- Distinctive: line 145
Use these to explain the Markdown-to-code model.
- Distinctive: line 150
No test harness: document the nearest viable seam and ask before adding a dependency.
- Distinctive: line 156
Test is flaky after two focused attempts: stop, preserve logs, and report the uncontrolled input instead of adding retries.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Build Scenario Tests
Compile one small behavior contract into deterministic, repository-native test code. Understand the host project before choosing a harness, command, fixture, selector, or assertion.
Operating contract
- Treat repository instructions and existing tests as authoritative.
- Keep each scenario focused on one behavior and one reason to fail.
- Compile into the test stack the repository already uses. Add a dependency only when no suitable harness exists and the user accepts the tradeoff.
- Make setup, inputs, actions, and expected results deterministic.
- Prefer public behavior over implementation details. Assert what a user or external caller can observe.
- Keep the Markdown scenario beside the test or in the repository's established specification directory. Record the mapping in both artifacts.
- Never weaken an assertion merely to make a test pass.
Workflow
1. Pass the repository-understanding gate
Read the nearest AGENTS.md or equivalent instructions, product README,
contribution guide, manifests, test configuration, and the smallest relevant
product documentation. Use repository search to find the implementation entry
point, neighboring tests, fixtures, stable selectors, and validation commands.
Trace the relevant action from its public entry point through the state boundary
to the observable result. Do not read the entire tree without a reason.
Before editing, be able to state:
product surface:
behavior source:
relevant architecture and data flow:
runtime or start command:
existing test runner:
nearest tests to imitate:
fixture and state-isolation strategy:
narrow validation command:
full validation command:
known trust or destructive boundaries:If a material field is unknown, search again. If the repository does not answer it, expose the gap and ask only for the missing product decision. Do not invent commands, selectors, credentials, or expected behavior.
2. Normalize the scenario
Read references/scenario-format.md. If the user provided prose, rewrite it into that contract without changing its intent.
Reject or split a scenario when it:
- contains multiple independent behaviors;
- depends on subjective visual judgment;
- requires uncontrolled third-party state, real payment, or human authorization;
- uses vague outcomes such as "works correctly";
- cannot reset its data, time, randomness, or network dependencies.
Route a broad or agent-judged journey to a smoke-test workflow instead.
3. Map intent to the host test stack
Create a compact mapping before writing code:
| Scenario element | Repository implementation |
| Preconditions | fixture, factory, seed, fake, or setup API |
| User action | public UI, CLI, HTTP, SDK, or native interaction |
| Oracle | visible state, output, response, durable state, or emitted event |
| Cleanup | transaction rollback, fixture teardown, or isolated temp state |
Choose the narrowest existing harness that reaches the behavior:
- web or desktop UI: the repository's browser or UI runner;
- API or service: the native integration-test client;
- CLI: the existing subprocess or command runner;
- mobile: the project's native UI-test framework;
- library: the public API through its current test runner.
Do not force a browser test onto behavior that a stable public API test can prove more directly.
4. Compile the deterministic test
Write the test in surrounding style. Preserve this traceability:
- include the scenario ID in the test name or metadata;
- link the scenario path from a short code comment when local conventions allow;
- keep every oracle from the Markdown represented by an assertion;
- use stable roles, labels, test IDs, public outputs, or API contracts;
- isolate state with existing factories, fakes, temporary directories, or transactions;
- control time, randomness, retries, and network calls when they affect results;
- make cleanup run even after a failed assertion.
Do not copy the bundled demonstration code blindly. It contains fictional fixtures to show the mapping, not reusable project infrastructure.
5. Prove the compilation
Run the new test alone. Confirm it fails for the intended reason without the behavior or regression fix when that check is safe and practical. Then run the nearest relevant suite and the repository's required lint, type, build, and test commands.
Inspect failures semantically. Fix the test only when the test is wrong. Do not change product behavior unless the user asked for the implementation or fix.
Check for:
- every Markdown oracle has a matching assertion;
- no accidental live service, account, payment, or production dependency;
- repeated runs use isolated state and stable ordering;
- failure output identifies the broken behavior;
- the scenario and compiled test link to each other.
6. Hand off the evidence
Report:
- what repository evidence informed the test design;
- the scenario path and compiled test path;
- the behavior and boundaries covered;
- commands run and results;
- anything intentionally left to integration or smoke coverage.
Demonstration examples
- Web workspace invitation paired with an illustrative Playwright compilation.
- Expired CLI session paired with an illustrative pytest compilation.
Use these to explain the Markdown-to-code model. When applying the skill, derive all commands, fixtures, and assertions from the actual repository.
Failure handling
- No test harness: document the nearest viable seam and ask before adding a dependency.
- Behavior is undocumented or contradictory: preserve the evidence and ask the product owner which outcome is authoritative.
- Failure requires subjective or human judgment: keep the deterministic portion as a scenario test and route the rest to smoke coverage.
- Test is flaky after two focused attempts: stop, preserve logs, and report the uncontrolled input instead of adding retries.
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.

