ad-engine

Assemble modular ads from Supabase components and deploy to Facebook Ads Manager via the Marketing API. Supports preview, single/batch deploy, and status tracking. Uses ad_components table for A/B testing at scale.

3,891 stars

Best use case

ad-engine is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Assemble modular ads from Supabase components and deploy to Facebook Ads Manager via the Marketing API. Supports preview, single/batch deploy, and status tracking. Uses ad_components table for A/B testing at scale.

Teams using ad-engine should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ad-engine/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/aces1up/ad-engine/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ad-engine/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ad-engine Compares

Feature / Agentad-engineStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Assemble modular ads from Supabase components and deploy to Facebook Ads Manager via the Marketing API. Supports preview, single/batch deploy, and status tracking. Uses ad_components table for A/B testing at scale.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Ad Engine — Facebook Ads Deployment

Assemble ads from database components and deploy to Facebook. Reads from Supabase `ad_components` + `messages` tables, assembles full ad copy, uploads images, and creates Campaign → Ad Set → Ad in Facebook Ads Manager.

## First-Time Setup

**1. Facebook prerequisites (one-time, manual):**
- Facebook Business Manager account
- Ad Account created
- Facebook Page connected
- Facebook Developer App with `ads_management` permission
- Long-lived access token (generate at developers.facebook.com)

**2. Store credentials:**
```bash
python3 scripts/fb_deploy.py --setup
```
Prompts for access token, ad account ID, and page ID. Validates against FB API and saves to `~/.config/ad-engine/fb_config.json`.

## Usage

**Preview assembled ads (no deployment):**
```bash
# Preview a single ad
python3 scripts/fb_deploy.py --preview --message-id 8555

# Preview all draft ads for a campaign
python3 scripts/fb_deploy.py --preview --campaign-id 43

# Preview as JSON
python3 scripts/fb_deploy.py --preview --campaign-id 43 --json
```

**Deploy a single ad:**
```bash
python3 scripts/fb_deploy.py --deploy \
  --message-id 8556 \
  --image /path/to/security-audit-ad.png \
  --landing-url "https://calendly.com/your-link" \
  --objective messages
```

**Deploy all draft ads for a campaign:**
```bash
python3 scripts/fb_deploy.py --deploy \
  --campaign-id 43 \
  --image-dir /path/to/ad-images/ \
  --landing-url "https://calendly.com/your-link" \
  --objective messages
```

**Dry run (preview what would be created):**
```bash
python3 scripts/fb_deploy.py --deploy \
  --campaign-id 43 \
  --image-dir /path/to/images/ \
  --landing-url "https://calendly.com/link" \
  --dry-run
```

**Check deployed ad status + live metrics:**
```bash
python3 scripts/fb_deploy.py --status --campaign-id 43
```

## Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `--preview` | One of | Preview assembled ads without deploying |
| `--deploy` | these | Deploy ads to Facebook |
| `--status` | three | Check status of deployed ads |
| `--setup` | | Configure Facebook credentials |
| `--message-id` | For single | Specific message ID to preview/deploy |
| `--campaign-id` | For batch | All draft ads in a campaign |
| `--image` | Deploy single | Image file path |
| `--image-dir` | Deploy batch | Directory of images (matched by angle name in filename) |
| `--landing-url` | Deploy | Booking/landing page URL |
| `--objective` | No | `leads` (default), `messages`, or `link_clicks` |
| `--dry-run` | No | Preview deployment without creating anything |
| `--json` | No | Output as JSON |

## Image Naming Convention

When using `--image-dir` for batch deploy, name images by angle:
```
security-audit-ad.png      → matches angle "security_audit"
setup-is-hell-ad.png       → matches angle "setup_is_hell"
dm-trigger-checklist.png   → matches angle "dm_trigger"
anti-wrapper-graveyard.png → matches angle "anti_wrapper"
```

## How It Works

1. Reads message from Supabase `messages` table (content_type = 'fb_ad')
2. Reads component references from message's `extra_data.components`
3. Resolves component keys → actual text from `ad_components` table
4. Slots components into framework template using `{{merge_tags}}`
5. Uploads image to Facebook → gets image_hash
6. Creates Campaign (if new) → Ad Set (if new) → Ad Creative → Ad
7. Updates message status to 'deployed' with FB IDs stored in extra_data

## Database Schema

See `AD_ENGINE_SPEC.md` for full schema documentation.

## Dependencies

- `psycopg2-binary` — Supabase Postgres connection
- `facebook-business` — Facebook Marketing API SDK
- `requests` — HTTP client
- All auto-installed on first run.

Related Skills

PRD Engine — Product Requirements That Ship

3891
from openclaw/skills

Complete product requirements methodology: from idea to spec to shipped feature. Not just a JSON template — a full system for writing PRDs that developers actually follow and stakeholders actually approve.

Workflow & Productivity

Performance Review Engine

3891
from openclaw/skills

> Your AI-powered performance management system. Write reviews that develop people, not just evaluate them. From self-assessments to 360° feedback to calibration — complete frameworks for every review cycle.

Workflow & Productivity

afrexai-performance-engineering

3891
from openclaw/skills

Complete performance engineering system — profiling, optimization, load testing, capacity planning, and performance culture. Use when diagnosing slow applications, optimizing code/queries/infrastructure, load testing before launch, planning capacity, or building performance into CI/CD. Covers Node.js, Python, Go, Java, databases, APIs, and frontend.

DevOps & Infrastructure

Partnership & Channel Revenue Engine

3891
from openclaw/skills

Turn partnerships from handshake deals into a systematic revenue machine. This is the complete playbook for finding, qualifying, structuring, launching, and scaling partner-driven growth — whether you're building integration partnerships, reseller channels, affiliate programs, or strategic alliances.

Workflow & Productivity

OpenClaw Mastery — The Complete Agent Engineering & Operations System

3891
from openclaw/skills

> Built by AfrexAI — the team that runs 9+ production agents 24/7 on OpenClaw.

DevOps & Infrastructure

afrexai-okr-engine

3891
from openclaw/skills

Complete OKR & Strategy Execution system — from company vision to weekly execution. Covers goal hierarchy, OKR writing methodology, scoring rubrics, alignment cascading, KPI dashboards, review cadences, team accountability, and quarterly planning rituals. Use when setting goals, running planning cycles, tracking OKRs, building KPI dashboards, running retrospectives, or aligning team work to strategy. Trigger on: "OKR", "objectives", "key results", "goal setting", "quarterly planning", "KPIs", "strategy execution", "annual planning", "team goals", "alignment", "review cadence", "what should we focus on", "prioritize", "goal tracking", "north star metric".

Workflow & Productivity

afrexai-observability-engine

3891
from openclaw/skills

Complete observability & reliability engineering system. Use when designing monitoring, implementing structured logging, setting up distributed tracing, building alerting systems, creating SLO/SLI frameworks, running incident response, conducting post-mortems, or auditing system reliability. Covers all three pillars (logs/metrics/traces), alert design, dashboard architecture, on-call operations, chaos engineering, and cost optimization.

Next.js Production Engineering

3891
from openclaw/skills

> Complete methodology for building, optimizing, and operating production Next.js applications. From architecture decisions to deployment strategies — everything beyond "hello world."

n8n Workflow Mastery — Complete Automation Engineering System

3891
from openclaw/skills

You are an expert n8n workflow architect. You design, build, debug, optimize, and scale n8n automations following production-grade methodology. Every workflow you create is complete, functional, and follows the patterns in this guide.

Workflow & Productivity

ML & AI Engineering System

3891
from openclaw/skills

Complete methodology for building, deploying, and operating production ML/AI systems — from experiment to scale.

Meeting Mastery — AI Meeting Prep, Notes & Follow-Up Engine

3891
from openclaw/skills

You are an elite meeting preparation and follow-up agent. You ensure every meeting is high-value — thoroughly prepared beforehand, cleanly documented during, and actioned after.

Workflow & Productivity

MCP Engineering — Complete Model Context Protocol System

3891
from openclaw/skills

Build, integrate, secure, and scale MCP servers and clients. From first server to production multi-tool architecture.

AI Infrastructure & Integrations