Skip to content

BuilderIO/agent-native / .agents/skills/design-editor-repro

design-editor-repro

Verified

Reproduce and verify Design editor issues against the application itself.

FileKindSize
SKILL.mdskill md2.2 KB
harness-recipes.mdmarkdown1.2 KB
harness/dlib.mjsscript27.1 KB
harness/doctor.mjsscript3.1 KB
harness/harness-env.mjsscript5.1 KB
harness/lock.mjsscript1.9 KB
harness/osmouse-linuxexecutablescript1.7 KB
harness/osmouse.swiftscript3.7 KB
harness/sheet.mjsscript3.1 KB
harness/shot.mjsscript2.6 KB
harness/start-dev.shexecutablescript1.6 KB
reference/fixing.mdmarkdown947 B
reference/input-and-osmouse.mdmarkdown938 B
reference/performance.mdmarkdown1.0 KB
reference/tests-and-blast-radius.mdmarkdown719 B
reference/verification.mdmarkdown578 B
scripts/clip.mjsscript4.2 KB
scripts/copy-design.mjsscript7.2 KB

harness/sheet.mjs

View on GitHub
// Lays several screenshots out as one labelled image, so one Read replaces
// many: a clip's frames as a contact sheet, or one issue's evidence side by
// side (clip | production before | local after).
//
//   node .agents/skills/design-editor-repro/harness/sheet.mjs "<title>" "<label>=<image>" ["<label>=<image>" ...]
//
// In a script:
//   import { sheet } from "<repo>/.agents/skills/design-editor-repro/harness/sheet.mjs";
//   const path = await sheet("flip export", [{ label: "Clip", image }, { label: "Local after", image }]);
import { readFileSync } from "node:fs";
import { extname } from "node:path";
import { pathToFileURL } from "node:url";

import { LAUNCH, SHOTS_DIR, chromium } from "./harness-env.mjs";

const MIME = {
  ".png": "image/png",
  ".jpg": "image/jpeg",
  ".jpeg": "image/jpeg",
  ".webp": "image/webp",
};
const escapeHtml = (s) =>
  String(s).replace(
    /[&<>"]/g,
    (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c],
  );
const slug = (s) => s.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-|-$/g, "");

/** Writes a JPEG under SHOTS_DIR (or `out`) and returns its path. */
export async function sheet(
  title,
  cells,
  { columns = Math.min(cells.length, 4), cellWidth = 480, out } = {},
) {
  const figures = cells
    .map((c) => {
      const mime = MIME[extname(c.image).toLowerCase()] ?? "image/png";
      const data = readFileSync(c.image).toString("base64");
      const caption = c.caption
        ? `<div class="cap">${escapeHtml(c.caption)}</div>`
        : "";
      return `<figure><figcaption>${escapeHtml(c.label)}</figcaption><img src="data:${mime};base64,${data}">${caption}</figure>`;
    })
    .join("");
  const html = `<!doctype html><html><head><style>
body{margin:0;background:#fff;font:13px system-ui,sans-serif;color:#111}
h1{margin:0;padding:10px 12px;font-size:15px}
main{display:grid;grid-template-columns:repeat(${columns},${cellWidth}px);gap:10px;padding:0 12px 12px}
figure{margin:0;border:1px solid #ddd;border-radius:6px;overflow:hidden}
figcaption{padding:6px 8px;background:#f4f4f5;font-weight:600}
img{display:block;width:100%}
.cap{padding:6px 8px;color:#444}
</style></head><body><h1>${escapeHtml(title)}</h1><main>${figures}</main></body></html>`;
  const browser = await chromium.launch(LAUNCH);
  try {
    const page = await browser.newPage({
      viewport: { width: columns * (cellWidth + 10) + 14, height: 300 },
    });
    await page.setContent(html, { waitUntil: "load" });
    const path = out ?? `${SHOTS_DIR}/${slug(title)}.jpg`;
    await page.screenshot({ path, fullPage: true, type: "jpeg", quality: 82 });
    return path;
  } finally {
    await browser.close();
  }
}

if (
  process.argv[1] &&
  import.meta.url === pathToFileURL(process.argv[1]).href
) {
  const [title, ...pairs] = process.argv.slice(2);
  if (!title || pairs.length === 0) {
    console.error(
      'usage: sheet.mjs "<title>" "<label>=<image>" ["<label>=<image>" ...]',
    );
    process.exit(2);
  }
  const cells = pairs.map((pair) => {
    const i = pair.indexOf("=");
    return { label: pair.slice(0, i), image: pair.slice(i + 1) };
  });
  console.log(`sheet: ${await sheet(title, cells)} (open it with Read)`);
}
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: 198kUpdated 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: 198kUpdated 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: 198kUpdated Claude CodeCodexVerifiedInstall