agentleFS
fourteenwmfourteenwm/ppc-ai-skills/dgen-automation-disable/SKILL.md

dgen-automation-disable

Skill72 starsChanged 4 months agoMITView on GitHub

Bulk-disable Demand Gen ad-level asset automation settings. Auto-invoke when user says "disable dgen automation", "fix dgen asset settings", "turn off dgen auto assets", "dgen automation fix", or "fix demand gen automation".

  • Installs packages

The file

Files
SKILL.md

DGen Ad-Level Automation Disable

Purpose: Programmatically set all Demand Gen ad-level asset automation settings to OPTED_OUT across one or many accounts — the auto-generated design versions, generated videos, and landing-page previews that trade creative control for Google's guesses.

Type: Mutation skill — two-step approval required, always. The mutation-safety pattern (dry-run preview → human reads → execute with the code from that preview) is implemented directly in the shipped script.

This skill deliberately does NOT:

  • Decide whether disabling is right for the account — that judgment (accounts leaning on generated video, shared management, mid-flight experiments) lives in rules.md § "When NOT to disable" and belongs to the operator.
  • Touch campaign-level automation — PMax automation is campaign-level and belongs to pmax-asset-automation; DGen automation is per-ad, which is why this tool exists separately.
  • Enable anything, ever — one direction only, toward OPTED_OUT.
  • Execute without a human-read dry-run — no code, no mutation; and the code only proves the account hasn't changed since the preview you read.
  • Normalize CIDs — dashes are NOT stripped; a dashed CID errors rather than matching (contract).

Background (one paragraph)

Demand Gen asset automation operates at the ad level — settings live on each ad, new ads arrive with automation ON, and two ad types carry five settings between them (the exact taxonomy and defaults: references/mutation-contract.md). One default matters at read time: GENERATE_LANDING_PAGE_PREVIEW ships OFF, so finding it ON in a diff means someone turned it on — attribute before you overwrite (rules.md, reading the diff).


Two-Step Mutation Flow

Step 1 — Dry-run preview (free, writes nothing)

# Single account
python scripts/fix_dgen_ad_automation.py --cid 1234567890

# Multiple accounts (comma-separated CIDs)
python scripts/fix_dgen_ad_automation.py --cids "1234567890,2345678901"

# All enabled accounts under the MCC
python scripts/fix_dgen_ad_automation.py --all

Prints per-account diffs (each ad's settings with current -> OPTED_OUT lines), a summary (accounts / ads / settings), and an APPROVAL CODE.

Then READ the diff — the five checks in rules.md § "Reading the dry-run diff": error lines (an erroring account silently drops out — All accounts are compliant can be false), ad counts vs. expectation, settings-per-ad sanity, the landing-page-preview tell, and unexpected current values. Approve only what you can explain.

Step 2 — Execute with the approval code

python scripts/fix_dgen_ad_automation.py --cid 1234567890 APPROVE-A3F9B2C1

The code is a deterministic hash of the pending work, recomputed from current account state at execute time — ANY drift since your dry-run (new ads, a Google-side reset, a colleague's fix) refuses with a mismatch. A mismatch is information, not an error: re-run the dry-run and read what changed (rules.md, "the mismatch is a feature"). Full hash semantics: the contract.

Execution is one all-or-nothing mutation per account; failed accounts log and the batch continues. Every execute appends to ./logs/mutations_log.jsonl (success and failure) — dry-runs write nothing.

Step 3 — Verify (optional, execute-mode, single account)

python scripts/fix_dgen_ad_automation.py --cid 1234567890 APPROVE-A3F9B2C1 --verify

Re-queries and confirms every in-scope DGen ad is OPTED_OUT. Three no-op cases for --verify (silent on dry-run and already-compliant runs; a printed note on multi-account runs) are in the contract — for a no-mutation compliance check, use a plain dry-run instead.


CLI Reference

FlagDefaultPurpose
--cid CID—Single account (mutually exclusive with --cids/--all)
--cids CID1,CID2,...—Multiple accounts (used exactly as typed — no dash-stripping)
--all—All enabled non-manager accounts under login_customer_id from google-ads.yaml
approval_code (positional)—APPROVE-XXXXXXXX from dry-run. Omit for dry-run mode.
--configgoogle-ads.yamlPath to Google Ads credentials YAML
--log-dirlogsDirectory for the local JSONL mutation log
--log-sheet-id(off)Optional Google Sheet ID for a central mutation log
--verifyoffPost-execute re-query (single account only)

Selection scope (what "in scope" means — enabled campaigns and ads, ended campaigns excluded, paused ad groups' enabled ads INCLUDED), logging shapes, and the sheet-log token requirement are all in references/mutation-contract.md.

One implementation fact worth knowing even if you never read the contract: the API replaces the whole settings list on update — the script always sends every applicable setting per ad type, and any tooling you write against this field must do the same, or unspecified settings silently reset to OPTED_IN.


Prerequisites

  1. Google Ads API credentials — google-ads.yaml at project root (see google-ads-api-setup)
  2. Python: pip install google-ads google-auth google-api-python-client pyyaml
  3. For --log-sheet-id only: the refresh token inside google-ads.yaml must carry the spreadsheets scope (the api-setup generator's default token does). The local JSONL log needs nothing extra.

Installation

mkdir -p .claude/skills/dgen-automation-disable/scripts .claude/skills/dgen-automation-disable/references
for f in SKILL.md README.md rules.md examples.md; do
  curl -o .claude/skills/dgen-automation-disable/$f \
    https://raw.githubusercontent.com/fourteenwm/ppc-ai-skills/main/dgen-automation-disable/$f
done
curl -o .claude/skills/dgen-automation-disable/references/mutation-contract.md \
  https://raw.githubusercontent.com/fourteenwm/ppc-ai-skills/main/dgen-automation-disable/references/mutation-contract.md
curl -o .claude/skills/dgen-automation-disable/scripts/fix_dgen_ad_automation.py \
  https://raw.githubusercontent.com/fourteenwm/ppc-ai-skills/main/dgen-automation-disable/scripts/fix_dgen_ad_automation.py

Files in This Skill

FileRole
SKILL.mdThis workflow — the two-step flow, CLI surface, routing
rules.mdJudgment layer: the five dry-run reads, when NOT to disable, mismatch handling, cadence, false alarms, escalation
examples.mdThree worked runs — clean execute, the drift mismatch, the false compliance
references/mutation-contract.mdExact selection/hash/mutation/logging/verify mechanics (source of truth: the script)
scripts/fix_dgen_ad_automation.pyThe tool — dry-run by default, mutates only with a fresh approval code
README.mdZero-context install and orientation

Runtime artifacts (gitignore them): logs/mutations_log.jsonl — appended on every execute; dry-runs write nothing.

After a Run

logs/mutations_log.jsonl is the durable record — one line per account per execute, success or failure. No row = no mutation through this script. The API-side record is the account's change history. When a run mutated anything, calendar the follow-ups from rules.md § Cadence: the monthly drift re-run, and a re-run after any paused campaign re-enables.

When to Load Something Else

TriggerLoad
A diagnostic flagged DGen automation ON (account-diagnostic check 44, or ads-checker's ad-level automation check)This skill is the fixer those finders route to — run the dry-run
The finding is campaign-level automation on PMaxpmax-asset-automation — the campaign-level twin
A setting is ON that nobody in your shop enabledchange-history-checker — inside 30 days it names the actor; attribute before overwriting
You're about to respond to ANY mutation-shaped workmutation-safety — the pattern this skill implements; read it once so the two-step flow is philosophy, not ritual
Why "empty beats auto-generated" is the house defaultad-copy-verification-standard — Empty > Inaccurate
No working google-ads.yaml yetgoogle-ads-api-setup — one-time credential setup

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.