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.
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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ad-engine/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How ad-engine Compares
| Feature / Agent | ad-engine | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/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
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
Best AI Agents for Marketing
A curated list of the best AI agents and skills for marketing teams focused on SEO, content systems, outreach, and campaign execution.
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
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.
Performance Review Engine
> 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.
afrexai-performance-engineering
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.
Partnership & Channel Revenue Engine
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.
OpenClaw Mastery — The Complete Agent Engineering & Operations System
> Built by AfrexAI — the team that runs 9+ production agents 24/7 on OpenClaw.
afrexai-okr-engine
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".
afrexai-observability-engine
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
> 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
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.
ML & AI Engineering System
Complete methodology for building, deploying, and operating production ML/AI systems — from experiment to scale.
Meeting Mastery — AI Meeting Prep, Notes & Follow-Up Engine
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.
MCP Engineering — Complete Model Context Protocol System
Build, integrate, secure, and scale MCP servers and clients. From first server to production multi-tool architecture.