本文へ移動
cccskills
無料GitHub で公開

bdd

Write disciplined Behavior-Driven Development specs and tests with Gherkin / Cucumber. Use whenever the user mentions BDD, Gherkin, Cucumber, .feature files, Given/When/Then, scenarios, Scenario Outline, Background, step definitions, acceptance criteria, executable specifications, living documentation, the Three Amigos, or Example Mapping. Also trigger when the user asks to "write tests in plain English", convert acceptance criteria into tests, design step definitions, refactor an imperative or UI-coupled feature file, or wire up BDD with Vitest (unit/component) or Playwright (end-to-end). Do NOT use for pure unit tests with no business-readable contract, pure performance/load tests, or generic test-framework questions unrelated to behavior specs.

日本語の概要は準備中です。原文の説明を表示しています。

連携ツールPlaywright
インストール方法を見る

含まれるファイル(10)

  • SKILL.md8.8 KB
  • bdd.skill24.8 KB
  • evals/checks/playwright-bdd.sh1.3 KB
  • evals/checks/vitest-cucumber.sh1.9 KB
  • evals/evals.json24.1 KB
  • evals/trigger-eval.json5.2 KB
  • references/install-playwright.md13.1 KB
  • references/install-vitest.md9.4 KB
  • references/playwright.md16.0 KB
  • references/vitest.md16.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Behavior-Driven Development (BDD)

Produces feature files that read like behavior, step definitions that don't leak implementation, and an honest call on when BDD pays for itself. The body is tool-agnostic — load the relevant reference for Vitest or Playwright.

When to use this skill

  • The user names a BDD concept: BDD, Gherkin, Cucumber, .feature, Given/When/Then, Scenario Outline, Background, Rule, step definitions, executable specifications, living documentation, Three Amigos, Example Mapping.
  • The user wants to turn acceptance criteria into tests, write tests in plain English, or refactor a .feature file.
  • Vitest + BDD → also load references/vitest.md. Playwright + BDD → also load references/playwright.md.
  • Setting up either from zero → load references/install-vitest.md or references/install-playwright.md.

Skip for: unit tests with no business audience, performance/load tests, internal refactors, or generic test-framework questions.

Gherkin cheat sheet

@checkout                             # tag (selection + tagged hooks)
Feature: Guest checkout
  As a visitor                         # free-form preamble (not executable)
  ...
  Background:                          # Given steps run before every Scenario in this file
    Given the storefront is online

  Rule: Tax is applied per region      # Gherkin 6 — groups scenarios by business rule
    @smoke
    Scenario Outline: Tax for <region>
      When  Patty adds a "Bluetooth Speaker" to her cart
      And   she checks out shipping to "<region>"
      Then  the displayed tax rate is "<rate>"

      Examples:
        | region          | rate |
        | California, US  | 8.5% |
        | Berlin, DE      | 19%  |
KeywordUse forDon't use for
Rule: (Gherkin 6+)Group scenarios that illustrate one business rule.A feature with only one rule.
Background:Given steps shared by every scenario in the file/Rule.Anything containing a When.
Scenario: / Example:One behavior. Example: preferred in Gherkin 6+.Multiple outcomes glued by And.
Scenario Outline: + Examples:Same steps, varied by business-meaningful data with domain-named columns.Exhaustive boundary testing; rows with technical column names like pw/result.
Given / When / ThenContext / action / observable outcome.More than one When per scenario.
@tagSelective execution, tagged hooks.Control flow / if on tags inside steps.

The three rules that move output quality

These are the patterns that distinguish disciplined BDD from "Gherkin-shaped" output. Each is what the model gets wrong by default if you don't insist.

1. Declarative + third-person voice

Steps describe what the system does, not how the user clicks. Voice is third-person/persona (she, Patty, a shopper) — never first-person I. Litmus test: would this wording change if the implementation changed? If yes, rewrite.

# ❌ Wrong — imperative, UI-coupled, first-person; breaks on a CSS rename
Scenario: User registers
  Given I navigate to "/signup"
  When  I enter "jane@acme.com" in the "#email" field
  And   I click the "Create account" button
  Then  the URL should be "/welcome"

# ✅ Right — declarative, third-person, survives UI rewrite
Scenario: A new visitor completes registration
  Given Jane is a new visitor
  When  she registers with a valid email and password
  Then  she is signed in

2. One behavior per scenario; Rule: to group

Multiple Whens usually mean two scenarios pretending to be one. Split them; use Rule: to make the policy structure explicit. The first-line test: if you'd write a scenario title containing "and", split it.

# ❌ Wrong — three orthogonal outcomes; one failure can't tell you which rule broke
Scenario: Checkout
  Given Patty has a cart with a $40 item
  When  she applies the coupon "SAVE10"
  And   she pays with her saved Visa
  Then  the order total is $36
  And   a confirmation email is sent
  And   the inventory count drops by 1

# ✅ Right — each rule gets its own scenario under a Rule: block
Rule: Coupons apply before payment
  Example: A valid coupon reduces the order total
    Given Patty has a cart with a $40 item
    When  she applies the coupon "SAVE10"
    Then  her order total is $36

Rule: Successful checkout notifies customer and warehouse
  Example: Confirmation email is sent on successful payment
    Given Patty has a paid order
    Then  she receives a confirmation email

3. Scenario Outline columns are domain-named, not technical

Use Outline when the steps are identical and each row is a business-meaningful variation. Column headers are domain concepts (missing requirement, region), not literal values dressed up (pw, result). When the table starts looking like fuzz-test input, push it to a unit test.

# ❌ Wrong — Outline as unit-test substitute; columns are technical
Scenario Outline: Password validation
  When I submit the password "<pw>"
  Then the result is "<result>"

  Examples:
    | pw         | result  |
    | a          | invalid |
    | Aaaaaaa1!  | valid   |
    | ...20 rows | ...     |

# ✅ Right — domain-named column; exhaustive cases go to a unit test
Rule: Passwords must satisfy the corporate strength policy
  Scenario Outline: Sign-up rejects a password that is <missing requirement>
    Given Jane is signing up
    When  she submits a password that is <missing requirement>
    Then  sign-up is rejected with a message about <missing requirement>

    Examples: Strength policy violations
      | missing requirement   |
      | too short             |
      | missing an uppercase  |
      | missing a digit       |
      | missing a symbol      |

Output contract

When generating BDD code:

  • Feature files: declarative, domain-language, third-person voice. No CSS selectors, no URLs, no UI verbs.
  • One behavior per scenario. Rule: to group; Example: preferred over Scenario: in Gherkin 6+.
  • Scenario Outline columns are domain-named. No pw/result-style technical columns.
  • State lives in the World / context / fixtures (per scenario), never module globals or file-level let.
  • Assertions only in Then. Setup in Given; the single state change in When.
  • Tags for selection (@smoke, @regression, @wip), not for control flow.
  • No external data files (CSV/Excel). Examples live in the feature file.

Reference quick map

TaskRead
BDD/Gherkin principles, refactoring scenariosthis SKILL.md
Install Vitest BDD in a project from zeroreferences/install-vitest.md
Vitest + Gherkin (@amiceli/vitest-cucumber) — writing testsreferences/vitest.md
Install Playwright BDD in a project from zeroreferences/install-playwright.md
Playwright + Gherkin (playwright-bdd) — writing testsreferences/playwright.md

If the user names a different runner (Cucumber-JVM, Cucumber.js, behave, SpecFlow), the principles in this file still apply — only the binding API differs. Translate the patterns rather than refusing.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Run a structured bug-focused code review for selected files, folders, or the whole workspace.

日本語の概要は準備中です。原文の説明を表示しています。

danielsogl/copilot-workflow-demo392026年10月22日 更新

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, services, or HTTP communication, or for best practices on reactivity (signals, linkedSignal, resource, httpResource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, naming conventions, or CLI tooling.

日本語の概要は準備中です。原文の説明を表示しています。

danielsogl/copilot-workflow-demo392026年10月22日 更新

Generate an Angular Signal Forms component with schema validation and dynamic field management for a given entity.

日本語の概要は準備中です。原文の説明を表示しています。

danielsogl/copilot-workflow-demo392026年10月22日 更新

Build, refactor, and architect Angular state with the @ngrx/signals Signal Store. Use whenever the user mentions signalStore, withState, withMethods, withComputed, withHooks, withLinkedState, withFeature, signalStoreFeature, withEntities, rxMethod, signalMethod, patchState, the SignalStore events plugin (withReducer, withEventHandlers), or wants to refactor BehaviorSubject/service-based state to Signal Store. Also use for designing custom store features, request status, optimistic updates, entity collections, and the store/service split in Angular. Do NOT use for @ngrx/store (classic Redux), createReducer/createEffect, or generic RxJS questions unrelated to Signal Store.

日本語の概要は準備中です。原文の説明を表示しています。

danielsogl/copilot-workflow-demo392026年10月22日 更新

Generate an NgRx Signal Store with complete CRUD operations (API service, store, tests) for a given entity.

日本語の概要は準備中です。原文の説明を表示しています。

danielsogl/copilot-workflow-demo392026年10月22日 更新

Review the current branch against its base branch: lint, tests, architecture and Angular 22 conventions, reported by severity.

日本語の概要は準備中です。原文の説明を表示しています。

danielsogl/copilot-workflow-demo392026年10月22日 更新

danielsogl のスキルをすべて見る

このスキルの問題を報告する