bdd-answer
Answer a "how do I …" question about the platform with a Gherkin scenario on @datagrok-libraries/bdd that is filmed into a how-to video (grok-bdd guide), so the answer is demonstrated, sent as a video
SKILL.md.claude/skills/bdd-answer/SKILL.md
GitHubAnswering a question with a filmed scenario
The answer to "how do I open a CSV from my computer?" is a scenario: the steps a person takes, in the vocabulary the bdd library already has, run against the stand and filmed. What goes back to the person is the video (or GIF) and the numbered steps with pictures; what stays is the feature, which the suite runs from then on — an answer that stops being true fails a test.
Rules: the vocabulary first (npx grok-bdd list-steps in the package's bdd/); a phrase the
library lacks is added as a binding or as a name/signal in the core, exactly as for a test
(public/libraries/bdd/CLAUDE.md); demo data only (demog, the package's fixtures/), never a
customer's file; nothing is committed without the lead's order. A question that needs a feature
the platform does not have is not a guide: say so, with what the closest scenario shows, and stop.
What a guide shows, and what the runtime guarantees (grok-bdd guide sets it up, nothing to pass):
- The full shell. A guide runs with simple mode off — the menus, view tabs and panels as a
person has them. A test page runs in simple mode; a guide never does, filmed or in a plain
grok-bdd run: its second step isAnd simple mode is off, right afterGiven user is logged in(the compiler refuses a@guidefeature without it). The step is silent, not in the video. - Every step a person would take is a UI step, filmed as a gesture: a
Whennames the element to click, hover, drag or type into, and the pointer goes there. An API step is only for what the person already has when they ask (the open tables); a view switch is a click on the view's tab (user clicks on spgi-100 tab), which the full shell shows. Opening the tables IS in the video: eachGiven user opens X datasetshows the table it opened under its caption. Only the login and a step that changed nothing on the page are left out (a help GIF leaves out everyGiven: section 4). - A menu path is shown stop by stop: the group in the bar lights and opens, then each item on
the way, then the leaf; the same for a context menu. A walk that lights only the bar means a
runtime path did not report its stops: it calls
guide.hopfor each, aspickTopMenuandpickMenuPathdo — fix the runtime, not the feature. - A choice is shown being made: a native select is pressed and its list opens with the current
option lit (the page draws the list: headless Chromium paints no open popup into its pictures), the
option lights as the pointer reaches it and is pressed; a column selector opens its picker, the name
is typed into its search short of its last letter (a complete unique name is taken on the spot) and
the row it leaves is clicked. Tests take
selectOption, and type the name and press Enter; only a guide walks the list (selectNative,typeInColumnGridinsrc/runtime/gestures.ts). - A control that shows only under the pointer is hovered in a step of its own. A filter panel's
+, a filter card's search icon and a viewer's title-bar icons appear only while the pointer is over
their panel (a guide films without the test styles that keep them shown). A step's first picture is
taken before its gestures, so a hover inside the clicking step never shows the control and the
press lands on empty space: write
When user hovers over filter panelbeforeuser adds a card for …,user hovers over scatter plot viewerbeforeuser clicks on settings icon of scatter plot viewer. A click on such an icon with no hover before it fails ("present, none visible"). - Text goes into a box the reader has seen clicked. When another gesture left the focus in the box (a card's search icon opens and focuses its search), click into the box in a step of its own before typing or pasting, so the video shows where the text goes.
- The pointer rests on the lit element before every click; only an icon-sized target (28 px or less each way) is zoomed into. The caption sits above the page, clear of a player's timeline.
- Every press is marked where it landed, under the pointer's tip: a yellow dot and ring for the left button, a green one for the right, twice for a double-click. The place is the one the page received — every real press, release and move is logged in the page, whatever sent it (a locator's own click, the page's mouse, a drag) — never the centre of the element the step named.
- The pointer never skips: each movement starts where the previous action ended. The renderer
carries the pointer from frame to frame, through drags and menu stops, and refuses to make a
video in which it skips ("the pointer skipped N px") — a skip is a renderer bug to fix, never a
frame to accept. Since every move shows, a gesture that sends the pointer across the screen for
a test's sake (to the page's corner, to clear a hover) steps aside nearby in a guide instead
(
besidePickeringestures.ts). - Only what a person would look for is in the video. A
Thenshows when it names something on the page — a dialog, a column, a row count, a value, a legend item's color. The checks a test needs and a person does not are filmed out by theHIDDEN_CHECKSpatterns insrc/runtime/guide.ts: error and balloon floors, server state, viewer readings and pixels, "than before" claims, property bags, widget counts, task-bar and command bookkeeping, values matched against a regular expression (a guide names a new column exactly, not by a pattern). Keep them in the feature (they are the test); a new kind of bookkeeping check goes into that list. - Set-up a person never does is not filmed: a pinned setting (
the molecule sketcher is …) and a package's readiness wait are silent (silentfrom@datagrok-libraries/bdd/runtimefor a package's own step), and a wait is written as aThen(… should have finished updating), not anAndunder aWhen, or it is filmed as an action.
1. Find or write the scenario
- Pick the package that owns the area (Browse, spaces, users →
packages/UsageAnalysis/bdd; a viewer → the same, underfeatures/viewers/; Bio, Chem, DiffStudio → their ownbdd/). - Grep
features/for a scenario that already does it — a test scenario often is the answer, only written for a checker rather than a reader. Prefer filming it as it is. - Otherwise write
features/guides/<slug>.feature: tag@guide(and@help:<page dir>when it illustrates a help page underhelp/), a description that quotes the question, one scenario of 5–12 steps. EveryWhennames the element a person would click, in the order they would; aThenafter the decisive step shows the result. Step text is the caption of the video (user clicks on X inside Y→ "Click on X in Y"), so it is written for the person asking; where a step must stay precise for the test (an atom's index, a drag in pixels, a reading), a# caption: <text>comment on the line right above it is what the video says instead ("Click the acid's carbon"), and a check captioned so is shown even whenHIDDEN_CHECKSwould leave it out. A guide about one widget (a sketcher) starts with it open from a silent set-up step that frames the video to it (guideFrame). npx grok-bdd compilethennpx grok-bdd run generated/guides/<slug>.test.tsuntil green; a step that needs a wait or a pixel is a missing signal in the core, not asleep.
2. Film it
cd public/packages/<Pkg>/bdd
MSYS_NO_PATHCONV=1 npx grok-bdd guide features/guides/<slug>.feature [--gif]
Watch guides/<feature slug>/<scenario slug>/guide.mp4/gif once, and open audit.png beside it:
every press as the video shows it, next to the same picture with magenta ticks aimed at where the
press landed. The dot, the ring and the pointer's tip sit between the ticks, on the element the
step lit; the renderer measures both (audit.json: mark_off, tip_off in video pixels, and
prints any press more than 2 px off or outside the lit element). What to fix and where:
- the pointer goes to the wrong place → the step located a scope, not the element: make the
phrase name the element (
"Open local file" icon inside browse toolbar), or add the name to the core; - a press is
NOT ON THE LIT ELEMENTinaudit.png→ the step lit one element and pressed another (a stale box, a scope): the same fix — the element the gesture presses is the one it names; - a dialog or balloon is missing from the "after" picture →
--settle 1000; - a step reads badly in the caption → reword the step; a verb the caption leaves in the third
person goes into the
VERBSmap ofsrc/runtime/guide.ts; - a step is missing from the video → it changed nothing on the page (a listener, a server-side check) and touched nothing; a step that opens a table or a panel is shown by itself;
- a menu step jumps from the closed menu to the result → the runtime path it went through does
not report its stops (
guide.hop); a step that went through the API where a person clicks → find or add the named element and make it aWhen(a view switch isuser clicks on X tab). - a test feature filmed as a guide fails on a context-panel section or a viewer reading → the full shell is not the simple one the test was written in; film a guide feature instead.
Typing shows as it goes in, a drag in several pictures, a wheel turn notch by notch, and a step ends on
a cut to its result. A window narrower than the 1600 px video (BDD_GUIDE_VIEWPORT) is filmed at twice
its density. With --gif the run also writes guide-thumb.png (the result) and guide-sheet.png
(twelve frames of the GIF, for a review at a glance); --fps, --colors, --size and --hold set
the GIF's rate, palette, width and last-frame hold. The command fails on a press drawn away from the
pointer — a rendering error to fix, not a take to send.
3. Send it, and keep it
- Reply with
guide.mp4(orguide.gifwhere a video does not embed) and the body ofsteps.md, whose pictures are thestep-NN.pngnext to it. - Add a line to the package's
bdd/features/guides/INDEX.md: the question, the feature, the date, the help page it illustrates if any. Create the file with a one-line header if absent. - Leave the feature and its generated spec uncommitted for the lead, with the list of core or library changes it needed.
4. Help GIFs
A help page shows a GIF about 800 px wide, beside the steps it illustrates (the write-help skill
decides where one goes). The GIF is a guide feature filmed in help mode: an 800×500 window at twice
its density (a 1600×1000 GIF, 256 colours, 12 fps), the bare shell (no sidebar, Browse, Toolbox,
Context Panel or Help unless a step opens one), the page as a person sees it, no title card, caption
strip or dimming, no zoom, and no set-up — every Given is left out, and the GIF starts a second
before the first action and holds its result two seconds.
- Write the feature in
features/guides/of the package that owns the area, tagged@guide @help:<page dir>(the dir underhelp/), named by what it shows:- one action and its result; set, then undone where the flow allows (a filter applied and reset, a column hidden and shown), ending where it started so the loop does not jump;
- cause before effect: nothing changes on screen before the gesture that changes it;
- demo data the reader can open (
demog, a package's sample table) — no fixture with{run}or{time}in a name the GIF shows; - the whole viewer in the window, the grid only when the result is in the data (a selection, a filter) with the status bar's Selected and Filtered in view;
- settings changed from the viewer's own context menu where it has one; a step that looks broken on video is left out of the feature rather than filmed. A replaced GIF repeats the scenario of the one it replaces: watch the old one frame by frame first.
- Check it on the local stand:
npx grok-bdd run generated/guides/<slug>.test.ts, thennpx grok-bdd guide features/guides/<slug>.feature --help-modeand reviewguide-sheet.png,guide-thumb.pngand single frames at 800 px: nothing cut off, labels readable, cause before effect. - Film it on the stand the help is reviewed on:
npx grok-bdd guide --help-pagesfilms every@help:feature of the package and puts each<scenario slug>.gifand-thumb.pngintohelp/<page dir>/img/. A GIF the page already has is not overwritten: the new one is<slug>.new.gif, swapped in after the reviewer approves it; the old file goes only when nothing else references it.helpis the datagrok-ai/help repository: the GIFs are committed there, the feature topublic. - Leave the stand as it was. What a feature makes goes at feature end (the library's rule), and a
killed run's leftovers are swept by the fixture's own name family — so on a shared stand a fixture
carries a name no person would use (the
BDD-prefix). A step never saves a shared setting (stop before Save and apply).
5. Demo clips
A demo shows off what a feature can do, for a showcase video cut together from several clips: not a
how-to, so no caption names each click and nothing a viewer would not want to watch is in it. A demo is
a guide feature tagged @guide @demo, in features/demos/ of the package that owns the area, one
scenario per clip, filmed with the same grok-bdd guide <feature> (the tag films it as a demo;
--demo films any guide so). What the runtime and the renderer do for it:
- A 1920×1080 video at 30 fps, every clip, whatever its window — so clips cut together. The window is
1600×900 filmed at twice its density, the page 1.2× larger than on a 1080p screen;
@viewport:<w>x<h>on the feature picks another:1920x1080for a wide layout of many viewers,1440x810(1.33×) or1280x720(1.5×) for a close-up (a monomer highlight, a small dialog). Keep it 16:9. - A title card over the first page, blurred: the feature's name small above, the scenario's name, and
the scenario's own description (the text under
Scenario:; else the feature description's first paragraph), all wrapped, never cut, about three seconds (2.4–3.6 s by its words). Write the description as one or two sentences, 25 words at most. - The shell with its sidebar only: no Browse, Toolbox or Context Panel unless a step opens one, no unread-notification count, no Home widgets (Home is its search bar alone), no recently used viewers in Add Viewer, no grid column tooltips, and no info balloons on film (they stay on the page for the checks; warnings and errors are filmed).
- No caption strip, dimming or zoom; every press still marked, and a key the step presses (Escape) or holds through a click (Shift) shown as a key cap. A slightly quicker pace than a guide, but a menu's items are read as the pointer walks them, each group opening as the pointer reaches it and the leaf lit before the press; after each step the video rests as long as its change takes to take in (a ticked checkbox hardly at all, a new view the longest, a tooltip long enough to read, a dialog long enough to read its inputs), and the last page holds two seconds.
- Off camera: every
Given(and theAnds after it) — wherever it stands in the scenario — and every check (Then) the feature did not caption. Write the set-up a person never watches asGivensteps in the middle of the scenario where it is needed:Given the "HELM" column of the grid is 600 px wide,And the rows of the grid are 90 px tall,And the grid shows only the columns "a, b",And the toolbox pane is hidden,And the context panel is closed,And the notification balloons are closed. A dialog the clip has already walked through once runs again asGivensteps too. What an action leads to is shown as the page the steps after it settled on: an analysis that computes for seconds is cut to finished, its checks and the column sizing after it included — the page as the action left it (a file opened raw, a viewer docked before the set-up moved it) is never shown. So set-up that changes the page (another table, a dialog run again) follows a note: a hover before it keeps its tooltip, the tooltip goes down before the set-up, and the note shows the page the set-up leads to. - Text only where it explains:
When the video says "Mutation cliffs: one substitution, a large jump in activity"puts a line over the page for as long as it takes to read, over the steps that follow — at the bottom or the top, wherever it covers least of what the step before it and the steps it is read over act on, point at and change;When the video says "…" at the top(orat the bottom) pins it where the clip needs it. A note ends when a step brings another view. A# caption:on a step does the same from that step. A clip with no note at all is fine; one note per idea, under ten words where possible. - Review:
review-sheet.png(the last frame of every step, its start and length) andtimeline.jsonnext toguide.mp4. Read both, then single frames (ffmpeg -ss <t> -i guide.mp4 -frames:v 1 x.png) at the moments that matter: a tooltip that must show, a result after a long computation, the end. - A quiet stand: nothing is published to it while clips are filmed. A package publish shows "<Pkg> installed. Reload page" in every open page, and the clip filmed then carries it.
- The reel:
py public/libraries/bdd/tool/guide-render.py --reel <out.mp4> <clip dir>…(python3off Windows) cuts the clips together in the order given, a clip dir being theguides/<feature slug>/<scenario slug>/foldergrok-bdd guideprinted; each clip is also copied beside the reel asNN - <scenario>.mp4, and<out>.mdlists them with where each starts. The set is listed in that order infeatures/demos/INDEX.mdof the package that owns it (Bio's: the bioinformatics showcase, from four packages).
What makes a good clip: one idea, 20–90 s; the data opened off camera unless opening it is the point (a
file format: open the files from Browse); the window arranged off camera so the sequences and results are
large; a tooltip on the monomer that matters (user hovers over monomer 12 of the "cell 2 of sequence" area of grid, Bio's step); a dialog walked through quickly and only through the choices that matter; the
last frame showing the result. The clips of a set share their feature-name prefix, so their cards match.