
Cucumber Sentences
Write and extend Cucumber feature files and page objects using the cucumber-sentences Ruby gem’s shared Gherkin DSL.
Overview
cucumber-sentences is an agent skill for the Ship phase that helps you write Cucumber features and page objects using the cucumber-sentences Ruby gem DSL.
Install
npx skills add https://github.com/donkeycode/skills-cucumber-sentences --skill cucumber-sentencesWhat is this skill?
- ~39 pre-built generic Cucumber step definitions via a single ~500 LOC library file
- Standardizes Gherkin for clicks, fields, and named elements across page-object classes
- Guides when to reuse library sentences versus custom step definitions
- Covers Domain helpers, typed `of <type> "<id>"`, and state holder conventions
- Resolves undefined-step errors by aligning pages with get_button / get_field / get_element_by_name
- Single library file ~500 lines of code (lib/cucumber-sentences.rb)
Adoption & trust: 1 installs on skills.sh; 2/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Your feature files drift into custom steps and broken page lookups, producing undefined steps and duplicated Watir boilerplate.
Who is it for?
Ruby/Watir teams already using or adopting the cucumber-sentences gem for acceptance tests.
Skip if: JavaScript Playwright-only stacks, unit-test-only workflows, or projects with no Cucumber dependency.
When should I use this skill?
Writing or editing Cucumber `.feature` files, page-object classes, or step definitions in a project that depends on the cucumber-sentences Ruby gem; adding scenarios, undefined steps, new pages, or UI elements addressabl
What do I get? / Deliverables
Scenarios reuse the gem’s shared sentences and correctly mapped page objects so new UI elements are feature-addressable without rewriting step glue.
- Updated `.feature` scenarios using shared sentences where appropriate
- Page-object classes with correct element lookup helpers for new UI
Recommended Skills
Journey fit
Acceptance tests and feature files are authored and maintained as part of shipping quality, which Prism places under Ship. The skill targets `.feature` files, step wiring, and page-object lookups—the core of automated acceptance testing.
How it compares
Opinionated gem integration for shared Gherkin steps—not a greenfield BDD framework generator for every language.
Common Questions / FAQ
Who is cucumber-sentences for?
Solo builders and small teams on Ruby Cucumber projects that use page-object and Watir and want the donkeycode sentence library applied correctly.
When should I use cucumber-sentences?
When editing `.feature` files, adding feature-referenceable UI elements, creating pages, extending Domain/state helpers, or fixing undefined steps in a cucumber-sentences-based repo.
Is cucumber-sentences safe to install?
It guides test code against your repo; review the Security Audits panel on this Prism page and pin the gem version you trust in Gemfile.
SKILL.md
READMESKILL.md - Cucumber Sentences
# cucumber-sentences A Ruby gem that ships ~39 pre-built generic Cucumber step definitions on top of `page-object` + `watir` + `rspec-expectations`. The whole library is a single file; once required, every page in the host project speaks the same Gherkin DSL without re-implementing selenium boilerplate. > Source: <https://github.com/donkeycode/cucumber-sentences> · gem name: `cucumber-sentences` · file: `lib/cucumber-sentences.rb` (~500 LOC). --- ## When to invoke this skill Trigger on any of: - A `.feature` file is being created or edited and you must decide whether to **reuse** an existing sentence or write a custom step. - A new button, field, or element on a page must become referenceable from features (`I click on the button "..."`, `I fill "..." field with "..."`, …). - A new page is being introduced — needs a `PageObject`-style class with the `get_button` / `get_field` / `get_element_by_name` lookups wired correctly. - A `Cucumber::Undefined` error or "undefined step" feedback appears — the phrase is probably misspelled relative to the catalogue, or the page lacks a name in its lookup hash. - A request to add a "kind" of object resolvable by name (`I am on the "OrderPage" of order "ABC-123"`) — needs a typed helper class under `support/helpers/`. - A request to share state across steps in the same scenario (an extracted email link, a generated id, …) — needs a session-scoped state holder. --- ## The mental model: phrase → element in five hops Cucumber-sentences is glue, not magic. Every browser-touching phrase follows the same chain. Internalise this before writing or debugging steps. ``` Gherkin string │ ① Cucumber regex match (captures the name) ▼ get_button("save profile") ← method on @current_page (a PageObject) │ ② Hash lookup that you wrote on the page class ▼ save_element ← page-object accessor │ ③ Synthesised by `button(:save, :xpath => "...")` ▼ Watir::Element ← live DOM handle │ ④ Watir verb (when_visible, click, value=, text, …) ▼ Browser action ← what actually happens ``` | Phrase family | Resolver method called on `@current_page` | | --- | --- | | `... button "<name>" ...` (click, see, not see, see disabled) | `get_button(name)` | | `... field "<name>" ...`, `I fill "<name>" {field\|autocomplete\|datepicker\|contenteditable} with ...`, `I can see "..." in input "<name>"`, `I should not see the field "<name>"` | `get_field(name)` | | `I should not see the element "<name>"`, `I can [not] see "..." in element "<name>"`, `I scroll to "<name>"`, `I hover over the element "<name>"`, `I should see the element "<name>"` | `get_element_by_name(name)` | | `I fill "<name>" ckeditor field with "..."`, `I can see "..." in ckeditor "<name>"` | `get_ckeditor(name)` | | `I fill "<name>" js field with "..."`, `I force scroll to "<name>"` | `get_js_selector(name)` | | `I upload a file with the filename "..." in element "<name>"` | `get_field(name)` (Watir treats file inputs as fields) | The **layered indirection** — Gherkin name → `get_X` hash → page-object accessor → Watir handle — is deliberate: - Gherkin names track product copy, not markup. - `get_X` hashes localise renames in a single file. - Page-object declarations isolate locator strategy (xpath/id/css). - Watir is the only stable thing the gem talks to. **Adding a new button to a feature does not require a new step.** Extend the page's locator block + the `get_button` hash, and the existin