skills/requirements/scenario-generator/SKILL.md
Generates concrete scenarios from a requirement — happy paths, edge cases, and error conditions — expressed as Given/When/Then or equivalent structured narratives. Use when turning a requirement into acceptance tests, when exploring what could go wrong, or when the requirement is abstract and needs grounding.
npx skillsauth add santosomar/general-secure-coding-agent-skills scenario-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A requirement says "users can reset their password." Scenarios say: this user, in this state, does this, and this happens. Scenarios are requirements made concrete enough to execute.
Given <initial state / preconditions>
When <action the actor takes>
Then <observable outcome>
Every scenario is one path through the system. A requirement usually generates 3–10 scenarios: one happy path, several edges, several errors.
For each requirement, walk the dimensions:
| Dimension | Questions | | ------------------------- | ----------------------------------------------------------- | | Actor variants | Logged in? Anonymous? Admin? Suspended? | | Input boundaries | Empty? Max length? Just over max? Unicode? Null? | | State variants | First time? Repeat? Concurrent? After a failure? | | Timing | Immediately? After timeout? During maintenance? | | Failure injection | DB down? Third-party 500? Network partition mid-flow? | | Sequence | Out of order? Duplicate? Replayed? |
Cross the dimensions that matter. Not all N×M — most combinations are uninteresting. Pick the ones where the outcome differs.
Requirement: "A user can reset their password via email link. The link expires after 1 hour."
Happy path:
Scenario: Successful password reset
Given a user with email [email protected] and a known password
When Alice requests a password reset for [email protected]
Then a reset email is sent to [email protected]
And the email contains a link valid for 1 hour
When Alice clicks the link within 1 hour
And submits a new password meeting the policy
Then Alice can log in with the new password
And cannot log in with the old password
Edge — timing boundary:
Scenario: Link used at exactly T+60min
Given a reset link issued at time T
When the link is used at exactly T + 60 minutes
Then <ASK: is the boundary inclusive or exclusive? — stakeholder decision>
Error — expired:
Scenario: Expired link rejected
Given a reset link issued at time T
When the link is used at T + 61 minutes
Then an "expired link" error is shown
And no password change occurs
And the user can request a new link
Error — wrong actor:
Scenario: Reset requested for nonexistent email
Given no user with email [email protected] exists
When a reset is requested for [email protected]
Then the response is identical to the success case (no enumeration leak)
And no email is sent
Sequence — reuse:
Scenario: Link is single-use
Given a reset link that has already been used successfully
When the same link is used again
Then an "invalid link" error is shown
And no password change occurs
Concurrency:
Scenario: Two reset requests in flight
Given a user requests reset, receiving link L1
And requests reset again, receiving link L2
When L1 is used
Then <ASK: does L2 stay valid? does issuing L2 invalidate L1? — stakeholder decision>
Found by this exercise: two <ASK> placeholders — boundary inclusivity and concurrent-link policy. Neither was in the original requirement. Scenarios surface gaps.
Not all scenarios are worth automating:
| Priority | Scenarios | Automate? | | -------- | ------------------------------------------------------ | ------------------ | | P0 | Happy path, security-relevant errors (enumeration, expiry) | Yes — blocking | | P1 | Boundaries (exact expiry moment, max password length) | Yes | | P2 | Unlikely-but-bad (concurrent links, partial failures) | Yes if cheap; manual test otherwise | | P3 | Cosmetic (error message wording) | Spot-check |
<ASK> items unresolved. They're requirements gaps — escalate to the stakeholder before the scenario becomes a test with a guessed answer.Given a user with email [email protected] is a scenario. INSERT INTO users VALUES ... is a test. Keep scenarios implementation-agnostic.## Requirement
<verbatim>
## Dimensions explored
<actor variants, input boundaries, state variants, timing, failures, sequence>
## Scenarios
### Happy path
<Given/When/Then>
### Edge: <name>
<Given/When/Then>
...
### Error: <name>
<Given/When/Then>
...
## Gaps surfaced
<ASK items — requirement decisions the scenarios need that the requirement doesn't provide>
## Coverage note
<which dimension combinations were skipped and why they're uninteresting>
development
Extracts human-readable pseudocode from a verified formal artifact (Dafny, Lean, TLA+) while preserving the verified properties as annotations, so the proof-carrying logic can be reimplemented in a production language. Use when porting verified code to an unverified target, when documenting what a formal spec actually does, or when handing a verified algorithm to an implementer.
development
Translates natural-language or pseudocode descriptions of concurrent and distributed systems into TLA+ specifications ready for the TLC model checker. Identifies state variables, actions, type invariants, safety properties, and liveness properties from the description. Use when formalizing a protocol, when the user describes a distributed algorithm to verify, when designing a consensus or locking scheme, or when starting formal verification of a concurrent system.
testing
Reduces a TLA+ model so TLC can actually check it — shrinks constants, adds state constraints, abstracts data, or applies symmetry — when the state space is too large to enumerate. Use when TLC runs out of memory, when checking takes hours, or when a spec works at N=2 and you need confidence at larger scale.
development
TLA+-specific instance of model-guided repair — reads a TLC error trace, identifies the enabling condition that should have been false, strengthens the corresponding action, and maps the fix to source code. Use when TLC reports an invariant violation or deadlock and you have the code-to-TLA+ mapping from extraction.