Seo ops

From stevehuang0115/crewly · View interactive version

Seo ops is an AI agent skill from the GitHub repository stevehuang0115/crewly. Search Console-driven SEO operations for any site: query patterns (low-CTR top-3, near-miss 4-20, rising queries, keyword cannibalization), per-URL report cards, pre-publish SEO/AEO checks, a gated programmatic-page queue, and a live-diff gate that stops agents from removing things from live pages.

How to use this skill

Skill file

SEO Ops

Search Console-driven SEO operations for any site. One skill, one JSON config per site.

Read-only against Google (scopes webmasters.readonly, optionally analytics.readonly); it never edits a site.

Setup (once per machine, one line)

export SEO_OPS_GOOGLE_CREDENTIALS=/path/to/service-account.json

Needs python3 >= 3.8 and openssl (both preinstalled on macOS and most Linux). No pip installs.

Then add the service account's email (client_email inside the JSON) as a restricted user in

Search Console for your property (Settings -> Users and permissions), and enable the Search Console API

for its Google Cloud project. For GA4, add it as Viewer on the property.

Copy seo-ops.config.example.json next to your project and fill it in:

| Key | Meaning |

|-----|---------|

| siteUrl | Site origin, e.g. https://example.com |

| gscProperty | sc-domain:example.com or a URL-prefix property |

| ga4PropertyId | GA4 property id (used by page-report --ga4 and metric --source ga4; --ga4 without it is an error) |

| ga4HostName | Optional. Exact hostname (e.g. crewlyai.com); when set, page-report --ga4 only counts sessions on that host. Use it when one GA4 property serves several hostnames. Unset = whole property |

| credentialsPath | Name of the env var holding the key file path. Never the key, never a path |

| sitemapUrl | Sitemap or sitemap index URL |

| exclusions.queries / exclusions.pages | Regexes (case-insensitive) dropped from every report (brand terms, site: checks, admin paths) |

| publishMethod | Free text shown to you after each command, e.g. "open a blog PR on <org>/web" |

| urlNormalize | {"stripScheme": true, "localePrefixes": ["en","zh"]}: http/https and /en/x vs /x count as ONE page in cannibalization, page-report and the sitemap check. Set it on hreflang sites, otherwise locale variants show up as false cannibalization |

| inspectMax | Optional, default 50. Most URLs page-report --inspect sends to the URL Inspection API per run (quota 2000/day, 600/min per property) |

| maxPagesPerDay | Pattern-queue release limit (default 1) |

| thresholds, prepublish, liveDiff, patternQueue | Optional tuning, see the example file |

Commands

Run as bash config/skills/agent/marketplace/seo-ops/execute.sh --config seo-ops.config.json <command> ...

or with a JSON argument: execute.sh '{"command":"gsc-report","config":"seo-ops.config.json","days":28}'.

Exit codes: 0 ok, 1 gate failed / needs human approval, 2 setup or credentials problem, 3 permission problem,

4 partial result (some URLs or parts failed or were skipped over a cap; the JSON's errors says which).

Every command prints what it examined. A check that examined nothing exits 1; it never reports clean.

Every JSON output (stdout of metric / inspect --json, and the --json files) carries schemaVersion (currently 1;

bumped only when a field is removed or changes meaning) and an errors list ([{message, code, url?|part?}], empty when

nothing failed). JSON output is never truncated: every row is included.

`gsc-report [--days 28] [--json out.json]`

Search Console for the last N days (ending 3 days ago, vs the previous N). Four patterns, all computed in code:

  1. Top-3 position with CTR < 35% (and 100+ impressions): rewrite title/description.
  2. Positions 4-20 with 40+ impressions: add content and internal links.
  3. Fastest-rising queries (new ones flagged): topic candidates.
  4. Keyword cannibalization: a query served by 2+ pages (each with 10+ impressions). Pick the winner, point the others at it.

`page-report [--url U ... | --urls-file F] [--include REGEX] [--days 28] [--ga4] [--inspect] [--json out.json]`

Report card per URL (default: every sitemap URL). Flags: not in sitemap; 0 impressions after 7 days (no-impressions: does not mean unindexed); average position > 20;

top-5 with CTR < 5%. Pages under 7 days old get numbers only (Search Console lags 2-3 days). Age comes from sitemap lastmod; unknown age is reported, not guessed.

--inspect asks Google (Search Console URL Inspection API, same read-only webmasters.readonly scope) about every URL with 0 impressions past the age threshold, and replaces the ambiguous no-impressions with:

Rule: only not-indexed pages go on a Request Indexing list. Quota: the API allows 2000 inspections/day and 600/min per property; --inspect stops at inspectMax (default 50) and prints inspected: N ... M skipped over the cap with the skipped URLs, never silently. Without --inspect no inspection request is sent.

One URL whose inspection fails (a 429, a 403) gets an inspect-failed verdict and the run goes on; the exit code is then 4. So is a run that skipped URLs over inspectMax.

--json out.json also writes the report card as JSON (schemaVersion, property, start, end, examined, flagged, pages[] with url, impressions, clicks, position, ageDays, inSitemap, verdicts[], plus index: {status: "ok", verdict, coverageState, lastCrawlTime, googleCanonical} when inspected, {status: "error", error} when that failed, {status: "skipped", reason} over the cap, null when not inspected; skipped[], errors[], plus ga4[] = every organic landing page {path, url, sessions} when --ga4 ran), the same convention as gsc-report --json.

--ga4 needs ga4PropertyId. GA4 landing pages are paths without query strings; url is the same page as a Search Console URL (after urlNormalize), so the two join. Text mode prints the top 15; JSON has them all.

`prepublish-check (--url U | --file draft.html [--canonical-url U]) [--target "query"] [--brief]`

SEO (title, description, canonical, h1/h2, body length, internal links, sitemap, structured data) and AEO

(direct-answer opening, a figure early, primary-source link, question headings, dates, no "see above" wording).

Warns when a "best / latest / comparison" page title lacks the current year. FAIL exits 1; clear FAILs before publishing, judge WARNs.

`pattern-queue plan | next | status [--out DIR] [--json F]`

Programmatic pages (template x variables) behind a "should this page exist" gate. Nothing is queued blindly.

`live-diff --url LIVE (--proposed-file F | --proposed-url U)` (no config needed)

The gate to run before changing any live page. Fetches the live HTML, compares with the proposed version and reports removed/added

headings, tables, links and structured data (down to JSON-LD properties), plus text-length delta.

**Anything REMOVED, or text shrinking more than liveDiff.maxTextShrinkPct (30%), exits 1 with "NEEDS HUMAN APPROVAL":

stop and show the report to a person.** Pure additions and text edits pass. If either side parses to 0 elements it fails (nothing was compared).

Tables are matched by header row, so updating cell values is an edit, deleting a table is a removal.

`metric --source gsc|ga4 --measure M --start YYYY-MM-DD --end YYYY-MM-DD [--by date|page|query] [--host H] [--page P] [--query Q] [--event NAME]`

One metric over a date range, as JSON on stdout ({schemaVersion, source, measure, by, start, end, filters, total, volume, days[] | rows[], errors[]}).

This is what experiment cards (experiment-card) measure the baseline and result with.

ctr and position are impression-weighted; volume is impressions.

one of them), optionally for one landing --page path (a full URL is reduced to its path, query string dropped);

--channel defaults to Organic Search (all = every channel). ga4HostName applies. No Search Console lag applies to GA4.

(normalised with urlNormalize; for GA4 the landing path joined to the site's origin), so GSC and GA4 rows join on url.

--by query (gsc only): rows[] per query (Search Console leaves out anonymised queries).

`inspect (--url U ... | --urls-file F) [--json]`

URL Inspection for exactly the URLs given, no impression gate (unlike page-report --inspect), up to inspectMax per run.

Each URL gets status ok (with verdict, coverageState, lastCrawlTime, googleCanonical and the verdicts[] above),

error (its own message; the run goes on to the next URL) or skipped (over inspectMax). --json prints

{schemaVersion, property, examined, inspected, failed, skipped, urls[], errors[]} on stdout.

Exit 0 when all were inspected, 4 when some failed or were skipped, the error's own code when every URL failed.

Rules for agents

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.