agentleFS
EvilFreelancerEvilFreelancer/zaezd/.cursor/rules/bdd-specs.mdc

zaezd / rules

Cursor rule1 starsChanged 3 months agoMITView on GitHub

Executable Gherkin specifications, layout, style, tags, offline by construction

The file

We split this bdd-specs.mdc into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Business language only: No HTTP verbs, no tool names, no function names, no CSS selectors inside a .feature.

    line 29
  2. Distinctive:

    Keep Gherkin keywords in English.

    line 42
  3. Distinctive:

    No business logic, no date arithmetic, no price arithmetic inside a step.

    line 48
  4. Very specific:

    Run npm run bdd after adding a step to a feature.

    line 54
  5. Very specific:

    Every scenario runs against recorded JSON in fixtures/, never against the live network.

    line 59
  6. Distinctive:

    If a scenario cannot be expressed without the network, the fixture is missing.

    line 66
  7. Very specific:

    Every use case below is specified in features/ and runs offline.

    line 97

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
bdd-specs.mdc
---
description: "Executable Gherkin specifications, layout, style, tags, offline by construction"
alwaysApply: true
---


# Executable Gherkin specifications

`features/` holds the product contract. Every use case is written here in Gherkin
**before** the unit tests and **before** the implementation, and every scenario is
executable: `npm run bdd` runs them all.

## Layout

```
features/
├── <use-case>.feature        # Gherkin, business language
├── steps/<use-case>.steps.ts # thin translation layer, Given/When/Then
└── support/world.ts          # per-scenario state, hooks, fixture loading
```

One `.feature` per use case, named after the user-visible outcome
(`trip-from-topic.feature`, `stay-dates.feature`, `checkout-links.feature`), not after a
module. Step definitions may be shared across features; put reusable steps in the file
whose feature owns them and import nothing between step files.

## How a scenario is written

- **Business language only.** No HTTP verbs, no tool names, no function names, no CSS
  selectors inside a `.feature`. A step describes what a traveller or an agent observes.
  Bad: `When I call search_multitransport with origin Москва`.
  Good: `When the trip is assembled from Москва`.
- **Given** sets up recorded world state, **When** performs exactly one action,
  **Then** asserts one observable outcome. Chain with `And` rather than stuffing two
  actions into one `When`.
- **Scenario Outline** for rule tables. The date algorithm, the feasibility checks and the
  three package rules are naturally tabular and must be specified that way, so the spec
  itself becomes the readable statement of the algorithm.
- **Honesty scenarios are first-class.** Missing venue coordinates, a checkout link that is
  not a cart, an unparsed event price, a source that timed out: each is a specified
  behavior with its own scenario, not an edge case to be discovered later.
- Keep Gherkin keywords in English; the narrative inside a step may name Russian cities and
  events verbatim, because that is the real data.

## Rules for step definitions

- Steps are **thin**: translate the sentence into a call into `src/`, then assert.
  No business logic, no date arithmetic, no price arithmetic inside a step.
- Scenario state lives on the World (`features/support/world.ts`), never in module-level
  variables. Cucumber builds one World per scenario, which is what keeps scenarios isolated.
- Assertions use `node:assert/strict`.
- Ambiguous or duplicate step definitions are a hard error (`strict: true` in
  `cucumber.mjs`). Reuse an existing step instead of writing a near-copy.
- Run `npm run bdd` after adding a step to a feature; Cucumber prints a ready snippet for
  every undefined step (`snippetInterface: 'async-await'`).

## Offline by construction

Every scenario runs against recorded JSON in `fixtures/`, never against the live network.
In `replay` the reference "today" is the fixture's `recorded_at`, so a recorded event never
turns into a past event and reddens the suite on its own.
This is not a preference: confcal and Tutu are slow and rate limited, `checkout_ref` and
`search_id` expire, and the demo must survive the venue network. Live calls belong to
`scripts/record.ts` and to manual smoke runs.

If a scenario cannot be expressed without the network, the fixture is missing. Record it.

## Tags

| Tag | Meaning |
|---|---|
| `@harness` | self-check of the tooling, must always be green |
| `@composer` | deterministic trip assembly |
| `@sources` | normalization of confcal and Tutu payloads |
| `@mcp` | the three outward tools and the `ui://` resource |
| `@web` | the trip board screen |
| `@checkout` | payment links and their honest labels |

## What Gherkin does not cover

Two things belong elsewhere and putting them in a `.feature` breaks the rules above.

**Protocol and process limits.** Cache keys, TTLs, session re-initialization, concurrency
ceilings, `outputSchema` shapes, MIME profiles and byte-for-byte equality are not things a
traveller observes. They are unit and contract tests. The scenario states the observable
consequence instead: the same request answers the same way without touching the source.

**Anything that needs a browser.** Widths, horizontal scroll, keyboard focus, contrast, CSP
and the map are invisible to Cucumber on Node. They are covered by Playwright
in a real browser, and named in the feature only as an outcome the renderer produces.

No `@skip` and no `@wip` in committed specs. A scenario is red only while the task that
introduced it is in progress; a task is not done until every scenario is green.

## The acceptance surface

Every use case below is specified in `features/` and runs offline. The list is the acceptance
surface of the product, derived from `specs/10-proverka.md` and `specs/04-kompozitor.md`.

| Feature file | What it holds |
|---|---|
| `stay-dates.feature` | check-in, check-out, nights, unknown start time |
| `event-selection.feature` | online, origin city, the window, the cap of five |
| `feasibility.feature` | arrival before the opening, departure after the end, unknown times |
| `trip-price.feature` | both legs plus the whole-stay hotel, event price as text, budget |
| `hotel-choice.feature` | ranking by distance, and by price when there is no distance |
| `three-packages.feature` | the three rules and their collapse to fewer cards |
| `checkout-labels.feature`, `checkout-links.feature` | the label a `kind` earns, and the live build |
| `source-payloads.feature`, `source-clients.feature` | normalization, sessions, one call at a time |
| `recorded-sources.feature` | cache keys, equivalent argument shapes, replay |
| `optional-context.feature` | geocoding, walking time, working days, forecast |
| `trip-assembly.feature` | the whole product on recordings, including failing sources |
| `trip-board.feature` | the screen: naming, escaping, stages, the request row |
| `agent-tools.feature` | the three tools, their honesty, the published address |
| `trip-widget.feature` | the `ui://` resource and what travels beside the answer |
| `harness.feature` | the tooling's own self-check |

A behaviour that is not in this table and not in a `.feature` file does not exist. When one is
added, add its row here in the same change.

## References

@workflow.mdc
@testing.mdc
@composer-core.mdc

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.