/canary:canary-scriptingfrom canary
Reference for the Canary sandbox scripting API: browser automation with Playwright-like methods (goto, locator, evaluate, screenshot, snapshotForAI) and sandbox limits.
Ships in canary. 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.
Read when SKILL.md points to them.
Canary scripts are plain async JavaScript run in a QuickJS sandbox with a Playwright-like API.
Both canary-browser run (one-off) and canary run --session (recorded step) execute the same way:
top-level await, with browser, console, and the file helpers available as globals.
goto, locator, evaluate, waitForSelector, screenshot)User says: "navigate to a site and get the title in canary" or "how do I read text off the page?"
Use a named page so it persists across steps, then goto and evaluate/locator. See Quick start.
User says: "click the login button", "fill the search box", "scrape the headlines"
page.locator(selector) then .click() / .fill(value) / .textContent(); or page.evaluate(fn) to pull structured data in one round-trip.
User says: "take a screenshot" or "what's the saveScreenshot signature?"
const buf = await page.screenshot({ fullPage: true }); await saveScreenshot(buf, "home.png"); — note buffer first, and that saveScreenshot is a top-level global, not browser.saveScreenshot.
User says: "I don't know the selectors", "what's on this page?", "explore before acting"
(await page.snapshotForAI()).full → an aria outline of the page. Read it to pick a role/text selector, then act. See Observing the page.
const page = await browser.getPage("main"); // named, persistent page
await page.goto("https://example.com", { waitUntil: "domcontentloaded" });
console.log(await page.title());
const headings = await page.evaluate(() =>
[...document.querySelectorAll("h1, h2")].map((h) => h.textContent.trim())
);
console.log(JSON.stringify(headings));
await page.locator("a.more").click();
const buf = await page.screenshot({ fullPage: false });
await saveScreenshot(buf, "page.png"); // saveScreenshot(buffer, name)
const page = await browser.getPage("main");
const snap = await page.snapshotForAI(); // { full, incremental? }
console.log(page.url(), await page.title());
console.log(snap.full); // aria outline — pick a role/text selector from this
// then act: await page.getByRole("button", { name: "Continue" }).click();
// after changes, page.snapshotForAI({ track: "main" }) returns just the incremental diff
page.snapshotForAI() returns { full, incremental? } — full is an aria outline of the
page: roles, accessible names, [ref=eN] markers on actionable nodes. Read it to pick a
semantic selector — page.getByRole("button", { name: "Continue" }),
page.getByText("Sign in") — then act.{ track?, depth?, timeout? }: re-run page.snapshotForAI({ track: "main" }) after
the page changes to get just the incremental diff; { depth: N } caps the tree on huge
pages; timeout bounds the walk.page.locator("aria-ref=e12") works for an immediate action in the same script only — refs go
stale across steps and after navigations. Prefer re-deriving a semantic selector.(await page.snapshotForAI()).full to see what
is there, pick a semantic selector from it (getByRole, getByText), then interact. Never
guess selectors blind.Every script gets these globals:
browser — pre-connected browser handle (see the script API)console — log / info / warn / error, captured per runsetTimeout / clearTimeout — basic timerssaveScreenshot(buffer, name) — save a screenshot buffer (async — await it)writeFile(name, data) / readFile(name) — small-file persistence (async — await them)newPage() tabs are closed when each script ends.writeFile("state.json", JSON.stringify(x)) in one step,
JSON.parse(await readFile("state.json")) in the next.references/REFERENCE.md).import/require. Inline any helpers.For the complete API — every page/locator/browser method, signatures, the per-step screenshot rule, and sandbox limits — see references/REFERENCE.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/canary-automateDrive a real browser for a one-off task with Canary — navigate, click, fill, scrape, screenshot — and return the result. Nothing is recorded. Use when the user asks to automate a browser task, scrape a page, fill a form, or check something on a site without needing a report. Trigger phrases — "go to X and get Y", "scrape this page", "automate this browser task", "log in and check", "take a screenshot of"./canary-reviewOpen and triage recorded Canary sessions in the local viewer. Use when the user wants to look at, replay, compare, or triage a recorded session — or asks what happened in a run, to open the report, or to see the trace/video/screenshots. Trigger phrases — "open the canary viewer", "show me the last session", "what failed in that run", "review the recording", "open the report"./canary-sessionRecord a verifiable QA session with Canary — explore a flow step by step against one persistent browser, each script a recorded step that captures a Playwright trace, video, network HAR, and console, then render a self-contained report.html. Use when the user wants to verify or QA a flow, produce evidence or a report, or capture a trace/video of a browser run. Trigger phrases — "record a session", "QA this flow", "verify the checkout", "capture a trace", "give me a report of this run"./canary-verifyTurn a code change into a prioritized browser-QA plan with Canary — read the git diff, infer which user-facing workflows it touches, suggest the concrete flows and the checks that must hold, then optionally record those flows as a session with a report.html. Use when the user has changed code and asks what to test, wants to QA a diff, branch, or PR, or wants a focused regression plan before merging. Trigger phrases — "what should I test for this change", "QA my diff", "verify this PR", "I changed X, what flows might break", "regression plan for this branch", "what should I QA before merging".npx claudepluginhub 0xnyn/canary --plugin canaryOther plugins' skills for the same job