Logo Bdd

Bdd

Cộng đồng
mcouthon
bdd

Behavior-Driven Development with Gherkin specifications and black-box testing. Use when working with BDD projects, writing feature files, implementing step definitions, or designing acceptance tests around observable behaviors. Triggers on: 'use bdd mode', 'bdd', 'behavior driven', 'gherkin', 'feature file', 'scenario', 'step definitions', 'acceptance test', 'given when then', 'cucumber', 'godog', 'behave', 'specflow'. Full access mode - can write feature files, step definitions, and tests.

Tổng quan

Nhà phát hànhmcouthon
Kho mãagents
Tên kỹ năngbdd
Sao
79
Bản fork
11
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được mcouthon công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Bdd trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/mcouthon/agents/tree/main/generated/claude/skills/bdd
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mcouthon/agents.git /tmp/agents
mkdir -p .claude/skills
cp -r /tmp/agents/generated/claude/skills/bdd .claude/skills/bdd
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Bdd trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Bdd ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Bdd với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

BDD — Behavior-Driven Development

Write executable specifications that describe what the system does, not how it works.

"Scenarios are not tests. They are executable specifications — living documentation of how the system behaves, written in the language of the business."

BDD Project Detection

Proactively load this skill when any of these indicators are present:

IndicatorWhat to Look For
Feature files*.feature files anywhere in the project
Features directoryfeatures/ or specs/ directory at project root
Step definitions*_steps.*, *_test.go with godog imports, steps/*.py
BDD configcucumber.js, cucumber.yml, .specflow/, behave.ini, godog in go.mod
Test runner configBDD-related entries in test configuration or CI pipeline

When detected, apply all guidance below to feature files, step definitions, and related test code.

Feature & Scenario Organization

  • One feature per business capability — login.feature, checkout.feature, not everything.feature
  • Feature title = capability — "User Registration", not "Test the registration endpoint"
  • Scenarios describe user-observable outcomes — what the system does, not how it's coded
  • Keep features focused — 3–8 scenarios per feature; split if growing beyond that
  • Naming convention: lowercase hyphens for filenames (password-reset.feature), Title Case for Feature/Scenario titles
gherkin
# Good — focused feature, outcome-oriented scenarios
Feature: Password Reset
  Users can reset forgotten passwords via email

  Scenario: Successful password reset
    Given a registered user with email "alice@example.com"
    When they request a password reset
    Then a reset link is sent to "alice@example.com"

  Scenario: Reset request for unknown email
    Given no user exists with email "unknown@example.com"
    When they request a password reset for "unknown@example.com"
    Then no email is sent
    And no error is revealed to the requester

Gherkin Best Practices

Declarative Over Imperative

Describe what happens, not how the user clicks through the UI:

gherkin
# BAD — imperative (UI mechanics)
Scenario: User logs in
  Given I am on the login page
  When I fill in "username" with "alice"
  And I fill in "password" with "secret123"
  And I click the "Login" button
  And I wait for the dashboard to load
  Then I should see "Welcome, Alice"

# GOOD — declarative (behavior)
Scenario: Successful login
  Given a registered user "alice"
  When alice logs in with valid credentials
  Then alice sees her dashboard

Given / When / Then Semantics

KeywordMeaningRule
GivenPrecondition — system state before the actionSet up state, never assert
WhenAction — the single thing being testedOne per scenario (use And for multi-step actions)
ThenObservable outcome — what changedAssert only observable results
And/ButContinuation of the previous keywordSame semantics as the keyword it follows

Background for Shared Setup

Use Background when most scenarios share the same preconditions:

gherkin
Feature: Shopping Cart
  Background:
    Given a customer with an active account
    And the product catalog is loaded

  Scenario: Add item to cart
    When the customer adds "Widget" to their cart
    Then the cart contains 1 item

  Scenario: Remove item from cart
    Given the customer has "Widget" in their cart
    When they remove "Widget"
    Then the cart is empty

Scenario Outlines for Data Variations

Use outlines when the same behavior applies across different inputs — never duplicate scenarios:

gherkin
Scenario Outline: Shipping cost by region
  Given a package weighing <weight> kg
  When shipped to <region>
  Then the shipping cost is <cost>

  Examples:
    | weight | region   | cost   |
    | 1      | domestic | $5.00  |
    | 1      | europe   | $15.00 |
    | 5      | domestic | $12.00 |

Black-Box Testing

BDD scenarios test through public interfaces only — the system is a black box:

  • API testing: send requests, assert responses — never query the database directly
  • UI testing: interact through the UI, assert visible state — never check DOM internals
  • Service testing: call public methods, assert return values and observable side effects
  • No internal assertions: never assert database rows, internal state, private methods, or implementation artifacts
  • Mock only at external boundaries: third-party APIs, payment gateways, email services — never mock internal components
gherkin
# BAD — reaches into implementation
Then the database contains a row in "users" with email "alice@example.com"
And the password hash starts with "$2b$"

# GOOD — asserts observable behavior
Then alice can log in with her new password
And a welcome email is received at "alice@example.com"

Step Definitions

Step definitions are thin glue code — they translate Gherkin into application calls:

  • Call application code, don't contain logic — a step definition should be 1–5 lines
  • Reuse steps across features — write generic, parameterized steps
  • Keep step state in a context/world object — not in global variables
  • One action per step — if a step does multiple things, split it or simplify the Gherkin
python
# GOOD — thin glue, delegates to application code
@when('the customer adds "{item}" to their cart')
def add_to_cart(context, item):
    context.response = context.client.post("/cart/items", json={"item": item})

@then('the cart contains {count:d} item(s)')
def check_cart_count(context, count):
    cart = context.client.get("/cart").json()
    assert len(cart["items"]) == count
python
# BAD — logic and DB access in step definition
@when('the customer adds "{item}" to their cart')
def add_to_cart(context, item):
    product = db.query("SELECT * FROM products WHERE name = %s", (item,))
    db.execute("INSERT INTO cart_items ...")  # Direct DB manipulation!
    context.cart_count = db.query("SELECT COUNT(*) FROM cart_items ...")[0]

Anti-Patterns

Anti-PatternProblemBetter Approach
Incidental details — "alice" with password "Str0ng!" at "9:30 AM"Noise hides the behavior under testOnly include details relevant to the outcome
Testing implementation — Then UserService.validate() returns trueCoupled to code structure, breaks on refactorAssert observable outcomes: "Then the user is logged in"
Coupled step defs — steps call each other or share mutable global stateFragile chain; one change breaks many scenariosIndependent steps sharing state through a context object
Scenario as test script — 15 Given/When/Then steps in sequenceUnreadable, tests multiple behaviors at onceOne behavior per scenario, 3–7 steps maximum
UI-coupled steps — "click button", "fill field", "wait for element"Brittle, breaks on any UI changeDeclarative: "When the user submits the form"
Copy-paste scenarios — same steps with different dataMaintenance burden, inconsistent updatesScenario Outlines with Examples tables
Missing Why — Feature with no description, no business contextCan't tell if the feature is still neededAdd 1-line description under Feature explaining business value

Quality Checklist

Before committing feature files and step definitions:

markdown
- [ ] Feature files are readable by non-developers
- [ ] Each scenario tests exactly one behavior
- [ ] Steps are declarative (no UI mechanics or implementation details)
- [ ] No implementation coupling (scenarios survive internal refactors)
- [ ] Step definitions are thin glue (1–5 lines, delegate to app code)
- [ ] Shared state flows through context/world object, not globals
- [ ] Scenario Outlines used for data variations (no copy-paste scenarios)
- [ ] Feature descriptions explain the business value

Rationalization Prevention

ExcuseRealityRequired Action
"We can add scenarios later"Missing scenarios are missing requirementsWrite scenarios before implementation — they ARE the spec
"This is too simple for BDD"Simple behaviors still need documented acceptance criteriaWrite the feature file even if steps are trivial
"I'll just verify through the DB"DB assertions couple tests to implementationAssert through the public API/UI — black-box only
"One big scenario covers more"Long scenarios test multiple behaviors and hide failuresSplit into focused scenarios — one outcome each
"Imperative steps are more precise"They couple to UI/implementation and break on refactorDeclarative steps describe intent, not mechanics
"Step reuse isn't worth the effort"Duplicated steps diverge and create maintenance burdenParameterize and share steps across features from day one

Câu hỏi thường gặp

Kỹ năng AI Bdd làm được gì?

Behavior-Driven Development with Gherkin specifications and black-box testing. Use when working with BDD projects, writing feature files, implementing step definitions, or designing acceptance tests around observable behaviors. Triggers on: 'use bdd mode', 'bdd', 'behavior driven', 'gherkin', 'feature file', 'scenario', 'step definitions', 'acceptance test', 'given when then', 'cucumber', 'godog', 'behave', 'specflow'. Full access mode - can write feature files, step definitions, and tests.

Vì sao nên dùng Bdd trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Bdd là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Bdd trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/mcouthon/agents/tree/main/generated/claude/skills/bdd. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Bdd?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Bdd với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Bdd với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Bdd có miễn phí không?

Có. Kỹ năng này được mcouthon phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇