agentleFS
gurinderugurinderu/craft/skills/specs/SKILL.md

specs

Skill1 starsChanged 41 days agoMITView on GitHub

Specification by example / BDD / ATDD — turning requirements into concrete Given/When/Then scenarios that double as acceptance tests, driven outside-in. Language-agnostic. Use when turning a feature, user story, or vague requirement into testable behavior before coding, or clarifying acceptance criteria. Triggers: specification by example, acceptance criteria, ATDD, BDD, given when then, gherkin, outside-in.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 1

    Distinctive

    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
  1. Distinctive:

    Start from the behavior the user cares about (outer red), then discover the units you need to make it pass (inner red-green-refactor).

    line 80

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Specs — specification by example

A spec, a behavior example, and a test are the same thing said three ways. This skill is the process of turning requirements into Given/When/Then scenarios that are executable and stay true — independent of language. The mechanics of running them live in the per-language testing skills (Rust: rust-testing → BDD; cucumber).

When to Use

  • Turning a feature / user story / vague requirement into testable behavior before coding
  • Pinning down ambiguous acceptance criteria with concrete examples
  • Building living documentation that can't drift from the code (the spec is a green test)
  • Driving implementation outside-in from acceptance down to units

The artifact triple

requirement / user story        "users can't overdraw their account"
        │  express each rule as concrete examples
acceptance criteria → scenarios  Given balance 100, When withdraw 150, Then rejected
        │  bind steps / write the test
executable acceptance test       runs in CI; red until the behavior exists
        │  drive the code outside-in
implementation                   inner unit-TDD fills in the pieces

Because the bottom three are one artifact, the spec can never silently rot: if behavior changes, the acceptance test goes red. This is Specification by Example / ATDD.

From requirement to scenarios

  1. Find the rules. Decompose the story into discrete business rules ("overdraft is rejected", "withdrawal reduces balance", "daily limit applies"). One rule ≠ one scenario — a rule usually needs several examples.
  2. Pick examples per rule. For each rule choose the happy path, the boundaries (exactly at the limit, one past it), and the one error case that matters. Don't enumerate every input — pick representatives of each equivalence class (see writing-scenarios.md).
  3. Get three perspectives (the "three amigos"): business (is this the right rule?), development (can we build it?), testing (how could it break?). Even solo, walk all three — the testing lens is where missing scenarios surface.
  4. Write each example as Given/When/Then.
  5. Keep what the examples settled or left open. A rule nobody can answer yet → memory record-question; the answer, when it comes → record-decision superseding it.

Anatomy of a scenario

BeatHoldsRule
Giventhe starting context / stateset up the world; may be several
Whenthe single action or event under testexactly one per scenario
Thenthe observable outcome(s)assert results, not internal state

One When per scenario. If you're tempted to write "When X and then I do Y", that's two scenarios — or Y belongs in Given. Keep scenarios independent: no scenario depends on another having run first.

Outside-in: acceptance drives units

The two TDD loops nest:

OUTER (acceptance / this skill)
  write a failing scenario  ──►  RED
        │
        ▼
  INNER (unit TDD — per-language testing skill)
    red → green → refactor, repeatedly, until…
        │
        ▼
  …the scenario passes      ──►  GREEN  →  next scenario

Start from the behavior the user cares about (outer red), then discover the units you need to make it pass (inner red-green-refactor). You implement only what a failing example demands — no speculative code.

Anti-patterns

  • Imperative scenarios — "click button, type 150, press enter". Write intent ("When I withdraw 150"), not UI choreography. Details: writing-scenarios.md.
  • Testing implementation — Then asserts on a database row or private field instead of observable behavior. Assert what the user/caller can see.
  • Conjunction smell — And piling up in When, or a scenario covering several rules at once. Split it.
  • Incidental detail — data in the scenario that isn't relevant to the rule. Every value shown should matter; hide the rest in Background or fixtures.
  • Scenarios no one reads — full Gherkin tooling without a non-developer audience. Then a plain Given/When/Then unit test is the better spec (see rust-testing).

Boundaries

  • Running scenarios (frameworks, step bindings, .feature files) → per-language testing skill: rust-testing (Given/When/Then tests and cucumber). This skill is framework-free.
  • Inner unit-level red-green-refactor mechanics → the same per-language testing skill.
  • Up-front feature exploration/brainstorming that produces the requirement is upstream of this; specs starts once you have a requirement to make concrete.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.