gooseworks-ai/goose-skills / skills/video/create-imessage-mockup
create-imessage-mockup
VerifiedRender 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.
| File | Kind | Size |
|---|---|---|
| .gitignore | other | 20 B |
| SKILL.md | skill md | 14.2 KB |
| examples/dm-minimal.json | config | 375 B |
| examples/dm-with-frame.json | config | 513 B |
| examples/dm-with-keyboard.json | config | 373 B |
| examples/dm-with-typing.json | config | 601 B |
| examples/group-minimal.json | config | 699 B |
| examples/group-with-frame.json | config | 1.1 KB |
| generate.jsexecutable | script | 15.0 KB |
| package-lock.json | manifest | 1.7 KB |
| package.json | manifest | 411 B |
| render.jsexecutable | script | 5.5 KB |
| screenshot.jsexecutable | script | 3.9 KB |
| skill.meta.json | config | 137 B |
| templates/chat.css | other | 16.9 KB |
| templates/icons.js | script | 3.3 KB |
| tests/expected-output.md | markdown | 2.3 KB |
| tests/human-test.md | markdown | 1.8 KB |
| tests/run-all.shexecutable | script | 844 B |
| tests/sample-input.md | markdown | 1.7 KB |
| tests/smoke-test.md | markdown | 1.1 KB |
screenshot.js
View on GitHub#!/usr/bin/env node
/**
* screenshot.js — Capture a generated iMessage HTML page as a PNG.
*
* Adapted from the goose-graphics screenshot pipeline. Three modes match
* generate.js: `minimal`, `with-keyboard`, `with-iphone-frame`.
*
* Usage:
* node screenshot.js --mode <minimal|with-keyboard|with-iphone-frame> \
* --input /path/to/index.html \
* --output /path/to/screenshot.png \
* [--font-delay 500]
*/
const path = require('path');
const fs = require('fs');
const { execSync } = require('child_process');
const MODE_CONFIGS = {
'minimal': {
width: 750,
height: 100, // small initial; fullPage extends to actual content
deviceScaleFactor: 3,
fullPage: true,
},
'with-keyboard': {
width: 750,
height: 100, // small initial; fullPage extends to content+keyboard
deviceScaleFactor: 3,
fullPage: true,
},
'with-iphone-frame': {
width: 525, // 393 (phone) + ~66px gradient padding each side
height: 980, // 852 (phone) + ~64px padding each side
deviceScaleFactor: 3,
fullPage: false,
},
};
function parseArgs(argv) {
const args = {};
for (let i = 2; i < argv.length; i++) {
if (argv[i] === '--mode' && argv[i + 1]) args.mode = argv[++i];
else if (argv[i] === '--input' && argv[i + 1]) args.input = argv[++i];
else if (argv[i] === '--output' && argv[i + 1]) args.output = argv[++i];
else if (argv[i] === '--font-delay' && argv[i + 1]) args.fontDelay = parseInt(argv[++i], 10);
}
return args;
}
function validateArgs(args) {
if (!args.mode || !MODE_CONFIGS[args.mode]) {
console.error(`Error: --mode must be one of: ${Object.keys(MODE_CONFIGS).join(', ')}`);
process.exit(1);
}
if (!args.input || !fs.existsSync(args.input)) {
console.error(`Error: --input path missing or not found: ${args.input}`);
process.exit(1);
}
if (!args.output) {
console.error('Error: --output is required.');
process.exit(1);
}
return {
mode: args.mode,
input: path.resolve(args.input),
output: path.resolve(args.output),
fontDelay: args.fontDelay || 500,
};
}
async function ensureChromium() {
let chromium;
try {
({ chromium } = require('playwright'));
} catch (err) {
if (err && err.code === 'MODULE_NOT_FOUND') {
console.error('Error: playwright not installed. Run `npm install` in the skill directory.');
process.exit(1);
}
throw err;
}
try {
chromium.executablePath();
} catch {
console.log('Installing chromium via playwright...');
execSync('npx playwright install chromium', { stdio: 'inherit' });
}
return chromium;
}
async function capture(args) {
const config = MODE_CONFIGS[args.mode];
const chromium = await ensureChromium();
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext({
viewport: { width: config.width, height: config.height },
deviceScaleFactor: config.deviceScaleFactor,
});
const page = await context.newPage();
fs.mkdirSync(path.dirname(args.output), { recursive: true });
await page.goto(`file://${args.input}`, { waitUntil: 'networkidle', timeout: 15000 });
await page.waitForTimeout(args.fontDelay);
await page.screenshot({
path: args.output,
type: 'png',
fullPage: config.fullPage,
omitBackground: false,
});
await browser.close();
const stats = fs.statSync(args.output);
return { bytes: stats.size };
}
async function main() {
const args = validateArgs(parseArgs(process.argv));
console.log(`mode=${args.mode} input=${args.input} output=${args.output}`);
const { bytes } = await capture(args);
console.log(`done — ${Math.round(bytes / 1024)} KB → ${args.output}`);
}
if (require.main === module) {
main().catch(err => {
console.error('Screenshot failed:', err.message);
process.exit(1);
});
}
module.exports = { capture, MODE_CONFIGS };
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |