Og image

From dirnbauer/webconsulting-skills · View interactive version

Og image is an AI agent skill from the GitHub repository dirnbauer/webconsulting-skills. Generate social media preview images (Open Graph) and configure meta tags. Creates a screenshot-optimized page using the project's existing design system, captures it at 1200x630, and sets up all social sharing meta tags.

How to use this skill

Skill file

This skill creates professional Open Graph images for social media sharing. It analyzes the existing codebase to match the project's design system, generates a dedicated OG image page, screenshots it, and configures all necessary meta tags.

Workflow

Phase 1: Codebase Analysis

Explore the project to understand:

  1. Framework Detection
  1. Design System Discovery
  1. Branding Assets
  1. Product Information
  1. Existing Components

Phase 2: OG Image Page Creation

Create a dedicated route at /og-image (or equivalent for the framework):

Page Requirements:

[data-nextjs-dialog-overlay],
[data-nextjs-dialog],
nextjs-portal,
#__next-build-indicator {
  display: none !important;
}

Content Structure:

Design Principles:

Phase 3: Screenshot Capture

Use Playwright to capture the OG image:

  1. Navigate to the OG image page (typically http://localhost:3000/og-image or similar)
  2. Resize viewport to exactly 1200×630
  3. Wait for any animations to complete or fonts to load
  4. Take a PNG screenshot
  5. Save to the project's public folder as og-image.png

Playwright Commands:

browser_navigate: http://localhost:{port}/og-image
browser_resize: width=1200, height=630
browser_take_screenshot: og-image.png (then copy to /public)

Phase 4: Meta Tag Configuration

Audit and update the project's meta tag configuration. For Next.js App Router, update layout.tsx. For other frameworks, update the appropriate location.

Required Meta Tags:

// Open Graph
openGraph: {
  title: "Product Name - Short Description",
  description: "Compelling description for social sharing",
  url: "https://yourdomain.com",
  siteName: "Product Name",
  locale: "en_US",
  type: "website",
  images: [{
    url: "/og-image.png",  // or absolute URL
    width: 1200,
    height: 630,
    alt: "Descriptive alt text for accessibility",
    type: "image/png",
  }],
},

// Twitter/X
twitter: {
  card: "summary_large_image",
  title: "Product Name - Short Description",
  description: "Compelling description for Twitter",
  creator: "@handle",  // if provided
  images: [{
    url: "/og-image.png",
    width: 1200,
    height: 630,
    alt: "Descriptive alt text",
  }],
},

// Additional
other: {
  "theme-color": "#000000",  // match brand color
  "msapplication-TileColor": "#000000",
},

appleWebApp: {
  title: "Product Name",
  statusBarStyle: "black-translucent",
  capable: true,
},

Ensure metadataBase is set for relative URLs to resolve correctly:

metadataBase: new URL("https://yourdomain.com"),

Phase 5: Verification & Output

  1. Verify the image exists at the public path
  2. Check meta tags are correctly rendered in the HTML
  3. Provide cache-busting instructions:
  1. Summary output:

Prompting for Missing Information

Only ask the user if these cannot be determined from the codebase:

  1. Domain/URL - If not found in existing config, ask: "What's your production domain? (e.g., https://example.com)"
  1. Twitter/X handle - If adding twitter:creator, ask: "What's your Twitter/X handle for attribution? (optional)"
  1. Tagline - If no clear tagline found, ask: "What's a short tagline for social previews? (1 sentence)"

Framework-Specific Notes

Next.js App Router:

Next.js Pages Router:

Vite/React:

Astro:

Quality Checklist

Before completing, verify:


Credits & Attribution

This skill is based on the excellent work by

Stevy Smith.

Original repository: https://github.com/stevysmith/og-image-skill

Special thanks to Stevy Smith for their generous open-source contributions, which helped shape this skill collection.

Adapted by webconsulting.at for this skill collection

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.