Set up once
- In Google Cloud, create a project and enable the Google Search Console API.
- Create a service account (a robot user) and download its JSON key.
- In Search Console, go to Settings > Users and permissions, add the service account’s email address and choose Restricted.
- Save the whole JSON key as a secret called
GSC_SERVICE_ACCOUNT_JSON. Never paste it into a chat or commit it to your code.
Prompt 1: Pull and store your search data
Build a Search Console sync for my site, property [sc-domain:yourdomain.com].
- Authenticate with a service account read from the env var GSC_SERVICE_ACCOUNT_JSON, using the read-only webmasters scope. Fail with a clear error if it is missing or invalid.
- Query the searchAnalytics endpoint by date and query, and paginate through all rows.
- Store raw daily rows, unique on query + date, and upsert so re-running is safe.
- Roll them up into one row per query: first seen, last seen, clicks, impressions and impression-weighted position over 90 days, plus a status column.
- The sync must never overwrite workflow columns such as status or cluster.
- Add one script that backfills all available history and one that syncs the last 7 days.
Show me the database migration before applying it.
Prompt 2: Score every query
Add a priority score to each query:
impressions x 1.5 if position is 8 to 30, x 0.7 if better than 8, x 1 otherwise, plus 5 per click.
The score only ranks. It must never exclude a query. Recalculate it after every sync.
Print the top 30 so I can sense-check them.
Prompt 3: Group queries into topics
This is the most important step. One post per query gives you hundreds of thin, overlapping pages.
Cluster my unclustered queries by search intent using the AI API. Each cluster becomes one blog post.
- Process in batches of 100 and use structured JSON output.
- Aim for small clusters, roughly 1 to 5 queries. Never create a catch-all cluster.
- Pass in existing cluster names and existing blog post titles, so new queries join the right cluster and topics I have already covered are marked as covered.
- Mark brand searches and off-topic searches as ignored, with a reason. When unsure, do not ignore.
- Validate the response: every query appears at most once and only queries I sent are accepted.
- A cluster's score is the sum of its query scores.
Estimate the API cost and ask me before the first run.
Prompt 4: Tidy once a week
Write a weekly script that reviews all clusters without a post. Merge clusters that one article would answer, ignore junk, and link clusters to existing posts with the same intent. Never change a cluster that already has a post.
Prompt 5: Draft, then edit
First write a short guidelines file: your tone, who you write for, what your product does and, just as important, what it does not do. Keep it up to date. Mine went stale about one feature, and a stale rule becomes a wrong claim.
Write a script that drafts posts from the top N open clusters.
- Give the writer my guidelines file and the current text of my live pages: [URLs of your product and pricing pages].
- The post must answer the cluster's real search queries and must not compete with existing posts.
- Return title, meta description, key points, body and FAQs as structured output.
- Scale length with the number of queries: roughly 900 to 2,400 words.
- Then run a second AI pass as editor: remove claims about my business that the sources do not support, remove invented statistics, quotes and customer names, check every query is answered, and apply my style rules. List what it changed.
- Link the saved post to its cluster so it is never written twice.
Save everything as a draft for now.
The editor is AI checking AI. It is not a substitute for reading your own posts.
Prompt 6: Add a featured image
Have the writer return a one-sentence image theme and a short image title. Use [image model] to create a landscape featured image in my brand colours [hex codes], save it with the post and use the theme as alt text.
Prompt 7: Schedule with a veto
Instead of saving as a draft, schedule each new post to publish 24 hours later.
- Posts under 500 words stay as drafts.
- Check that the blog, sitemap and feeds all hide posts with a future publish date.
- Email me a digest listing each post with its publish time and a "Hold it" link.
- Secure the link with an HMAC token compared in constant time. Opening it must show a confirmation page; only pressing the button holds the post, so email scanners cannot trigger it.
- If drafting fails, the email must say so.
Prompt 8: Run it every day
My hosting goes to sleep when idle, so timers inside the app were unreliable. I run the job from GitHub Actions instead.
Create one daily script that: syncs Search Console, clusters new queries, runs the weekly tidy on Mondays, drafts from the top clusters and sends the digest.
- Publish 1 post a day for the first 14 days, then 2, with an env var to override.
- Re-running on the same day must not exceed the daily number.
Then create a GitHub Actions workflow that runs it daily at [05:30] UTC, with a manual run button and a concurrency limit. Read all keys from repository secrets and list the ones I need to add.
Add the secrets under Settings > Secrets and variables > Actions, then press Run workflow and check the log.
Five lessons
- Cluster first. One post per topic, not per keyword.
- Feed it the truth. Write from your live product pages.
- Keep rules fresh. A stale guideline becomes a wrong claim.
- Check your hosting. If it sleeps, use an outside scheduler.
- Keep a veto. You can block a bad post without approving every one.
What it does not do yet
- Add internal links automatically
- Refresh older posts
- Replace human fact-checking
- Prove itself in traffic: it is too early to say