---
name: "nextjs-dynamic-og-image-generation"
description: "Generate branded, dynamic Open Graph social card images on-the-fly using @vercel/og and JSX."
metadata:
  author: "Vercel"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "generate dynamic og image nextjs"
  - "create opengraph-image.tsx"
  - "load custom font vercel og"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Next.js Dynamic Open Graph (OG) Image Generation

Configures dynamic metadata in Next.js: authoring opengraph-image.tsx using ImageResponse, styling with Flexbox and SVG, loading custom Google fonts, and embedding dynamic post titles and author avatars.

## When to Invoke
Invoke this skill whenever you need to:
- generate dynamic og image nextjs
- create opengraph-image.tsx
- load custom font vercel og

## Execution SOP & Rules
1. Create opengraph-image.tsx alongside page.tsx exporting export const size = { width: 1200, height: 630 }.
2. Return new ImageResponse(<div style={{ display: 'flex' }}>...</div>, { ...size, fonts: [...] }).
3. Use standard inline CSS styles supported by Satori (flexbox, absolute positioning).
4. Verify social previews using socialsharepreview or Twitter/Facebook URL debuggers.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
