Skip to content

oberconcejo/VS-CODE / .agents/skills/app-store-screenshots

app-store-screenshots

Flagged

Use when building App Store or Google Play screenshot pages, generating exportable marketing screenshots for iOS, macOS, and/or Android apps, or scaffolding a screenshot editor with Next.js. Triggers on app store, mac app store, play store, screenshots, marketing assets, html-to-image, phone mockup, mac mockup, android screenshots, feature graphic.

FileKindSize
SKILL.mdskill md63.5 KB
copy-ideas.mdmarkdown8.9 KB
iphone-duo.mdmarkdown13.8 KB
mockup.pngbinary92.8 KB
scripts/capture-iphone-duo.shscript7.0 KB
style-prompts.mdmarkdown10.2 KB
style-prompts/01-retro-rubberhose-mascot.mdmarkdown24.7 KB
style-prompts/02-moody-curated-dating.mdmarkdown27.0 KB
style-prompts/03-paper-sticker-skeuomorphic.mdmarkdown28.3 KB
style-prompts/04-dreamy-pastel-couples.mdmarkdown24.7 KB
style-prompts/05-hand-drawn-editorial-tasks.mdmarkdown23.5 KB
style-prompts/06-glossy-3d-kbeauty-creator.mdmarkdown21.1 KB
style-prompts/07-liquid-glass-aurora.mdmarkdown19.8 KB
style-prompts/08-swiss-grid-bold.mdmarkdown20.0 KB
style-prompts/09-neon-athletic-night.mdmarkdown22.3 KB
style-prompts/10-magazine-cover-editorial.mdmarkdown25.2 KB
style-prompts/11-candy-pop-social.mdmarkdown19.9 KB
style-prompts/12-soft-clay-wellness.mdmarkdown20.6 KB
style-prompts/13-midnight-glow-pro.mdmarkdown33.7 KB
style-prompts/14-risograph-zine.mdmarkdown35.0 KB
style-prompts/15-bento-keynote-grid.mdmarkdown31.3 KB
style-prompts/16-toybox-primary.mdmarkdown35.2 KB
style-prompts/17-quiet-japandi.mdmarkdown30.0 KB
style-prompts/18-vintage-travel-poster.mdmarkdown37.6 KB
style-prompts/_QUALITY_BAR.mdmarkdown13.6 KB
template/.github/workflows/e2e.ymlconfig783 B
template/.gitignoreother470 B
template/README.mdmarkdown24.1 KB
template/app-store-screenshots.jsonconfig8.3 KB
template/bun.lockother71.9 KB
template/components.jsonconfig449 B
template/docs/testing/e2e.mdmarkdown23.5 KB
template/e2e-army/chrome-provider.tsscript1.7 KB
template/e2e-army/server.cjsscript1.6 KB
template/e2e.config.tsscript824 B
template/next.config.mjsscript294 B
template/package.jsonmanifest1.6 KB
template/postcss.config.mjsscript81 B
template/public/fonts/imported/.gitkeepother1 B
template/public/frames/.gitkeepother0 B
template/public/frames/duo-inner-landscape.pngbinary777.3 KB
template/public/frames/duo-inner-portrait.pngbinary802.5 KB
template/public/frames/duo-outer-landscape.pngbinary371.9 KB
template/public/frames/duo-outer-portrait.pngbinary446.3 KB
template/public/frames/ipad-portrait.pngbinary307.1 KB
template/public/frames/iphone-portrait.pngbinary478.4 KB
template/public/frames/mac.pngbinary660.7 KB
template/public/frames/tv.pngbinary833.9 KB
template/public/frames/watch.pngbinary234.3 KB
template/public/mockup.pngbinary92.8 KB
template/public/screenshots/android/phone/en/.gitkeepother0 B
template/public/screenshots/apple/ipad/en/.gitkeepother0 B
template/public/screenshots/apple/iphone/en/.gitkeepother0 B
template/src/app/api/frames/route.tsscript1.5 KB
template/src/app/api/project/route.tsscript3.4 KB
template/src/app/api/upload-font/route.tsscript4.5 KB
template/src/app/api/upload/route.tsscript3.2 KB
template/src/app/fonts/imported/[filename]/route.tsscript359 B
template/src/app/frames/[filename]/route.tsscript1.3 KB
template/src/app/globals.cssother3.2 KB
template/src/app/layout.tsxother487 B
template/src/app/page.tsxother141 B
template/src/app/screenshots/uploaded/[filename]/route.tsscript328 B
template/src/components/editor/background-controls.tsxother2.9 KB
template/src/components/editor/callout-controls.tsxother7.9 KB
template/src/components/editor/create-image-mask.tsscript586 B
template/src/components/editor/device-frames.tsxother20.9 KB
template/src/components/editor/font-importer.tsxother3.0 KB
template/src/components/editor/image-element-canvas.tsxother1.4 KB
template/src/components/editor/inspector.tsxother40.9 KB
template/src/components/editor/preview-stage.tsxother10.4 KB
template/src/components/editor/scene-layers.tsxother14.3 KB
template/src/components/editor/scene-playground.tsxother10.5 KB
template/src/components/editor/screenshot-editor.tsxother37.6 KB
template/src/components/editor/screenshot-picker.tsxother7.2 KB
template/src/components/editor/sidebar.tsxother4.3 KB
template/src/components/editor/slide-canvas.tsxother54.9 KB
template/src/components/editor/slide-thumb.tsxother5.9 KB
template/src/components/editor/style-lab.tsxother17.4 KB
template/src/components/editor/toolbar.tsxother14.7 KB
template/src/components/ui/button.tsxother1.8 KB
template/src/components/ui/card.tsxother1.2 KB
template/src/components/ui/dialog.tsxother3.1 KB
template/src/components/ui/dropdown-menu.tsxother3.7 KB
template/src/components/ui/input.tsxother717 B
template/src/components/ui/label.tsxother714 B
template/src/components/ui/popover.tsxother1.0 KB
template/src/components/ui/select.tsxother3.7 KB
template/src/components/ui/tabs.tsxother1.9 KB
template/src/components/ui/textarea.tsxother644 B
template/src/components/ui/tooltip.tsxother898 B
template/src/lib/clean-hex-color.tsscript225 B
template/src/lib/clean-imported-font.tsscript990 B
template/src/lib/constants.tsscript21.9 KB
template/src/lib/contrast.tsscript3.0 KB
template/src/lib/copy-ideas.tsscript2.9 KB
template/src/lib/defaults.tsscript9.2 KB
template/src/lib/elements.tsscript1.3 KB
template/src/lib/export-assets.tsscript1.3 KB
template/src/lib/export-render.tsscript8.9 KB
template/src/lib/frame-assets.tsscript7.7 KB
template/src/lib/image-cache.tsscript3.0 KB
template/src/lib/locale.tsscript1.9 KB
template/src/lib/measure-frame.tsscript3.6 KB
template/src/lib/png-encode.tsscript2.9 KB
template/src/lib/png-rgb.tsscript5.4 KB
template/src/lib/png-worker.tsscript545 B
template/src/lib/project-validation.tsscript4.9 KB
template/src/lib/request-body.tsscript1.7 KB
template/src/lib/request-guard.tsscript2.0 KB
template/src/lib/scene.tsscript4.7 KB
template/src/lib/serve-asset.tsscript1.0 KB
template/src/lib/storage.tsscript16.5 KB
template/src/lib/style-lab.tsscript13.1 KB
template/src/lib/types.tsscript7.4 KB
template/src/lib/typography.tsscript2.0 KB
template/src/lib/utils.tsscript169 B
template/src/lib/write-asset.tsscript448 B
template/tailwind.config.tsscript2.0 KB
template/tests/editor.e2e.tsscript12.5 KB
template/tests/harness/api-bug-bash.cjsscript9.5 KB
template/tests/harness/bug-bash.cjsscript34.9 KB
template/tests/harness/migration-fixture.cjsscript7.4 KB
template/tests/harness/run.cjsscript466 B
template/tests/harness/ui-bug-bash.cjsscript14.9 KB
template/tests/regression.e2e.tsscript1.5 KB
template/tests/scene-style-lab.e2e.tsscript14.7 KB
template/tests/targets.e2e.tsscript12.5 KB
template/tsconfig.jsonconfig594 B

template/src/lib/export-render.ts

View on GitHub
"use client";
// Rasterises one export slide to PNG.
//
// WHY THIS IS NOT JUST `toPng(node)`
// ----------------------------------
// html-to-image serialises the node into an SVG <foreignObject>, loads that SVG
// as an image and draws it to a canvas exactly once. WebKit (Safari, and any
// WebKit-based browser) decodes the <img> data URLs *nested inside* an SVG
// image asynchronously, kicked off by the first paint. That single draw can
// therefore capture the headline, background and CSS device frame while every
// screenshot is still blank, with no error. Whether it wins the race depends on
// image size and machine load, so a different slide failed on each export and a
// 4K render could fail where 1080p passed. Chrome paints nested data URLs on the
// first draw, which is why the bug looked intermittent.
//
// THE FIX
// -------
// 1. Embed only the images inside the captured slide. A connected deck renders
//    every screen side by side; embedding all of them made each SVG N× larger.
// 2. Render a baseline with every image blanked, so we know what each image's
//    region looks like when the image is missing.
// 3. Draw the real SVG repeatedly until every visible image region differs from
//    that baseline and two consecutive draws are identical. Only then export.
//    If an image never shows up within the timeout, report it instead of
//    silently shipping a blank device.
import { toSvg } from "html-to-image";
import { encodeCanvasPng } from "./png-encode";

const SETTLE_POLL_MS = 50;
const SETTLE_TIMEOUT_MS = 8000;
const FINGERPRINT_SIZE = 12;
const BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
const SVG_PREFIX = "data:image/svg+xml;charset=utf-8,";

type Box = { x: number; y: number; w: number; h: number };

export type RenderedSlide = {
  /** Draw the settled slide at the given export size as opaque 24-bit PNG bytes. */
  toPng: (w: number, h: number) => Promise<Uint8Array>;
  /** Visible images that never appeared in the render. 0 when all is well. */
  missingImages: number;
};

const nextFrame = () => new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));
const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));

function loadImage(src: string): Promise<HTMLImageElement> {
  return new Promise((resolve, reject) => {
    const image = new Image();
    image.onload = () => {
      image.decode().then(
        () => resolve(image),
        () => resolve(image),
      );
    };
    image.onerror = () => reject(new Error("Couldn't load the rendered slide"));
    image.src = src;
  });
}

function intersects(a: DOMRect, b: DOMRect) {
  return a.right > b.left && a.left < b.right && a.bottom > b.top && a.top < b.bottom;
}

// Same SVG with every <img> pointed at a transparent pixel: what each image
// region looks like when that image failed to paint.
function blankImages(svg: string) {
  if (!svg.startsWith(SVG_PREFIX)) return null;
  const markup = decodeURIComponent(svg.slice(SVG_PREFIX.length));
  const blanked = markup.replace(/(<img\b[^>]*?\bsrc=")[^"]*(")/g, `$1${BLANK_GIF}$2`);
  return SVG_PREFIX + encodeURIComponent(blanked);
}

function createContext(width: number, height: number, readBack = false) {
  const canvas = document.createElement("canvas");
  canvas.width = width;
  canvas.height = height;
  const ctx = canvas.getContext("2d", readBack ? { willReadFrequently: true } : undefined);
  if (!ctx) throw new Error("Canvas 2D context unavailable");
  return { canvas, ctx };
}

// Downsampled pixels of each box: cheap to compare, sensitive to "is it there".
function fingerprint(source: HTMLCanvasElement, boxes: Box[], scratch: CanvasRenderingContext2D) {
  return boxes.map((b) => {
    scratch.clearRect(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);
    scratch.drawImage(source, b.x, b.y, b.w, b.h, 0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);
    return scratch.getImageData(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE).data.join(",");
  });
}

// Does the image have visible pixels in its inner 60% ("opaque-center"), only
// nearer its edges ("edges-only"), or none at all ("empty")? Sampled from the
// decoded image itself at fingerprint resolution.
function alphaCoverage(
  image: HTMLImageElement,
  scratch: CanvasRenderingContext2D,
): "opaque-center" | "edges-only" | "empty" {
  const w = image.naturalWidth;
  const h = image.naturalHeight;
  if (!w || !h) return "opaque-center";
  const hasAlpha = (sx: number, sy: number, sw: number, sh: number) => {
    scratch.clearRect(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);
    scratch.drawImage(image, sx, sy, sw, sh, 0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);
    const data = scratch.getImageData(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE).data;
    for (let i = 3; i < data.length; i += 4) if (data[i] > 8) return true;
    return false;
  };
  try {
    if (hasAlpha(w * 0.2, h * 0.2, w * 0.6, h * 0.6)) return "opaque-center";
    return hasAlpha(0, 0, w, h) ? "edges-only" : "empty";
  } catch {
    // Unreadable (e.g. tainted) images keep the original inner-box check.
    return "opaque-center";
  }
}

export async function renderSlide(
  el: HTMLElement,
  width: number,
  height: number,
  backgroundColor = "#ffffff",
): Promise<RenderedSlide> {
  const root = el.getBoundingClientRect();
  const sx = width / (root.width || width);
  const sy = height / (root.height || height);
  const isVisible = (node: Element) => intersects(node.getBoundingClientRect(), root);

  const visible = Array.from(el.querySelectorAll("img")).filter(
    (image) => !!image.getAttribute("src") && isVisible(image),
  );
  await Promise.all(visible.map((image) => image.decode().catch(() => undefined)));

  const { ctx: scratch } = createContext(FINGERPRINT_SIZE, FINGERPRINT_SIZE, true);

  // Inner 60% of each visible image, in canvas pixels. The inset keeps bezels,
  // rounded corners and overlapping frames out of the comparison. An image
  // whose own centre is see-through (the iPhone mockup around an empty screen,
  // a ring-shaped logo overlay) would look "missing" there even when painted,
  // so those are checked over their full box instead, as are frames marked
  // data-export-check="full" whose middle is covered by the screen layer.
  // Images with no visible pixels at all are skipped.
  const boxes: Box[] = visible
    .map((image) => {
      const coverage = alphaCoverage(image, scratch);
      if (coverage === "empty") return null;
      const inset = coverage === "opaque-center" && image.dataset.exportCheck !== "full" ? 0.2 : 0;
      const r = image.getBoundingClientRect();
      const left = Math.max(r.left, root.left);
      const top = Math.max(r.top, root.top);
      const w = (Math.min(r.right, root.right) - left) * sx;
      const h = (Math.min(r.bottom, root.bottom) - top) * sy;
      return {
        x: (left - root.left) * sx + w * inset,
        y: (top - root.top) * sy + h * inset,
        w: w * (1 - inset * 2),
        h: h * (1 - inset * 2),
      };
    })
    .filter((b): b is Box => !!b && b.w >= 2 && b.h >= 2);

  const svg = await toSvg(el, {
    width,
    height,
    cacheBust: false,
    backgroundColor,
    filter: (node) => !(node instanceof HTMLImageElement) || isVisible(node),
  });

  const { canvas, ctx } = createContext(width, height);
  const draw = (image: HTMLImageElement) => {
    ctx.fillStyle = backgroundColor;
    ctx.fillRect(0, 0, width, height);
    ctx.drawImage(image, 0, 0, width, height);
  };

  let missingImages = 0;
  const blankSvg = boxes.length > 0 ? blankImages(svg) : null;
  if (blankSvg) {
    draw(await loadImage(blankSvg));
    const baseline = fingerprint(canvas, boxes, scratch);
    const image = await loadImage(svg);
    let prev: string[] | null = null;
    let painted: boolean[] = boxes.map(() => false);
    const deadline = performance.now() + SETTLE_TIMEOUT_MS;
    for (;;) {
      draw(image);
      const cur = fingerprint(canvas, boxes, scratch);
      painted = cur.map((fp, i) => fp !== baseline[i]);
      const stable = prev !== null && cur.every((fp, i) => fp === prev![i]);
      if ((stable && painted.every(Boolean)) || performance.now() > deadline) break;
      prev = cur;
      await nextFrame();
      await sleep(SETTLE_POLL_MS);
    }
    missingImages = painted.filter((p) => !p).length;
  } else {
    draw(await loadImage(svg));
  }

  return {
    missingImages,
    toPng: (w, h) => {
      if (w === width && h === height) return encodeCanvasPng(canvas);
      const { canvas: out, ctx: octx } = createContext(w, h);
      octx.imageSmoothingEnabled = true;
      octx.imageSmoothingQuality = "high";
      // Cover, not stretch: some slots differ from the canvas aspect by a few
      // percent (Apple Watch 422×514 → 312×390), and stretching would squash
      // the device frame. Cover trims the same few pixels off the edges instead.
      const scale = Math.max(w / width, h / height);
      const dw = width * scale;
      const dh = height * scale;
      octx.drawImage(canvas, (w - dw) / 2, (h - dh) / 2, dw, dh);
      return encodeCanvasPng(out);
    },
  };
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall