/bidi2pdf:pdf-specsfrom bidi2pdf
Provides RSpec matchers and helpers for testing PDFs rendered by bidi2pdf: asserting text, page count, images, and managing Chrome containers for browser specs.
Ships in bidi2pdf. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
bidi2pdf ships RSpec matchers for PDFs and helpers that start a chromedriver container for the suite. This skill is how to use them, and the mistakes that made such specs flaky before.
Does not: replace a project's own spec conventions - follow those for naming and layout. And it does not cover bidi2pdf-rails' own test helpers (see that gem).
error.code, error.hint and exit code;
never make the PDF or screenshot another way (Chrome's own print-to-PDF, another PDF engine).render-pdf skill's
preflight); run nothing that changes the system without the user's yes.--json result instead of inspecting the PDF with other
tools.# spec/spec_helper.rb
require "bidi2pdf/test_helpers" # matchers and file helpers; needs pdf-reader, diff-lcs, unicode_utils
require "bidi2pdf/test_helpers/images" # only for contains_pdf_image (ruby-vips, dhash-vips)
require "bidi2pdf/test_helpers/testcontainers" # only to start Chrome in Docker for the suite
Add the gems the comments name to the test group of the Gemfile; each helper warns when one is missing instead of failing the suite.
pdf = tab.print # base64; a path or raw bytes work too
expect(pdf).to have_pdf_page_count(2)
expect(pdf).to contains_pdf_text("Invoice #123")
expect(pdf).to contains_pdf_text(/Total: \d+/).at_page(2)
expect(pdf).to match_pdf_text(expected_pdf) # the whole text equal, after cleaning both texts
expect(pdf).to contains_pdf_image("spec/fixtures/logo.png").at_page(1) # perceptually similar, tolerance: 10
Tag examples :chromedriver: the helper starts the chromedriver container once for the suite
(Docker required) and gives the example session_url, create_session(session_url) and
with_tab(session_url) { |tab| ... }, which opens and always closes the session. Without Docker,
point the specs at an existing chromedriver instead (a remote-chrome service, see that skill) and
skip the tag.
wait_until_network_idle only sees requests that
have started; a debounced search or a deferred fetch starts later, and the assertion runs too
early. Poll for the DOM state you expect (a selector that appears, a text that changes), with a
deadline that raises.execute_script returns the BiDi result: check
result["type"] - an "exception" there, not a nil value, means your selector or script
failed..click() works on hidden elements; a real
user cannot click them. Navigate to the state where the element is visible before asserting on
it.ensure; let in-flight requests finish
before the test server tears down its database connection, or a request still rendering fails
outside any example.LANG on the browser
container and set dates as ISO strings.What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/diagnose-pdfThis skill should be used when a PDF made with bidi2pdf (CLI, Ruby API or bidi2pdf-rails) is blank, half empty, unstyled, missing images or fonts, cut off, on the wrong number of pages, shows dates in the wrong format, or breaks words badly. A checklist from the cheapest check to the most expensive, using bidi2pdf diagnose./page-screenshotsThis skill should be used when pages of a web site or app need screenshots for a design, UX or accessibility review - at phone and desktop width, in light and dark mode - or when one screenshot shows what Chrome rendered for a PDF. Uses bidi2pdf's browser (local or a shared chromedriver), not Playwright or Puppeteer./pdf-recipeThis skill should be used when a PDF needs more than one render call - waiting for an element, clicking something open, running a script, switching to screen view or a viewport first - or when a PDF must be checked (page count, text in it, no failed requests). Writes and validates a bidi2pdf recipe YAML without a browser, then runs it./remote-chromeThis skill should be used when bidi2pdf (or bidi2pdf-rails) should render in a shared Chrome container instead of a local browser - setting up the chromedriver container with Docker Compose, connecting to it, sizing it, keeping sessions from piling up, and printing HTML that nobody vouches for. Also when renders fail with "session not created", hang, or the container eats memory./render-pdfThis skill should be used when a web page, a URL or an HTML file has to become a PDF with bidi2pdf's command line, including a PDF of a page's screen view, dark mode or mobile layout, a tagged (accessible) PDF, or a PDF piped through stdin/stdout. Covers the order of commands, the waits, reading the JSON result and the exit codes.npx claudepluginhub dieter-medium/bidi2pdf --plugin bidi2pdfOther plugins' skills for the same job