Specifying by example
Writes, reviews, and refines Specification by Example (SBE) artifacts — Gherkin scenarios, example mappings, rule-example tables, and scenario outlines. Produces declarative, single-behavior specifications using ubiquitous language. Use when writing acceptance criteria, Given-When-Then scenarios, feature files, BDD specifications, or executable specifications, when reviewing Gherkin for anti-patterns, when running Example Mapping or Three Amigos sessions, or when the user mentions SBE, BDD, specification by example, or spec-driven development.From its SKILL.md
npx -y skills add msewell/agent-stuff --skill specifying-by-exampleAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.1 KB, ~1.3k tokens by cl100k_base, as published. Nobody here has run it
Specifying by Example
Workflow: Writing SBE specifications
-
Clarify the business goal. Ask what problem the feature solves and for whom. If the user provides a user story, extract the goal. If they provide raw requirements, ask "why are we building this?"
-
Identify rules. Extract the distinct business rules from the requirements. Each rule is a constraint or behavior the system must enforce. Name each rule explicitly.
-
Generate examples for each rule. For every rule, produce:
- The happy path (main success scenario).
- Key boundary conditions (edges where behavior changes).
- Important negative cases (what the system should refuse). Use realistic data (real names, plausible amounts), not "foo"/"bar."
-
Write Gherkin scenarios. Convert each example into a Given-When-Then scenario following these rules:
- Declarative, not imperative. Describe what happens, not UI steps. No CSS selectors, button names, or page navigation.
- One behavior per scenario. Each scenario has exactly one When-Then pair.
- Essential data only. Include only data that illustrates the rule. Omit incidental details (user IDs, timestamps, irrelevant fields).
- Ubiquitous language. Use the same terms the business uses. No
user_id,POST /api/orders, orstatus = 2. - Name the rule. Group scenarios under a
Rule:keyword in Gherkin.
-
Use Scenario Outlines for boundary tables. When a rule has many input-output combinations, use a parameterized
Scenario Outlinewith anExamplestable instead of repeating similar scenarios. -
Check for specification gaps. Are there rules with no examples? Examples with no clear rule? Unanswered questions? Surface these explicitly.
-
Organize by domain concept. Group feature files by business capability (e.g.,
specs/pricing/,specs/accounts/), not by sprint or ticket number.
Workflow: Reviewing SBE specifications
- Read all scenarios in the feature file or specification document.
- Check each scenario against these anti-patterns:
| Anti-pattern | Symptom | Fix |
|---|---|---|
| Imperative scripts | Steps say "click," "type," "navigate" | Rewrite in declarative style |
| Multi-behavior scenarios | Multiple When-Then pairs | Split into one scenario per behavior |
| Incidental detail overload | Irrelevant data (user IDs, timestamps) | Strip to essential data only |
| Technical leakage | Steps reference APIs, HTTP codes, DB tables | Replace with business-language equivalents |
| Inconsistent vocabulary | Same concept called different names | Pick one term and use it everywhere |
| Scenario proliferation | Hundreds of trivially different scenarios | Use Scenario Outlines; push combinatorics to unit tests |
| Too abstract | "Given sufficient funds / When they withdraw / Then it succeeds" | Add concrete amounts and expected outcomes |
| UI-coupled specs | Scenarios break when the UI is redesigned | Automate against the API/service layer; use declarative language |
- Verify the specification covers happy path, boundaries, and negative cases for each rule.
- Propose specific fixes with before/after Gherkin.
Quick example
Input: "Users get free shipping on orders over $75, otherwise $5.95 flat rate."
Output:
Feature: Shipping cost calculation
Rule: Shipping is free for orders over $75; otherwise $5.95 flat rate
Scenario Outline: Shipping cost based on order total
Given an order with a subtotal of <subtotal>
When the shopper proceeds to checkout
Then the shipping charge is <shipping>
Examples:
| subtotal | shipping |
| $50.00 | $5.95 |
| $74.99 | $5.95 |
| $75.00 | $0.00 |
| $75.01 | $0.00 |
| $150.00 | $0.00 |
The boundary ($75.00) is tested from both sides. The rule is stated in prose above the scenarios.
When NOT to apply SBE
Ask two questions before reaching for SBE:
- Will a non-developer ever need to read or validate this specification? If only developers will care, use standard test frameworks.
- Is there genuine ambiguity about what the system should do? If everyone already agrees, write a test and move on.
Skip SBE for: trivial CRUD, pure infrastructure/DevOps, throwaway prototypes, unit-level logic, algorithmically complex internals, and highly exploratory work.
A healthy ratio: SBE scenarios cover 10–20% of the test suite (high-value acceptance layer); unit and integration tests cover the remaining 80–90%.
Reference material
- Collaborative techniques: references/01-collaborative-techniques.md — Three Amigos, Example Mapping (with full walkthrough), Feature Mapping, discovery workshops, facilitation runbook
- Writing effective examples: references/02-writing-effective-examples.md — declarative style, single-behavior rule, detail calibration, ubiquitous language, worked examples
- Lifecycle and living documentation: references/03-lifecycle-and-living-documentation.md — core principles, the seven process patterns, living documentation curation
- Adoption, failure modes, and measurement: references/04-adoption-and-measurement.md — adoption failure modes, maturity model, story slicing with examples, spec-driven development, success metrics
- Glossary: references/05-glossary.md — SBE terminology reference
What ships with it: 5 files
34.4 KB alongside SKILL.md
references/
Gives 0 of the 12 instructions most plan spec skills give in ~1.3k tokens
Counted across 1,099 of the 1,860 authors here whose files we hold, read 2026-08-07
- Ask one question at a timein 51 of 1099
- Break plans into vertical slicesin 29 of 1099, across 11 files
- Publish issues in dependency orderin 27 of 1099, across 9 files
- Iterate until user approves the breakdownin 25 of 1099, across 7 files
- Explore the repository to understand the codebase statein 24 of 1099, across 7 files
- Use domain glossary vocabularyin 23 of 1099, across 5 files
- Apply correct triage labels to published issuesin 23 of 1099, across 5 files
- Prefer AFK slices over HITLin 22 of 1099, across 7 files
- Write a specification before writing any codein 22 of 1099, across 14 files
- Write failing tests before implementation codein 22 of 1099, across 20 files
- Ask clarifying questions until requirements are concretein 21 of 1099, across 13 files
- Respect existing architecture decision recordsin 20 of 1099, across 5 files
Said here and by no other author read
- ask what problem the feature solves
- extract and name distinct business rules
- produce happy paths boundary conditions and negative cases
- use realistic data in examples
- limit each scenario to one When-Then pair
- include only data that illustrates the rule
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.