Generate Winning Ads While You Sleep
What this gives you: A system that generates ad copy variations, creates visual assets, tracks what works, and continuously improves your cost per lead. The Karpathy method applied to advertising.
Most people write one ad, run it, wonder why it underperforms, and give up. The ones who win run structured experiments, log every result, and let the data drive the next iteration. This guide gives you that system.
The Auto-Research Loop
Andrej Karpathy popularised a simple but powerful framework for continuous improvement in any measurable system. It works just as well for ad creative as it does for neural networks.
The loop has five steps:
- Define your metric. For ads, this is CPL - cost per lead. Pick one number and track only that.
- Form a hypothesis. A specific, falsifiable statement. "Demo-first hooks will lower CPL by 20% compared to pain-point hooks."
- Make the change. Change exactly one variable. If you change two things at once, you learn nothing.
- Assess the result. Run for at least 48 hours with equal budget. Compare CPL, CTR, and conversion rate.
- Log and repeat. If the variant wins, it becomes the new control. If it loses, you still log the result - negative findings are data too.
Applied to ads: your baseline is your current best-performing creative. Every test is a hypothesis about what will beat it. Claude Code generates the variants. You run the numbers. The loop runs continuously.
Ad Copy Generation
Use this prompt template in Claude Code to generate Facebook and Meta ad variations. Swap the bracketed fields for your business, and run it every time you need a new batch of creative.
The rules section does most of the work. "Lead with a specific result" forces demo-first hooks. "Include a number" forces specificity. Banning rhetorical questions and pain-point openers eliminates the two most overused formulas in direct response advertising.
Run this prompt, take the 5 outputs, and pick the 2-3 that feel most authentic to your offer. Those go into testing. The rest go into a swipe file for future reference.
What Makes Hooks Work
Demo-first hooks outperform everything else. This is not a theory - it is consistently the highest-performing format across performance data going back years. The reason is simple: a demo proves the claim before the reader has time to object.
| Hook Type | Example | Why It Performs |
|---|---|---|
| Demo-first (best) | "We booked 47 appointments last month using one AI voice agent." | Specific result + implicit proof. The number does the selling. |
| Outcome-first | "Our clients cut their CPL from $42 to $14 in 30 days." | Comparison creates contrast. Before/after is a powerful frame. |
| Curiosity (use carefully) | "This one change dropped our no-show rate by 60%." | Works only when the mechanism is genuinely non-obvious. |
| Pain-point (weakest) | "Tired of chasing leads that never convert?" | Every competitor writes this. Reader is desensitised to it. |
| Rhetorical question (avoid) | "Struggling to fill your calendar?" | Signals low confidence in the offer. Readers scroll past. |
The practical rule: if your hook could apply to any business in your space, it is too generic. "We booked 47 appointments for a solar installer in Bristol in March" is specific enough that it could only be you.
Visual Creative with fal.ai
Use Nano Banana 2 via fal.ai for ad image generation. The same principles that apply to thumbnails apply here: use real photos of real people, keep compositions simple, and treat text as a design element rather than an afterthought.
Three rules for ad visuals that consistently outperform:
- Face + text + 1 prop maximum. Every additional element splits attention. The image's one job is to stop the scroll.
- White text on dark backgrounds. Highest contrast ratio, highest readability in feed. Dark text on light backgrounds gets lost.
- Never use Kling or similar models for ad creative. They mangle text overlays and produce inconsistent faces. Nano Banana 2 at strength 0.50-0.55 preserves faces correctly.
The Testing Framework
Every test needs four defined elements before you run it. Without these, you cannot interpret the result.
The single-variable rule is non-negotiable. If you change the hook and the image in the same test, you will not know which change drove the result. Discipline here is what separates useful data from expensive guesses.
After 48 hours, check three numbers in order:
- CPL. The primary metric. If it is lower on the variant, the variant wins.
- CTR. If CPL is similar but CTR is higher on the variant, the variant has better hooks but the landing page may be the bottleneck.
- Conversion rate. If CTR is high but CPL is high, the landing page is failing the ad's promise.
The winner becomes the new control. The loser gets logged. Both outcomes advance the loop.
Logging Results
Create a file called ad-tests.md in your project folder. Every test goes in here in exactly this format:
The format matters. Hypothesis first forces you to commit before you see results. Logging the action means future-you can see the full decision chain, not just the data points. Over time, this file becomes a proprietary research asset - no competitor has your specific data about your specific audience.
Scaling with Sub-Agents
When you need 25+ variations across multiple angles, single-agent generation is too slow and too expensive. Use Claude Code's parallelization pattern instead.
This approach costs approximately 60% less than running the same task sequentially with Opus. Sonnet handles the generation work - which is primarily pattern-following - and Opus handles the synthesis work, which requires genuine comparative judgment.
The output: 3-5 high-confidence ad variants, ranked with reasoning, ready for testing. Run them through your testing framework and start the loop.
Platform-Specific Adjustments
The base prompt generates generic copy. Each platform needs a small modification to the format constraints.
| Platform | Key Constraint | Prompt Adjustment |
|---|---|---|
| Facebook / Meta | 125 characters for best display in primary text | Add: "Primary text: max 125 characters. Hook only. Body in first comment or expanded text." |
| Google Search | Headline: 30 chars, Description: 90 chars | Add: "Format: Headline (30 chars max) + Description (90 chars max). No punctuation at end of headline." |
| Google Display | Multiple headlines, responsive format | Add: "Write 5 separate headlines (30 chars each) and 5 descriptions (90 chars each) for responsive display." |
| Professional tone, longer form accepted | Add: "Tone: professional but direct. Body can extend to 6-8 lines. Reference business outcomes, not personal pain." |
For LinkedIn specifically, replace "tired of" and "struggling with" with outcomes and peer comparisons. LinkedIn audiences respond to "companies in your sector are using X to achieve Y" far better than pain-point framing. The professional context makes peer benchmarking the strongest emotional lever.