gooseworks-ai/create-imessage-mockup
Render pixel-accurate iMessage screenshot mockups (DM or group) from a thread JSON. Supports minimal, with-keyboard, and full iPhone 15 Pro frame variants. Outputs HTML + PNG.
npx skills add https://github.com/gooseworks-ai/goose-skills --skill create-imessage-mockup
Generate iMessage screenshots that look like real iOS captures — correct bubbles with tails, typing indicators, timestamps, "Delivered" captions, group avatars + sender names, keyboard chrome, and an optional iPhone 15 Pro bezel with Dynamic Island and status bar.
Turn a structured thread JSON into a believable iMessage screenshot — first as standalone HTML (generate.js + templates/chat.css), then rasterized to PNG with headless Chromium (screenshot.js/render.js via Playwright). It is the atom you reach for when an ad, social post, or video scene needs a fake-but-convincing iOS message capture.
What it gets right, grounded in the renderer:
sent bubbles (right) and gray received bubbles (left), with a curved tear-drop tail drawn only on the *last* bubble of each consecutive sender run (isLastOfRun in generate.js).theme: "dark" flips the page to the iOS dark conversation look; the status bar, Dynamic Island, and keyboard match iPhone 15 Pro.mode: "group") add per-sender colored avatar circles, sender names above the first bubble of a run, and a 4-tile group-header badge.timestamp pills, a static-but-mid-animation typing three-dot bubble, attachment cards, and "Delivered"/"Read" captions let you stage individual frames of a conversation.--minimal (bubbles only), --with-keyboard (header + iOS keyboard), and --with-iphone-frame (full bezel + Dynamic Island + status bar over a gradient backdrop).The atom embeds no LLM — it is deterministic. The orchestrating agent is responsible for composing the thread JSON; the renderer only draws exactly what the JSON says.
If you're rendering programmatic graphic frames more broadly (cards, posters, infographics), use create-goose-graphics instead.
The skill is deterministic — it does not embed an LLM. To translate a free-form prompt into a thread, the orchestrating agent (you) composes a JSON file matching the schema below, then invokes the renderer.
{
"mode": "dm" | "group",
"title": "Karaoke Crew",
"participants": [
{ "id": "me", "name": "Me", "self": true },
{ "id": "sarah", "name": "Sarah", "color": "#FF9500", "initials": "S" }
],
"messages": [
{ "type": "timestamp", "label": "iMessage\nToday 9:41 AM" },
{ "type": "timestamp", "bold": "Sat, Jan 2", "light": "11:07" },
{ "type": "text", "from": "sarah", "text": "Did we crash it?" },
{ "type": "text", "from": "me", "text": "Couldn't withstand our friendship", "delivered": true, "read": false },
{ "type": "typing", "from": "sarah" }
],
"keyboard": { "leftIcon": "plus" }
}
mode — dm or group. If omitted, auto-detected from the participant count.participants[].self: true marks the user (sent bubbles, no avatar).participants[].color is the avatar background; defaults from a 6-color palette.participants[].initials defaults to the first letter of name.messages[]:timestamp — centered pill. Use label (newline-separated bold/light) or explicit bold and light fields.text — text bubble. delivered: true on the last sent bubble in a run renders the "Delivered" caption (or "Read" if read: true).typing — animated three-dot bubble (rendered as a static mid-animation frame for screenshot determinism).keyboard.leftIcon — "plus" (default) or "camera".node render.js --thread examples/group-with-frame.json --with-iphone-frame
node render.js --thread examples/dm-with-keyboard.json --with-keyboard
node render.js --thread examples/dm-minimal.json --minimal
node render.js --thread my-thread.json --with-keyboard --output ./my-exports/ --name nightout
| Flag | Effect |
|---|---|
| --thread <path> | (required) JSON file matching the schema above |
| --prompt "<brief>" | prints the schema and exits — agent must compose a thread.json and re-invoke |
| --minimal | bubbles + timestamps only (no header, no keyboard, no frame) |
| --with-keyboard | bubbles + iOS keyboard chrome (default) |
| --with-iphone-frame | full iPhone 15 Pro bezel + Dynamic Island + status bar + soft gradient backdrop |
| --dm / --group | force chat mode (otherwise auto-detected from participants) |
| --name <slug> | override the output folder slug |
| --output <dir> | parent dir for the dated output folder; default ./imessage-mockup-exports/ |
Frame flags are mutually exclusive.
<output>/<YYYY-MM-DD>-<slug>/
index.html # full standalone HTML
screenshot.png # rendered PNG (DPR 3, "Retina")
thread.json # copy of the input for reproducibility
Default <output> is ./imessage-mockup-exports/ in the cwd.
node render.js --thread <path> [flag].templates/ and re-render.cd skills/ads/capabilities/create-imessage-mockup
npm install
npx playwright install chromium
| File | Purpose |
|---|---|
| render.js | CLI entry — parses flags, generates HTML, takes screenshot, writes outputs |
| generate.js | Thread JSON → standalone HTML page |
| screenshot.js | HTML → PNG via Playwright (chromium headless) |
| templates/chat.css | All visual styling (bubbles, tails, keyboard, iPhone frame) |
| templates/icons.js | Inline SVG icons (plus, camera, mic, signal, wifi, battery, chevron) |
| examples/*.json | 6 reference threads exercising every flag combination |
| tests/run-all.sh | Render every example into tests/output/ for visual review |
bash tests/run-all.sh
# inspect tests/output/<case>/<date-slug>/screenshot.png
The 6 cases cover: dm-minimal, dm-with-keyboard, dm-with-typing (camera-keyboard variant), dm-with-frame, group-with-frame, group-minimal.
These are mistakes that have already been made and fixed. If you modify the templates, do not undo them.
The iMessage tail in templates/chat.css is drawn with two pseudo-elements that both sit behind the bubble's background (z-index: -1 inside an isolation: isolate stacking context on .bubble):
::before is the colored bulge that extends past the tail-side edge.::after is the page-color cutout that overlaps the bulge from outside, with a rounded corner that "carves" the tear-drop curve.This works because ::after paints on top of ::before (later in source order = higher in paint order). In the overlap region the cutout wins, leaving only the curved tail tip of the bulge visible.
Do not swap these roles. If ::after is used for the bulge and ::before for the cutout, the cutout paints behind the bulge, so it does nothing — and the tail renders as a chunky rectangle with one rounded corner, not a curved tear-drop. This is how tails initially looked broken.
Do not remove isolation: isolate from .bubble without replacing it with another stacking-context trigger (z-index: 0, transform, etc.). Without a stacking context, z-index: -1 on the pseudo-elements will push them behind the page background, not just behind the bubble's own background, and the tail disappears entirely.
.avatar-slot has z-index: 3 and position: relative so it paints on top of the bubble next to it. This is required: without it, the bubble's tail (which extends ~7px to the left of the bubble for received messages) overlaps the avatar circle.
The avatar is a sibling of the bubble in the .row flex container, not a child of the bubble. The bubble's isolation: isolate does not contain it, so this stacking still works.
Tails appear only on the last consecutive bubble from the same sender. Adding a tail to every bubble (or the first instead of the last) does not match iOS. The logic in generate.js walks the message list and sets isLastOfRun based on whether the next message is from the same from; do not change that without checking iOS reference screenshots.
Modes use fullPage: true with a small initial viewport height (100px). This is intentional: Playwright extends the viewport to fit content but never shrinks it, so a small initial height + fullPage produces a tightly-cropped screenshot. Do not raise the viewport height to "make sure the screenshot fits" — that creates dead vertical space below the content.
The with-iphone-frame mode uses a fixed viewport (525×980) with fullPage: false because the frame itself defines the visible area; here we *want* the viewport to bound the screenshot to a single phone-sized rect.
avatarUrl field and update templates/chat.css if needed.{type: "reaction", target: <index>, kind: "heart"|...} but the renderer ignores it for now.Before treating a render as final, verify against the iOS look:
index.html, screenshot.png, and a copied thread.json (written by render.js).minimal and with-keyboard are 750px wide × DPR 3 = 2250px wide, with height growing to fit content (fullPage: true). with-iphone-frame is the fixed phone rect: 525×980 × DPR 3 = 1575×2940. Confirm with sips -g pixelWidth -g pixelHeight <png> (macOS) or any image tool.sent (self) bubbles hug the right and are blue; received bubbles hug the left and are gray. A tail appears only on the last bubble of each sender run — never on the middle bubbles, never on the first-of-run.group threads each received run shows the sender's name above its first bubble and a colored avatar circle beside its last bubble; the group header shows up to 4 avatar tiles plus the title.sent bubble in a run with delivered: true shows a "Delivered" caption ("Read" if read: true), and only that bubble.9:41 with signal/wifi/battery, and the phone sits on the soft gradient backdrop.typing renders three dots in a received bubble; emoji-only messages render enlarged; [[link:CODE]] markers render as an underlined iOS link-detector span.✓ <png path> line.The canonical visual review is bash tests/run-all.sh, which renders all six example fixtures into tests/output/ for side-by-side inspection.
Known ways this atom breaks, and what they look like:
screenshot.js exits with playwright not installed. Run npm install in the skill directory. Fix: run the one-time npm install + npx playwright install chromium from Setup.--thread — render.js prints help and exits non-zero; --prompt alone prints the schema and exits 2 by design (the agent must compose a thread.json and re-invoke). The atom never invents a conversation on its own.JSON.parse; a from that doesn't match any participant id yields a bubble with no avatar/name (in groups) because the participant lookup misses. Keep messages[].from in sync with participants[].id.::before/::after roles or removing isolation: isolate from .bubble in templates/chat.css makes tails render as a chunky rectangle or vanish entirely (see Implementation pitfalls). Do not re-introduce.z-index: 3 / position: relative on .avatar-slot lets a received bubble's tail bleed over the avatar circle.minimal/with-keyboard defeats the fullPage tight-crop and leaves empty space below the content.--minimal / --with-keyboard / --with-iphone-frame is ambiguous; the last one parsed wins. Pass exactly one.Take gooseworks-ai/create-imessage-mockup from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm, npx.
Without those the skill loads but fails at the first command.