shakacode/react_on_rails/discover-abtests
Claude Code and agent skill by shakacode/react_on_rails
- community
Checking that the SKILL.md file is still in the repository.
Crawl a website and auto-generate .abtest.ts files for shaka-perf visreg visual regression testing. Use this skill whenever the user wants to discover, generate, or scaffold AB tests for a URL — even if they just say "set up tests for localhost:3020", "generate tests for this site", or "create visreg tests".
Install
npx vskill@latest install shakacode/react_on_rails/discover-abtestsSKILL.md
The same SKILL.md was published earlier as shakacode/react_on_rails/discover-abtests.
discover-abtests
Crawl a target site in Chrome, probe pages interactively to understand their behavior, then generate validated .abtest.ts files for shaka-perf visreg.
The goal is to produce tests that _actually work_ — not just syntactically valid files. That's why each page is probed in the browser before writing any code: it avoids generating tests for interactions that don't exist, CSS overrides that don't work, or skeleton waits for elements that never appear.
Bundled resources
The browser-side scripts and report parser ship inside the shaka-perf CLI — invoke them via shaka-perf discover-abtests <subcommand> rather than reading files from this directory.
| Command | When to use | |
|---|---|---|
shaka-perf discover-abtests extract-links | Prints JS source — capture stdout and pass to javascript_tool to collect internal links from any page | |
shaka-perf discover-abtests probe-lazy-load | Prints JS source — capture stdout and pass to javascript_tool to test whether scrolling triggers new content | |
shaka-perf discover-abtests probe-sections | Prints JS source — capture stdout and pass to javascript_tool on tall pages (>2000px) to score candidate CSS selectors | |
shaka-perf discover-abtests parse-report [path] | Run after compare to summarize pass/fail, diff %, whitespace metrics, and engine errors (defaults to visreg_data/html_report/report.json) | |
references/patterns.md | Read when writing .abtest.ts files — contains code patterns and selector strategy | |
references/api.md | Read when you need the full abTest() config API or helpers reference |
Read the reference docs as needed rather than trying to keep the full details in mind. The patterns and API reference are too detailed to hold mentally — just load them.
Inputs
Parse from the user's message:
- URL — required (normalize bare domains like
printivity.com→http://printivity.com) - depth — default
2. Depth 1 = starting page only; depth 2 = starting page + linked pages; depth 3 = one more level out - output directory — default
./ab-tests/ - concurrency — default
4. Number of browser tabs for parallel link extraction in Phase 1. - mode — default
twin-server. Controls how tests run: twin-server— compares control (e.g.localhost:3020) vs experiment (e.g.localhost:3030)single-server— both--controlURLand--experimentURLset to the same URL; validates test structure without a real A/B pair
If no URL was provided, ask for it before proceeding.
Phase 1: Crawl (links only)
Load mcp__claude-in-chrome__tabs_context_mcp first to get a tab, then navigate to the URL.
This phase ONLY extracts links — no probing, no testing. The goal is to build a list of pages to process.
Maintain throughout:
visited: set of paths already link-extractedqueue:[{ path, depth }], initialized with[{ path: '/', depth: 1 }]pageList: ordered list of unique paths to process in Phase 2
Process the queue in BFS order, up to `concurrency` pages in parallel:
- Dequeue up to
concurrencyentries not yet visited. - Open each in its own tab (
tabs_create_mcpfor tabs 2–N; reuse existing for first). - For each: navigate, mark visited, capture
shaka-perf discover-abtests extract-linksand pass its stdout tojavascript_tool. Ifdepth < crawlDepth, enqueue new paths as{ path, depth: depth + 1 }. - Close extra tabs after each batch.
Hard limits: max 40 unique paths.
Skip only these:
- External URLs (different hostname)
- Non-page paths:
tel:,mailto:, anchors-only (#section) - Admin panels (e.g.
/admin— but go to/loginnormally) - Auth callbacks (
/auth/callback,/oauth) - API routes (
/api/,.jsonendpoints) - Paginated duplicates (
/products?page=2when/productsis already queued) - Pages that require authentication — check by navigating; if it redirects to login, skip
Do not skip pages just because they seem "boring" or static.
Phase 2: Per-page loop
Process pages from pageList one at a time, sequentially. For each page, complete all five steps (A → B → C → D → E) before moving to the next page.
Maintain across pages:
claimedSections: map ofselector → path— when a section appears on multiple pages, only the first page to claim it gets a test for itknownLoadingSelectors: set of CSS selectors for spinners/skeletons/loading indicators discovered on any page so far. Grows as new ones are found.
Step A — Probe the page
Navigate to the page in Chrome. Complete all probing steps _in sequence_ before writing any code.
A1. Check for lazy-loaded content (always, every page): Capture shaka-perf discover-abtests probe-lazy-load and pass its stdout to javascript_tool. Wait for networkidle first — probing during an in-flight API call gives false results. Then scroll incrementally using real mouse scroll actions (not window.scrollTo in JS) — IntersectionObserver-based lazy loaders only fire on genuine scroll events. Scroll 10 ticks at a time via mcp__claude-in-chrome__scroll, wait 500ms between each, until window.scrollY + window.innerHeight >= document.body.scrollHeight. Wait 2 more seconds, compare image count and scroll height to baseline. Record the result.
A2. Wait for loading indicators to clear (always, every page): Check for spinners, skeleton screens, loading indicators. Use javascript_tool to look for: aria-label="Loading", role="progressbar", class names containing skeleton, spinner, loading, placeholder. Add any found to knownLoadingSelectors and wait for them to disappear. Also check all selectors already in knownLoadingSelectors. Do not proceed until all loading indicators are gone.
A3. CSS animation overrides (if you see moving elements): inject via javascript_tool and screenshot to confirm it stopped. Only include in tests if the screenshot shows the element frozen.
A4. Page sections: run document.body.scrollHeight (after real scrolling in A1). If >~2000px, use both strategies to find the best CSS selectors for section-based testing:
Strategy 1 — Algorithmic probe: Capture shaka-perf discover-abtests probe-sections and pass its stdout to javascript_tool. It walks the DOM from the layout root, scores elements by size (100-800px = best), width, depth, semantic class name, heading inclusion, content density, and uniqueness. Returns up to 15 scored candidates with overlap removed. Elements >1000px tall are deprioritized so their children get picked instead.
Strategy 2 — AI visual analysis: Scroll through the page and identify the natural visual sections a user would recognize — hero, content blocks, sidebars, forms, navigation, footer. For each, find the closest DOM element that wraps it. Evaluate: "If I capture just this element, will the screenshot show a recognizable, self-contained piece of UI?"
Merge and evaluate candidates from both strategies:
- Default: include. Every scored candidate should get a test. Only skip a section if it is structurally empty — meaning 0 children, 0 textContent, and 0 images (e.g., an empty
<div>placeholder with no iframe or canvas). Sections showing "empty state" UI (like "Reviews (0)" with a button) are real UI and should be tested. - A good section passes the "would a designer draw a box here?" test — it's a natural visual block
- A good section includes its heading — if an
<h2>sits above the candidate, try the parent instead - A good section "tells a story" — the screenshot makes sense on its own ("Amenities: WiFi, Pool" tells a story; a blank rectangle does not)
- If an element has near-zero textContent but children have content, it's a wrapper — go one level deeper
- Aim for sections covering 70%+ of page height — use as many sections as needed
- For sidebar elements (position:absolute/sticky, widthRatio < 0.5), plan desktop-only tests
- For elements hidden on some viewports, add
viewportsoverride
A5–A7 are not optional. Interaction tests (clicking buttons, filling forms, opening modals) are just as important as section snapshots — they catch regressions in dynamic behavior that static screenshots miss. A page with 5 section snapshots and 0 interaction tests has a coverage gap.
A5. Catalog interactive elements: use javascript_tool to find all clickable/interactive elements on the page. Query for button, a[href] (non-navigation), input, select, textarea, [role="tab"], [aria-expanded], [data-toggle], .btn, etc. Record each with its selector, visible text, and location on the page.
A6. Test interactions: click each interactive element in Chrome and document what happens:
- Button opens a modal or drawer? → record the modal's content and selectors
- Checkbox changes visible state? → record
- Button scrolls? → record
- Button does something visible? → record
- Tab reveals content or scrolls? → record
- Anything produces validation errors? → record
- Link navigates to another page? → record the destination (but don't write a navigation test — the destination page gets its own tests)
- Form inputs found? → this is important. For every form on the page (whether inline or inside a modal), record ALL input fields with their selectors, types, labels, and what values to fill them with. This includes:
- Text inputs (
input[type="text"],input[name="..."]) - Date/calendar inputs (date pickers,
input[type="date"], calendar widgets) - Number inputs (
input[type="number"], guest counters with +/- buttons) - Dropdowns (
select, custom dropdowns) - Textareas
- Checkboxes and radio buttons
Try filling them during probing — actually type values into inputs, select dates on calendars, increment number fields, check checkboxes. This confirms what works and what doesn't before you write test code.
Fill before clicking action buttons. When a form has both inputs and a submit/action button (like "Book Now", "Search", "Apply"), the right test sequence is: fill all inputs first → capture the filled state → then click the button. A test that clicks "Book Now" without filling in dates and guests misses the most interesting UI state (the populated form) and may also miss validation behavior.
A7. Probe inside modals/expanded UI: when clicking reveals new UI (modal, drawer, expanded panel), probe THAT UI for its own interactive elements — buttons, forms, links within the modal. Keep going as long as new testable UI appears. For each form inside a modal, record all fields so you can write a form-fill test in Step B.
For every confirmed interaction, plan a test. For every form found, plan three tests:
- A "click to open" test (snapshot of the modal/panel appearing)
- A "fill the form" test (populate all fields, capture the filled state)
- A "submit" test if there's a submit button (fill fields → click submit → capture the result)
This applies to inline forms too (forms that are already visible on the page without clicking anything). A booking form with date pickers and guest selectors, a search form with filters, a contact form — these all need fill tests. The filled state of a form is valuable test coverage because it exercises input rendering, validation UI, and date/number formatting.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 96 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginternal/analysis/rsc-fouc-shakaperf-artifacts/setup/generated-shakaperf-skills/discover-abtests/SKILL.md
Popularity
- Repository stars
- 5,192
- Repository forks
- 629
- 7-day trend score
- 43
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/shakacode/react_on_rails/discover-abtests)