agentleFS
pantheon-orgpantheon-org/tekhne/skills/testing/bdd-testing/SKILL.md

bdd-testing

Skill10 starsChanged 54 days agoMITView on GitHub

Write and maintain Behavior-Driven Development tests with Gherkin and Cucumber. Use when defining acceptance scenarios, writing feature files, implementing step definitions, running Three Amigos sessions, or diagnosing BDD test quality issues. Keywords: bdd, gherkin, cucumber, given when then, feature files, step definitions, acceptance criteria, three amigos, example mapping.

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 10 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when behavior needs to be specified and validated in shared, business-readable scenarios.

    line 10
  2. Distinctive:

    Do not use BDD feature files for low-level unit behavior that is internal and not stakeholder-facing.

    line 14
  3. Distinctive:

    Keep a shared language across product, engineering, and QA.

    line 19
  4. Very specific:

    Write scenarios in Gherkin using Given/When/Then.

    line 26
  5. Distinctive:

    Validation checkpoint: If scenarios fail due to incorrect business logic, loop back to step 2 to clarify requirements.

    line 29
  6. Distinctive:

    Validation checkpoint: If scenarios fail due to step definition errors or missing steps, loop back to step 3 to fix implementation.

    line 30
  7. Very specific:

    Error recovery: Run npx cucumber-js --dry-run to identify missing step definitions before full execution.

    line 31
  8. Distinctive:

    Check that step definitions return or await promises.

    line 81
  9. Very specific:

    Pattern: Ensure async functions use await for all asynchronous calls.

    line 83
  10. Distinctive:

    Use business-facing language in feature files.

    line 97
  11. Distinctive:

    Keep each scenario focused on one behavior.

    line 98
  12. Distinctive:

    Avoid cross-scenario state coupling.

    line 99
  13. Distinctive:

    Prefer explicit examples over abstract wording.

    line 104

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

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

BDD Testing

When to Use

Use this skill when behavior needs to be specified and validated in shared, business-readable scenarios.

When Not to Use

Do not use BDD feature files for low-level unit behavior that is internal and not stakeholder-facing.

Core Principles

  1. Specify observable behavior, not implementation details.
  2. Keep a shared language across product, engineering, and QA.
  3. Scenarios should be deterministic and independently executable.
  4. Feature files should remain readable by non-developers.

Deterministic Workflow

  1. Align on examples in a Three Amigos discussion.
  2. Write scenarios in Gherkin using Given/When/Then.
  3. Implement step definitions that map to business language.
  4. Execute Cucumber and review failures by scenario intent.
    • Validation checkpoint: If scenarios fail due to incorrect business logic, loop back to step 2 to clarify requirements.
    • Validation checkpoint: If scenarios fail due to step definition errors or missing steps, loop back to step 3 to fix implementation.
    • Error recovery: Run npx cucumber-js --dry-run to identify missing step definitions before full execution.
    • Error recovery: For async timing issues, verify step definitions properly await promises.
  5. Refactor scenarios and steps to remove duplication.

Quick Commands

Run all feature tests

npx cucumber-js features

Expected result: scenario pass/fail summary and non-zero exit on failures.

Dry-run to detect missing step definitions

npx cucumber-js --dry-run features

Expected result: undefined steps listed without full execution.

Run a tagged subset

npx cucumber-js --tags "@smoke and not @wip"

Expected result: only matching scenarios execute.

Generate JSON report

npx cucumber-js --format json:reports/cucumber-report.json

Expected result: machine-readable execution report for CI/reporting.

Troubleshoot common Cucumber failures

Step definition mismatch:

npx cucumber-js --dry-run features

Expected result: lists undefined steps that need implementation or have mismatched patterns.

Async timing issues:

Check that step definitions return or await promises. Steps that don't wait for async operations will complete before actions finish.

Pattern: Ensure async functions use await for all asynchronous calls.

Evaluate this skill quality

pantheon-skill-auditor evaluate bdd-testing --json

Expected result: updated quality dimensions and grade.

Constraints

Hard Constraints

  • Use business-facing language in feature files.
  • Keep each scenario focused on one behavior.
  • Avoid cross-scenario state coupling.

Soft Constraints

  • Scenario count per feature should stay manageable.
  • Prefer explicit examples over abstract wording.
  • Reuse step phrases only when semantics are identical.

Anti-Patterns

NEVER encode implementation details in Gherkin steps

WHY: Implementation-centric steps break when internals change.

BAD: When I click the submit button and call validateForm() GOOD: When I submit the form

Consequence: Scenarios become brittle and unreadable to stakeholders.

NEVER skip Three Amigos before writing key scenarios

WHY: Missing perspectives create ambiguous or incomplete acceptance behavior.

BAD: Engineering writes scenarios alone from assumptions. GOOD: Product, QA, and engineering align on examples first.

Consequence: Rework increases and acceptance disputes appear late.

NEVER use vague Then steps without observable outcomes

WHY: Unverifiable outcomes cannot fail meaningfully.

BAD: Then it should work correctly GOOD: Then I should see "Order confirmed"

Consequence: Tests pass without validating user-visible behavior.

NEVER couple scenarios with ordering dependencies

WHY: Scenario order dependence creates flaky suites.

BAD: Scenario B assumes data created by scenario A. GOOD: Each scenario creates or mocks its own prerequisites.

Consequence: Parallel runs and CI become unstable.

References

  • references/principles-core-philosophy.md
  • references/gherkin-syntax.md
  • references/principles-three-amigos.md
  • references/principles-example-mapping.md
  • references/cucumber-setup.md

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.