DEV Community

J Now
J Now

Posted on

Why I enforce post quality with a regex gate, not a better prompt

The standard approach to keeping LLM-generated content from sounding like marketing copy is to write a long system prompt telling the model to "sound authentic" and "avoid buzzwords." That works until it doesn't — Claude knows excited and game-changer are forbidden phrases and still reaches for them under pressure because they're high-frequency completions in its training data.

The gate in pipeline/antislop.py doesn't ask. It hard-rejects drafts containing specific banned tokens before anything is published: excited, game-changer, unlock, empower, AI-powered, leverage. It also rejects structural failure modes as patterns: emoji, hashtags, exclamation points, rhetorical questions that open with "Ever" or "Have you."

This is part of marketing-pipeline, a tool I built to handle ongoing distribution for my open source projects without showing up manually every day. The pipeline generates posts via Claude and routes them to Bluesky, Dev.to, Hashnode, and Mastodon — but nothing ships without clearing the gate first.

A stripped version of the check:

def check_antislop(text: str) -> list[str]:
    violations = []
    for pattern in BANNED_TOKENS + BANNED_PATTERNS:
        if re.search(pattern, text, re.IGNORECASE):
            violations.append(pattern)
    return violations
Enter fullscreen mode Exit fullscreen mode

Fail the check, get regenerated. The failure reason gets passed back so the next attempt has signal about what to avoid.

Per-channel length is enforced the same way: Bluesky 300 chars, X 280, Mastodon 500, Dev.to/Hashnode 150–400 words. Length violations are caught at the same layer as token violations — not by prompting for brevity, but by measuring and rejecting.

Onboarding a project is one command: marketing onboard --name my-tool --repo owner/repo --kind mcp-server. It pulls the README, extracts problem/facts/angles into projects.yml. A GitHub Actions cron at 14:00 UTC weekdays rotates through projects and channels, picks the least-recently-used angle, generates, validates, and posts.

https://github.com/robertnowell/marketing-pipeline

Top comments (0)