Skip to main content
Designing eye-catching social media creatives using an AI agent requires it to have a lot of context: your product features, voice, target audience, and design tokens. Your agent needs to crawl your marketing site, distill its positioning and design system, then generate on-brand campaign ideas, copy, and social creatives for every platform. In this guide, we build a pipeline that does this at scale using Context.dev’s APIs and some popular agent skills. Try it: drop a domain in and render three example artboards — square post, landscape, and hero banner — using the brand’s website styleguide palette.

Architecture

The pipeline runs in four phases. The leverage is grounding every phase in the brand’s real site instead of a blank prompt.
  1. Gather crawls the whole marketing site to Markdown (Web Scraping API) and pulls the brand kit (Brand API) and design tokens (Styleguide API).
  2. Distill runs the product-marketing-context skill over the crawl to capture positioning, audience, and voice, turns the brand kit into a design guide, and generates net-new campaign ideas grounded in that positioning.
  3. Write runs the copywriting skill on the chosen idea for an on-brand headline, supporting line, and CTA.
  4. Render lays out the creative from the design guide and copy, then rasterizes it to each platform size.
Phases 2 and 3 run in your coding agent through the two skills; the rest is code. Gather once per brand and reuse the corpus, positioning, and design guide across every idea, creative, and size.

Prerequisites

  • A Context.dev API key. Grab one from the dashboard and export it as CONTEXT_DEV_API_KEY.
  • An Anthropic API key for the model calls in Steps 2 through 4. Export it as ANTHROPIC_API_KEY.
  • The Context.dev SDK for your backend:

Step 1. Gather the brand’s site

The first step is always to understand the product deeply. To do this, your AI agent needs context. It needs to know what your product does and who it’s for. You will also need your brand’s logos and styleguides. For this we’ll use:
  1. The Brand API to get brand name, description, slogans, backdrops, and all logo variants.
  2. The Web Scraping API to crawl reachable marketing-site pages as clean Markdown.
  3. The Styleguide API to get exact colors, component CSS, spacing, fonts, shadows, etc.
Brand · 10 credits Styleguide · 10 credits Crawl · 1 credit per page The crawl bills 1 credit per page, so cost depends on how big the marketing site is. Use maxPages (default 100, max 500) and urlRegex to crawl fewer, more specific pages.

Step 2. Distill positioning and generate ideas

Next, we need the agent to come up with campaign ideas. Instead of trying to engineer the perfect prompt, we recommend using a skill. Run Corey Haines’ product-marketing-context on your coding agent with access to all the context we gathered in the last step. Make sure to specifically prompt it to generate 10 ideas for social media campaigns.

Step 3. Write the copy

Now you need to pick the ideas you like best. You can also fix or add new ideas. Then run Corey Haines’ copywriting skill on it, with a prompt specifying how you want the output.

Step 4. Render the creative across sizes

Before we get an LLM to render the images, we need to specify the sizes. This script contains 6 of the most popular social media post sizes:
  • Instagram Story
  • Instagram Square Post
  • Instagram Portrait Post
  • X image card
  • LinkedIn Banner
  • YouTube video thumbnail
Edit this to include all the variants you want.
This pipeline designs the creatives in HTML/CSS/JS instead of using an image model because this way is cheaper, leads to fewer hallucinations, can be customized easily, and the text stays crisp and editable. So we will fan out one agent per idea, in parallel, handing each the design guide, the full set of sizes, and its idea. Each returns a single self-contained mockup that lays out every platform size, with a Download PNG button under each artboard that exports it to an image in the browser.

System prompt for the creative designer

Next steps

Web Scraping API

Crawl a whole site to clean Markdown, the corpus the positioning skill reads.

Styleguide API

Fonts, colors, and component CSS for the design guide.

product-marketing-context skill

Turns the crawl into positioning, audience, and brand voice.

copywriting skill

Writes on-brand copy from that positioning.