Skip to content

jackson2w/claude-code-skills / cdp-layout-verification

cdp-layout-verification

Flagged

This skill should be used when the user asks to "verify this looks right", "check the spacing/alignment/margin", "is this centered", "double check the CSS", "confirm the layout matches", or after any CSS/layout change on a web project where a screenshot alone would only be an eyeball check. It should also be used proactively whenever reporting a CSS fix as "verified" or "confirmed" — a headless screenshot is not sufficient verification for precise spacing, alignment, or color claims; only direct DOM measurement is.

FileKindSize
SKILL.mdskill md7.9 KB
scripts/cdp-eval.mjsscript1.4 KB
scripts/cdp-screenshot.mjsscript1.4 KB

scripts/cdp-screenshot.mjs

View on GitHub
// Capture a screenshot of a live page's *current* DOM state via Chrome
// DevTools Protocol — including any live mutations made with cdp-eval.mjs
// (e.g. toggling a class), without reloading the page and losing that state.
// Requires Node 22+ (uses the built-in global WebSocket).
//
// Usage: node cdp-screenshot.mjs <webSocketDebuggerUrl> <output-path.png>

import fs from "node:fs";

const wsUrl = process.argv[2];
const outPath = process.argv[3];

if (!wsUrl || !outPath) {
  console.error("Usage: node cdp-screenshot.mjs <webSocketDebuggerUrl> <output-path.png>");
  process.exit(1);
}

const ws = new WebSocket(wsUrl);
await new Promise((resolve, reject) => {
  ws.addEventListener("open", resolve);
  ws.addEventListener("error", reject);
});

let id = 1;
function send(method, params = {}) {
  const reqId = id++;
  ws.send(JSON.stringify({ id: reqId, method, params }));
  return new Promise((resolve) => {
    const handler = (ev) => {
      const msg = JSON.parse(ev.data);
      if (msg.id === reqId) {
        ws.removeEventListener("message", handler);
        resolve(msg);
      }
    };
    ws.addEventListener("message", handler);
  });
}

await send("Page.enable");
const result = await send("Page.captureScreenshot", { format: "png", captureBeyondViewport: false });
fs.writeFileSync(outPath, Buffer.from(result.result.data, "base64"));
console.log("saved to " + outPath);
ws.close();
process.exit(0);
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 197kUpdated Claude CodeCodexVerifiedInstall