Generate a branded social media image for announcing a feature or update. The image is built as an HTML page styled to match the project's brand, then screenshotted with Playwright.
Phase 1: Ensure Playwright is Available
npx playwright --version 2>/dev/null || (echo "Installing Playwright..." && npx playwright install chromium)
If installation fails, inform the user and suggest npm install -D playwright && npx playwright install chromium.
Phase 2: Understand What Changed (Git-Aware)
Analyze the recent git history to understand what feature/update to announce:
Check recent commits:
git log --oneline -20
Check current diff (staged + unstaged):
git diff HEAD --stat
git diff HEAD -- '*.tsx' '*.jsx' '*.vue' '*.svelte' '*.html' '*.css' '*.scss' '*.rb' '*.erb'
Check recent branch name (often describes the feature):
git branch --show-current
Synthesize what the feature/update is from this context.
Present findings to user with AskUserQuestion:
- Header: "Feature"
- Question: "Based on recent changes, it looks like you're working on [X]. What should this announcement be about?"
- Options:
- "[Auto-detected feature description]" - Use what was detected
- "Something else" - Let user describe it
- If
$1 was provided as an argument, use that instead of asking.
Phase 3: Auto-Generate Announcement Text
Generate text elements for the image:
- Headline: A punchy, short headline (3-8 words) about the feature
- Tagline: A one-sentence supporting description
- Badge/Label: Optional category label (e.g., "New Feature", "Update", "Improvement")
Present these to the user with AskUserQuestion:
- Header: "Copy"
- Question: "Here's the text I'd put on the image. Want to adjust anything?"
- Options:
- "Looks good" - Use as-is
- "Edit headline" - User provides custom headline
- "Edit everything" - User provides all text
- "No text overlay" - Generate image without text
Phase 4: Choose Platform & Size
Use AskUserQuestion:
- Header: "Platform"
- Question: "What platform is this image for?"
- Options:
- "Twitter/X (1200x675)" - Standard Twitter card size
- "LinkedIn (1200x627)" - LinkedIn share image
- "Instagram (1080x1080)" - Square format
- "Open Graph (1200x630)" - Universal social preview
Store the chosen width and height for the Playwright viewport.
Phase 5: Choose Visual Style
Use AskUserQuestion:
- Header: "Style"
- Question: "What visual style should the image use?"
- Options:
- "Stylized mockup (Recommended)" - Simplified, polished recreation of UI elements using the app's actual components and CSS. Recognizable but not pixel-perfect.
- "Screenshot + overlay" - Takes a real screenshot of the running app and adds branded text overlays, gradients, and annotations.
- "Abstract/illustrative" - Uses brand colors and typography to create a geometric or gradient design that suggests the feature without replicating specific UI.
Style: Stylized Mockup
This is the most involved style. The goal is to create a representation of the UI that feels like the app without being a literal screenshot.
Find relevant UI components related to the feature:
- Search for component files that match the feature (e.g., if the feature is "dark mode", find theme toggle components)
- Read the component markup to understand the UI structure
- Note key visual elements: buttons, cards, inputs, tables, navigation items
Extract visual patterns from components:
- Border radius values
- Shadow styles
- Specific layout patterns (sidebar + main, card grids, etc.)
- Icon usage
- Interactive element styles (buttons, toggles, inputs)
Build a simplified HTML mockup that:
- Shows the key UI elements of the feature in a stylized, editorial layout
- Uses the actual brand colors, fonts, and border-radius from the codebase
- Adds subtle visual polish (soft shadows, slight gradients, generous whitespace)
- Frames the UI in a "browser window" or "device frame" if appropriate
- Is NOT a full working page -- it's a curated, art-directed composition
Style: Screenshot + Overlay
- Ask the user for the URL of the running app (suggest common localhost URLs)
- Navigate to the relevant page with Playwright
- Take a base screenshot
- Create an HTML overlay page that:
- Embeds the screenshot as a background image
- Adds a gradient overlay (using brand colors) for text readability
- Places headline and tagline text on top
- Adds a badge/label if applicable
- Screenshot the overlay page
Style: Abstract/Illustrative
Build an HTML page with:
- A gradient or geometric background using brand colors
- The project logo (if found in
/public, /assets, or /src/assets)
- Large, bold headline text using the project's font
- Supporting tagline
- Abstract shapes, lines, or patterns that evoke the feature category
- Clean, modern aesthetic with generous whitespace
Phase 6: Deep Brand Analysis
This is the most important phase. Spend real time here. The generated image must feel like it was made by the same team that built the product -- not a generic template with brand colors swapped in. The goal is to internalize the brand's visual identity so deeply that the image is indistinguishable from something the design team would produce.
6.1: Study Existing Marketing Materials First
Before looking at config files, study how the brand actually presents itself. These are your primary references:
Landing pages and marketing pages -- search for:
pages/index, app/page, pages/home, components/landing/, components/marketing/, components/hero
- Any files with
landing, marketing, home, hero, cta in the name
- Read these files thoroughly. Note the exact tone, layout patterns, how they compose text + visuals, gradient directions, decorative elements, background treatments
Existing social/OG images -- search for:
og-image, social, share, twitter, preview in /public or /assets
- Any existing announcement or marketing images in the repo
- These are your strongest reference for what the brand considers "on-brand" for social
Blog or changelog pages -- search for:
blog, changelog, updates, announcements in page/route files
- These show how the brand communicates updates -- mirror this tone and style
Email templates -- search for:
email, mailer, newsletter templates
- These reveal another facet of the brand's visual language
README and docs -- check for badges, banner images, or styled headers that reveal brand personality
6.2: Color Palette
Extract the full color system, not just primary/secondary:
Tailwind config (tailwind.config.js, tailwind.config.ts):
- Read the entire
theme.extend.colors block
- Note the full palette: primary, secondary, accent, neutral, success, warning, error
- Pay attention to color relationships -- how does the brand pair colors?
CSS custom properties (search for :root in global CSS files):
- Look for
--primary, --brand, --accent, --background, --foreground, --muted, --card or similar
- Extract HSL/RGB/hex values
- Note if there are separate light/dark mode palettes
Design token files (search for tokens, theme, design-system in filenames):
- Extract color definitions and semantic mappings
Actual usage in marketing components:
- Read hero sections, CTA buttons, feature cards, pricing tables
- Note which colors are used for backgrounds vs. text vs. accents vs. borders
- Look for gradient definitions -- exact stops, directions, and where they're used
- Find the brand's "signature" color combinations (e.g., dark bg + bright accent, soft pastels, bold primaries)
6.3: Typography
- Font imports (search for
@import with font URLs, @font-face, or Google Fonts links)
- Tailwind fontFamily config
- CSS font-family declarations on body/headings
- Package.json for font packages (e.g.,
@fontsource/*, next/font)
- Actual heading styles -- read marketing page headings to see:
- Font weight (bold? black? medium?)
- Letter spacing (tight? normal? wide?)
- Text transform (uppercase? normal?)
- Line height
- How headlines are sized relative to body text
For the image, use the detected font. If it's a Google Font, include the <link> tag in the HTML. If it's a local/custom font, fall back to a similar system font or Google Font alternative.
6.4: Logo & Assets
Search for logo files:
public/logo*, public/images/logo*, src/assets/logo*, assets/logo*
public/*.svg (check for logo-like SVGs)
public/brand*, src/assets/brand*
If a logo is found, embed it in the image (inline SVG or base64-encoded).
Also look for:
- Icon libraries or custom icon sets used in the app
- Illustration styles (line art? filled? duotone?)
- Background patterns or textures
- Decorative elements (dots, grids, blobs, rings)
6.5: Visual Language & Patterns
Go beyond basic config -- study the visual personality of the brand:
- Border radius: Is the app rounded (
rounded-xl, rounded-2xl) or sharp (rounded-none, rounded-sm)? Use the exact same radii.
- Shadows: Soft/elevated or flat? What shadow values are used? (e.g.,
shadow-lg vs shadow-sm vs no shadow)
- Dark mode: Is dark mode the default or primary theme? What's the background color?
- Gradients: Are gradients used prominently? What direction, what colors, where?
- Glass/blur effects: Any
backdrop-blur usage? Translucent cards?
- Borders: Are borders used for separation or are things borderless? What color/opacity?
- Spacing rhythm: Is the design dense and compact or airy with lots of whitespace?
- Decorative elements: Does the brand use background grids, dot patterns, glow effects, noise textures, gradient orbs?
- Animation style: While animation won't appear in the image, the feel of a brand that uses smooth spring animations vs. no animations tells you about its personality
6.6: Synthesize a Brand Brief
Before building the image, write a short internal summary of the brand's visual identity:
- "This brand uses [dark/light] backgrounds with [color] accents. Typography is [font] at [weight], [tight/normal] letter spacing. The aesthetic is [minimal/bold/playful/corporate]. Key visual motifs include [gradients/glass/sharp corners/etc]. Marketing pages use [layout pattern] with [decorative elements]."
Use this brief as your guide for every design decision in the image. Every element should pass the test: "Would this look at home on their landing page?"
Phase 7: Build the HTML Image Page
Unique temp files: To avoid race conditions when multiple agents run in parallel, generate a slug-based ID for this run. Format: {project-slug}-{feature-slug}-{short-id} where project slug comes from the directory name or package.json name, feature slug is a 2-3 word kebab-case summary of the feature, and short ID is 4-6 random alphanumeric chars. Example: baremetrics-dark-mode-a3f2. Use this slug in all temp file paths below (shown as [UNIQUE_ID]). Both the HTML file and the capture script must use the same slug.
Create a self-contained HTML file at /tmp/feature-image-[UNIQUE_ID]-page.html that:
- Is exactly the chosen dimensions (viewport-sized, no scroll)
- Embeds all styles inline (no external CSS dependencies)
- Includes fonts via Google Fonts link (or similar CDN)
- Uses the detected brand colors, fonts, and visual patterns
- Contains the chosen text overlay (headline, tagline, badge)
- Matches the chosen visual style (mockup, screenshot+overlay, or abstract)
HTML Structure Template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css2?family=[DETECTED_FONT]&display=swap" rel="stylesheet">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
width: [WIDTH]px;
height: [HEIGHT]px;
overflow: hidden;
font-family: '[DETECTED_FONT]', system-ui, sans-serif;
}
body {
background: [BRAND_GRADIENT_OR_COLOR];
color: [TEXT_COLOR];
display: flex;
/* Layout depends on style choice */
}
/* ... style-specific CSS ... */
</style>
</head>
<body>
<!-- Content depends on style choice -->
</body>
</html>
Design Quality Guidelines
The image should look like it was designed by a professional. Follow these principles:
- Hierarchy: Headline is the largest element. Tagline supports it. Badge is small.
- Contrast: Text must be easily readable against the background.
- Alignment: Use a clear grid. Left-align or center consistently.
- Polish: Subtle shadows, smooth gradients, refined typography (letter-spacing, line-height).
- Restraint: Don't use more than 2-3 colors. Don't use more than 2 font weights.
Space Usage (CRITICAL)
These images will be viewed at small sizes in social feeds, timeline cards, and link previews. Every pixel matters. Dead space is wasted space.
Mandatory rules:
- Fill the canvas. Content should use 85-95% of the available area. Padding should be tight -- 40-60px max on a 1200px-wide image, not 100+.
- Make text BIG. Headlines should be 48-72px minimum (at 1x). If the headline is short (3-4 words), go even bigger -- 80-100px. The text needs to be readable at thumbnail size (~400px wide). If you squint at the image and can't read the headline, it's too small.
- No empty centers. If the layout has a headline on top and a UI mockup on the bottom, don't leave a big gap in the middle. Stack elements tightly or fill the space with supporting content.
- UI mockups should be large. If showing a stylized UI element, it should take up at least 50-60% of the image area. Don't render a tiny card floating in a sea of background gradient.
- Edge-to-edge when appropriate. UI mockups can bleed off the edges of the canvas -- this looks more dynamic and uses space better than centering everything with margins.
- Badge/label text should be 14-18px, not smaller. It needs to be visible.
- Test at thumbnail size. Before finalizing, mentally shrink the image to 400px wide. Can you still read the headline? Can you tell what the UI shows? If not, make things bigger.
Common mistakes to avoid:
- A small headline centered in the middle of a large background -- scale it up, push it to a corner or edge
- A UI mockup that's 30% of the canvas surrounded by gradient -- make it dominant
- Excessive padding that makes content feel like it's floating in space
- Tagline text at 14-16px -- bump it to 20-24px minimum
- Using the same spacing between all elements instead of grouping related items tightly
Phase 8: Screenshot with Playwright
Create and run a Node.js script:
import { chromium } from 'playwright';
import { readFileSync } from 'fs';
async function capture() {
const browser = await chromium.launch();
const context = await browser.newContext({
viewport: { width: [WIDTH], height: [HEIGHT] },
deviceScaleFactor: 2, // Retina quality
});
const page = await context.newPage();
// Load the HTML file
const html = readFileSync('/tmp/feature-image-[UNIQUE_ID]-page.html', 'utf-8');
await page.setContent(html, { waitUntil: 'networkidle' });
// Wait for fonts to load
await page.waitForTimeout(1000);
await page.screenshot({
path: './feature-image.png',
type: 'png',
});
await browser.close();
console.log('Saved: ./feature-image.png');
}
capture().catch(console.error);
Save the script to /tmp/feature-image-[UNIQUE_ID]-capture.mjs, run it, then clean up:
node /tmp/feature-image-[UNIQUE_ID]-capture.mjs && rm /tmp/feature-image-[UNIQUE_ID]-capture.mjs /tmp/feature-image-[UNIQUE_ID]-page.html
Phase 9: Verify & Present
Check the file exists and has reasonable size:
ls -la ./feature-image.png
sips -g pixelWidth -g pixelHeight ./feature-image.png 2>/dev/null || file ./feature-image.png
Read the image using the Read tool to show it to the user.
Ask if adjustments are needed with AskUserQuestion:
- Header: "Result"
- Question: "Here's your feature image. What do you think?"
- Options:
- "Looks great" - Done
- "Adjust colors" - Tweak the color palette
- "Adjust text" - Change headline/tagline
- "Try different style" - Switch to another visual style
- If adjustments are needed, go back to the relevant phase and regenerate.
Output summary:
Generated: ./feature-image.png
Size: [W]x[H] @ 2x ([actual_W]x[actual_H] pixels)
Platform: [chosen platform]
Style: [chosen style]
Error Handling
- Playwright not found after install attempt: Suggest manual installation with
npm install -D playwright && npx playwright install chromium
- No git history: Skip git analysis, ask user directly what the feature is
- No brand colors found: Fall back to a clean, neutral palette (dark background, white text, blue accent)
- No fonts detected: Fall back to Inter (Google Font) as a safe, modern default
- Screenshot fails: Check if the HTML file was created correctly, try with a simpler layout
- Font not loading in screenshot: Increase the wait timeout, or fall back to system fonts
Tips for Best Results
- Run this skill from within the project directory so brand detection works
- If the app has a running dev server, the "Screenshot + overlay" style will produce the most authentic results
- For abstract style, the skill works well even without UI components to reference
- The generated image is 2x resolution (retina) -- it will look sharp on all screens
1---2author: luo-kai3name: feature-image-24argument-hint: [feature description]5description: "Generate a branded social media image announcing a new feature or update. Analyzes git history, auto-detects brand from codebase (Tailwind, CSS vars, design tokens), replicates UI elements, and captures via Playwright. Use when the user wants to create an announcement image, says 'feature image,' 'announcement graphic,' 'social image for feature,' or wants to visually announce a code change."6metadata:7 source: https://skillmd.com/skills/luokai0/feature-image-28---910Generate a branded social media image for announcing a feature or update. The image is built as an HTML page styled to match the project's brand, then screenshotted with Playwright.1112## Phase 1: Ensure Playwright is Available1314```bash15npx playwright --version 2>/dev/null || (echo "Installing Playwright..." && npx playwright install chromium)16```1718If installation fails, inform the user and suggest `npm install -D playwright && npx playwright install chromium`.1920## Phase 2: Understand What Changed (Git-Aware)2122Analyze the recent git history to understand what feature/update to announce:23241. **Check recent commits:**25 ```bash26 git log --oneline -2027 ```28292. **Check current diff (staged + unstaged):**30 ```bash31 git diff HEAD --stat32 git diff HEAD -- '*.tsx' '*.jsx' '*.vue' '*.svelte' '*.html' '*.css' '*.scss' '*.rb' '*.erb'33 ```34353. **Check recent branch name** (often describes the feature):36 ```bash37 git branch --show-current38 ```39404. **Synthesize** what the feature/update is from this context.41425. **Present findings to user** with `AskUserQuestion`:43 - Header: "Feature"44 - Question: "Based on recent changes, it looks like you're working on [X]. What should this announcement be about?"45 - Options:46 - "[Auto-detected feature description]" - Use what was detected47 - "Something else" - Let user describe it48 - If `$1` was provided as an argument, use that instead of asking.4950## Phase 3: Auto-Generate Announcement Text5152Generate text elements for the image:5354- **Headline**: A punchy, short headline (3-8 words) about the feature55- **Tagline**: A one-sentence supporting description56- **Badge/Label**: Optional category label (e.g., "New Feature", "Update", "Improvement")5758Present these to the user with `AskUserQuestion`:59- Header: "Copy"60- Question: "Here's the text I'd put on the image. Want to adjust anything?"61- Options:62 - "Looks good" - Use as-is63 - "Edit headline" - User provides custom headline64 - "Edit everything" - User provides all text65 - "No text overlay" - Generate image without text6667## Phase 4: Choose Platform & Size6869Use `AskUserQuestion`:70- Header: "Platform"71- Question: "What platform is this image for?"72- Options:73 - "Twitter/X (1200x675)" - Standard Twitter card size74 - "LinkedIn (1200x627)" - LinkedIn share image75 - "Instagram (1080x1080)" - Square format76 - "Open Graph (1200x630)" - Universal social preview7778Store the chosen width and height for the Playwright viewport.7980## Phase 5: Choose Visual Style8182Use `AskUserQuestion`:83- Header: "Style"84- Question: "What visual style should the image use?"85- Options:86 - "Stylized mockup (Recommended)" - Simplified, polished recreation of UI elements using the app's actual components and CSS. Recognizable but not pixel-perfect.87 - "Screenshot + overlay" - Takes a real screenshot of the running app and adds branded text overlays, gradients, and annotations.88 - "Abstract/illustrative" - Uses brand colors and typography to create a geometric or gradient design that suggests the feature without replicating specific UI.8990### Style: Stylized Mockup9192This is the most involved style. The goal is to create a representation of the UI that *feels* like the app without being a literal screenshot.93941. **Find relevant UI components** related to the feature:95 - Search for component files that match the feature (e.g., if the feature is "dark mode", find theme toggle components)96 - Read the component markup to understand the UI structure97 - Note key visual elements: buttons, cards, inputs, tables, navigation items98992. **Extract visual patterns from components:**100 - Border radius values101 - Shadow styles102 - Specific layout patterns (sidebar + main, card grids, etc.)103 - Icon usage104 - Interactive element styles (buttons, toggles, inputs)1051063. **Build a simplified HTML mockup** that:107 - Shows the key UI elements of the feature in a stylized, editorial layout108 - Uses the actual brand colors, fonts, and border-radius from the codebase109 - Adds subtle visual polish (soft shadows, slight gradients, generous whitespace)110 - Frames the UI in a "browser window" or "device frame" if appropriate111 - Is NOT a full working page -- it's a curated, art-directed composition112113### Style: Screenshot + Overlay1141151. Ask the user for the URL of the running app (suggest common localhost URLs)1162. Navigate to the relevant page with Playwright1173. Take a base screenshot1184. Create an HTML overlay page that:119 - Embeds the screenshot as a background image120 - Adds a gradient overlay (using brand colors) for text readability121 - Places headline and tagline text on top122 - Adds a badge/label if applicable1235. Screenshot the overlay page124125### Style: Abstract/Illustrative126127Build an HTML page with:128- A gradient or geometric background using brand colors129- The project logo (if found in `/public`, `/assets`, or `/src/assets`)130- Large, bold headline text using the project's font131- Supporting tagline132- Abstract shapes, lines, or patterns that evoke the feature category133- Clean, modern aesthetic with generous whitespace134135## Phase 6: Deep Brand Analysis136137This is the most important phase. Spend real time here. The generated image must feel like it was made by the same team that built the product -- not a generic template with brand colors swapped in. The goal is to internalize the brand's visual identity so deeply that the image is indistinguishable from something the design team would produce.138139### 6.1: Study Existing Marketing Materials First140141Before looking at config files, study how the brand actually presents itself. These are your primary references:1421431. **Landing pages and marketing pages** -- search for:144 - `pages/index`, `app/page`, `pages/home`, `components/landing/`, `components/marketing/`, `components/hero`145 - Any files with `landing`, `marketing`, `home`, `hero`, `cta` in the name146 - Read these files thoroughly. Note the exact tone, layout patterns, how they compose text + visuals, gradient directions, decorative elements, background treatments1471482. **Existing social/OG images** -- search for:149 - `og-image`, `social`, `share`, `twitter`, `preview` in `/public` or `/assets`150 - Any existing announcement or marketing images in the repo151 - These are your strongest reference for what the brand considers "on-brand" for social1521533. **Blog or changelog pages** -- search for:154 - `blog`, `changelog`, `updates`, `announcements` in page/route files155 - These show how the brand communicates updates -- mirror this tone and style1561574. **Email templates** -- search for:158 - `email`, `mailer`, `newsletter` templates159 - These reveal another facet of the brand's visual language1601615. **README and docs** -- check for badges, banner images, or styled headers that reveal brand personality162163### 6.2: Color Palette164165Extract the full color system, not just primary/secondary:1661671. **Tailwind config** (`tailwind.config.js`, `tailwind.config.ts`):168 - Read the entire `theme.extend.colors` block169 - Note the full palette: primary, secondary, accent, neutral, success, warning, error170 - Pay attention to color *relationships* -- how does the brand pair colors?1711722. **CSS custom properties** (search for `:root` in global CSS files):173 - Look for `--primary`, `--brand`, `--accent`, `--background`, `--foreground`, `--muted`, `--card` or similar174 - Extract HSL/RGB/hex values175 - Note if there are separate light/dark mode palettes1761773. **Design token files** (search for `tokens`, `theme`, `design-system` in filenames):178 - Extract color definitions and semantic mappings1791804. **Actual usage in marketing components**:181 - Read hero sections, CTA buttons, feature cards, pricing tables182 - Note which colors are used for backgrounds vs. text vs. accents vs. borders183 - Look for gradient definitions -- exact stops, directions, and where they're used184 - Find the brand's "signature" color combinations (e.g., dark bg + bright accent, soft pastels, bold primaries)185186### 6.3: Typography1871881. **Font imports** (search for `@import` with font URLs, `@font-face`, or Google Fonts links)1892. **Tailwind fontFamily config**1903. **CSS font-family declarations** on body/headings1914. **Package.json** for font packages (e.g., `@fontsource/*`, `next/font`)1925. **Actual heading styles** -- read marketing page headings to see:193 - Font weight (bold? black? medium?)194 - Letter spacing (tight? normal? wide?)195 - Text transform (uppercase? normal?)196 - Line height197 - How headlines are sized relative to body text198199For the image, use the detected font. If it's a Google Font, include the `<link>` tag in the HTML. If it's a local/custom font, fall back to a similar system font or Google Font alternative.200201### 6.4: Logo & Assets202203Search for logo files:204```205public/logo*, public/images/logo*, src/assets/logo*, assets/logo*206public/*.svg (check for logo-like SVGs)207public/brand*, src/assets/brand*208```209210If a logo is found, embed it in the image (inline SVG or base64-encoded).211212Also look for:213- Icon libraries or custom icon sets used in the app214- Illustration styles (line art? filled? duotone?)215- Background patterns or textures216- Decorative elements (dots, grids, blobs, rings)217218### 6.5: Visual Language & Patterns219220Go beyond basic config -- study the visual *personality* of the brand:221222- **Border radius**: Is the app rounded (`rounded-xl`, `rounded-2xl`) or sharp (`rounded-none`, `rounded-sm`)? Use the exact same radii.223- **Shadows**: Soft/elevated or flat? What shadow values are used? (e.g., `shadow-lg` vs `shadow-sm` vs no shadow)224- **Dark mode**: Is dark mode the default or primary theme? What's the background color?225- **Gradients**: Are gradients used prominently? What direction, what colors, where?226- **Glass/blur effects**: Any `backdrop-blur` usage? Translucent cards?227- **Borders**: Are borders used for separation or are things borderless? What color/opacity?228- **Spacing rhythm**: Is the design dense and compact or airy with lots of whitespace?229- **Decorative elements**: Does the brand use background grids, dot patterns, glow effects, noise textures, gradient orbs?230- **Animation style**: While animation won't appear in the image, the *feel* of a brand that uses smooth spring animations vs. no animations tells you about its personality231232### 6.6: Synthesize a Brand Brief233234Before building the image, write a short internal summary of the brand's visual identity:235236- "This brand uses [dark/light] backgrounds with [color] accents. Typography is [font] at [weight], [tight/normal] letter spacing. The aesthetic is [minimal/bold/playful/corporate]. Key visual motifs include [gradients/glass/sharp corners/etc]. Marketing pages use [layout pattern] with [decorative elements]."237238Use this brief as your guide for every design decision in the image. Every element should pass the test: "Would this look at home on their landing page?"239240## Phase 7: Build the HTML Image Page241242**Unique temp files:** To avoid race conditions when multiple agents run in parallel, generate a slug-based ID for this run. Format: `{project-slug}-{feature-slug}-{short-id}` where project slug comes from the directory name or package.json name, feature slug is a 2-3 word kebab-case summary of the feature, and short ID is 4-6 random alphanumeric chars. Example: `baremetrics-dark-mode-a3f2`. Use this slug in all temp file paths below (shown as `[UNIQUE_ID]`). Both the HTML file and the capture script must use the same slug.243244Create a self-contained HTML file at `/tmp/feature-image-[UNIQUE_ID]-page.html` that:2452461. **Is exactly the chosen dimensions** (viewport-sized, no scroll)2472. **Embeds all styles inline** (no external CSS dependencies)2483. **Includes fonts via Google Fonts link** (or similar CDN)2494. **Uses the detected brand colors, fonts, and visual patterns**2505. **Contains the chosen text overlay** (headline, tagline, badge)2516. **Matches the chosen visual style** (mockup, screenshot+overlay, or abstract)252253### HTML Structure Template254255```html256<!DOCTYPE html>257<html>258<head>259 <meta charset="utf-8">260 <link href="https://fonts.googleapis.com/css2?family=[DETECTED_FONT]&display=swap" rel="stylesheet">261 <style>262 * { margin: 0; padding: 0; box-sizing: border-box; }263 html, body {264 width: [WIDTH]px;265 height: [HEIGHT]px;266 overflow: hidden;267 font-family: '[DETECTED_FONT]', system-ui, sans-serif;268 }269 body {270 background: [BRAND_GRADIENT_OR_COLOR];271 color: [TEXT_COLOR];272 display: flex;273 /* Layout depends on style choice */274 }275 /* ... style-specific CSS ... */276 </style>277</head>278<body>279 <!-- Content depends on style choice -->280</body>281</html>282```283284### Design Quality Guidelines285286The image should look like it was designed by a professional. Follow these principles:287288- **Hierarchy**: Headline is the largest element. Tagline supports it. Badge is small.289- **Contrast**: Text must be easily readable against the background.290- **Alignment**: Use a clear grid. Left-align or center consistently.291- **Polish**: Subtle shadows, smooth gradients, refined typography (letter-spacing, line-height).292- **Restraint**: Don't use more than 2-3 colors. Don't use more than 2 font weights.293294### Space Usage (CRITICAL)295296These images will be viewed at small sizes in social feeds, timeline cards, and link previews. Every pixel matters. Dead space is wasted space.297298**Mandatory rules:**2993001. **Fill the canvas.** Content should use 85-95% of the available area. Padding should be tight -- 40-60px max on a 1200px-wide image, not 100+.3012. **Make text BIG.** Headlines should be 48-72px minimum (at 1x). If the headline is short (3-4 words), go even bigger -- 80-100px. The text needs to be readable at thumbnail size (~400px wide). If you squint at the image and can't read the headline, it's too small.3023. **No empty centers.** If the layout has a headline on top and a UI mockup on the bottom, don't leave a big gap in the middle. Stack elements tightly or fill the space with supporting content.3034. **UI mockups should be large.** If showing a stylized UI element, it should take up at least 50-60% of the image area. Don't render a tiny card floating in a sea of background gradient.3045. **Edge-to-edge when appropriate.** UI mockups can bleed off the edges of the canvas -- this looks more dynamic and uses space better than centering everything with margins.3056. **Badge/label text should be 14-18px**, not smaller. It needs to be visible.3067. **Test at thumbnail size.** Before finalizing, mentally shrink the image to 400px wide. Can you still read the headline? Can you tell what the UI shows? If not, make things bigger.307308**Common mistakes to avoid:**309- A small headline centered in the middle of a large background -- scale it up, push it to a corner or edge310- A UI mockup that's 30% of the canvas surrounded by gradient -- make it dominant311- Excessive padding that makes content feel like it's floating in space312- Tagline text at 14-16px -- bump it to 20-24px minimum313- Using the same spacing between all elements instead of grouping related items tightly314315## Phase 8: Screenshot with Playwright316317Create and run a Node.js script:318319```javascript320import { chromium } from 'playwright';321import { readFileSync } from 'fs';322323async function capture() {324 const browser = await chromium.launch();325 const context = await browser.newContext({326 viewport: { width: [WIDTH], height: [HEIGHT] },327 deviceScaleFactor: 2, // Retina quality328 });329 const page = await context.newPage();330331 // Load the HTML file332 const html = readFileSync('/tmp/feature-image-[UNIQUE_ID]-page.html', 'utf-8');333 await page.setContent(html, { waitUntil: 'networkidle' });334335 // Wait for fonts to load336 await page.waitForTimeout(1000);337338 await page.screenshot({339 path: './feature-image.png',340 type: 'png',341 });342343 await browser.close();344 console.log('Saved: ./feature-image.png');345}346347capture().catch(console.error);348```349350Save the script to `/tmp/feature-image-[UNIQUE_ID]-capture.mjs`, run it, then clean up:351352```bash353node /tmp/feature-image-[UNIQUE_ID]-capture.mjs && rm /tmp/feature-image-[UNIQUE_ID]-capture.mjs /tmp/feature-image-[UNIQUE_ID]-page.html354```355356## Phase 9: Verify & Present3573581. **Check the file exists and has reasonable size:**359 ```bash360 ls -la ./feature-image.png361 sips -g pixelWidth -g pixelHeight ./feature-image.png 2>/dev/null || file ./feature-image.png362 ```3633642. **Read the image** using the Read tool to show it to the user.3653663. **Ask if adjustments are needed** with `AskUserQuestion`:367 - Header: "Result"368 - Question: "Here's your feature image. What do you think?"369 - Options:370 - "Looks great" - Done371 - "Adjust colors" - Tweak the color palette372 - "Adjust text" - Change headline/tagline373 - "Try different style" - Switch to another visual style374 - If adjustments are needed, go back to the relevant phase and regenerate.3753764. **Output summary:**377 ```378 Generated: ./feature-image.png379 Size: [W]x[H] @ 2x ([actual_W]x[actual_H] pixels)380 Platform: [chosen platform]381 Style: [chosen style]382 ```383384## Error Handling385386- **Playwright not found after install attempt**: Suggest manual installation with `npm install -D playwright && npx playwright install chromium`387- **No git history**: Skip git analysis, ask user directly what the feature is388- **No brand colors found**: Fall back to a clean, neutral palette (dark background, white text, blue accent)389- **No fonts detected**: Fall back to Inter (Google Font) as a safe, modern default390- **Screenshot fails**: Check if the HTML file was created correctly, try with a simpler layout391- **Font not loading in screenshot**: Increase the wait timeout, or fall back to system fonts392393## Tips for Best Results3943951. Run this skill from within the project directory so brand detection works3962. If the app has a running dev server, the "Screenshot + overlay" style will produce the most authentic results3973. For abstract style, the skill works well even without UI components to reference3984. The generated image is 2x resolution (retina) -- it will look sharp on all screens