Skip to main content

Hamza Jameel

+1 (307) 445-3601
Founder of Omnifolks · USA · UK · UAE
$5M+ in Ad Spend Managed
150+ Websites Ranked on Google Page 1
10+ Years of Proven Results
No Lock-In Contracts Results First
Serving 9+ Industries Across the Globe
Founder of Omnifolks · USA · UK · UAE
Free Consultation
Get a Proposal
Tell me about your project. I will reply within 24 hours.
Free Strategy Call No Lock-In Contract Reply in 24 Hours 10+ Years Experience

    AI Tools · Guide 2026

    Claude Code Built a Search Console Keyword Clusterer in One Prompt

    A real Claude Code session on a real Search Console export: the prompt, the plan it wrote, the run, the fix, and what to change first.

    Hamza JameelHamza Jameel
    ·October 2026·14 min read ·📌 Digital Marketing Consultant
    242
    topic clusters
    155,875
    impressions grouped
    ~26 min
    prompt to finished tool
    10
    flagged clusters
    🤖
    Built liveRecorded as it ran, on a real Search Console export, not a demo file.
    Clusters found
    242
    From the top 1,000 queries in the export, grouped by main word after one fix-and-rerun cycle.
    Build time
    ~26 min
    From one prompt to a tool that checks its own totals, including a re-run after two fixes.
    📌 What This Guide Covers
    Claude CodeSearch ConsoleKeyword clusteringClick-through rateAI coding agentsSEO automation

    Yes, one prompt is enough to get a working tool, if you scope it properly first. I gave Claude Code a single instruction on a real Search Console export, the top 1,000 queries from my company site viperatech.com over three months, and watched it plan, write and run a Python script that grouped those queries into 242 topic clusters and flagged the 10 that Google shows but almost nobody clicks.

    In the video I show the exact prompt, the plan Claude Code wrote before touching any code, the run, the two things that broke, and the fix. Below is the written version: the scoping rules I used, the prompt itself, the numbers that came back, and what I'd do with a list like this. If a spreadsheet job eats half your week and there is no budget for a developer, this is what one prompt did on real data.

    Watch: Claude Code Built a Search Console Keyword Clusterer in One PromptOpen on YouTube ↗

    What one prompt built from a Search Console export

    The data was real: the Google Search Console queries export for viperatech.com, my company site, three months of web search data, exported as the top 1,000 queries. One caveat: the full Search Console account for that period holds roughly 12,000 clicks and 1.48 million impressions. The export only holds the top 1,000 queries, so every number below (3,691 clicks, 155,875 impressions, 2.37% CTR) describes that top-1,000 slice, not the whole account.

    One prompt told Claude Code to group the queries, add up clicks and impressions per cluster, and flag anything that gets seen a lot but clicked rarely. It wrote a plan first, then one Python file, ran it against the real file, checked its own totals, found two problems, fixed them, and ran it again. Start to finish: about 26 minutes.

    Sorting a thousand rows of keywords into topics by hand, then working out which ones are quietly underperforming, is slow spreadsheet work. The job was repetitive and structured and had a clear right answer, which makes it a fair test for an AI coding agent.

    Step 1: scope it before you write a single prompt

    Before I opened Claude Code I decided exactly what I wanted back, in plain terms, on paper.

    • ✓Name the exact file you want backout/clusters.csv, not "some clusters"
    • ✓Give it one jobgroup, count, flag. Nothing else in the same prompt
    • ✓Test it on real data, not a sample file or made-up rows
    • ✓Ask it to check that the totals add up, so you know nothing got lost or counted twice
    ⚠️

    That sounds obvious, and skipping it is usually why the AI's first answer comes back close but not usable. If you don't name the exact output and the one job, the agent will guess, and you'll spend longer correcting its assumptions than it would have taken to write them down first.

    This is the same discipline I'd want in place before anyone touches technical SEO work or a tracking rebuild: know what the finished thing has to prove before you start building it.

    Step 2: the exact prompt I used

    This is Claude Code, Anthropic's coding agent. I ran this build in its desktop app under the Code tab, on my paid Claude plan. On the web it starts the same way: you describe the task in plain English and it plans, writes and runs the code itself.

    📌

    Build a small Python tool, standard library only, that reads data/queries.csv (a Google Search Console queries export). Group the queries into topic clusters by their main words, add up clicks and impressions for each cluster, work out each cluster's CTR, and flag the clusters with lots of impressions but a CTR under 1%. Write the result to out/clusters.csv, run it on the real export, and show me the top 10 clusters.

    Notice what's in there and what isn't. It names the input file, the library constraint (standard library only, nothing to install), the exact calculation, the flag condition, the output file, and the final check: run it on the real export and show me the top 10. One job, clearly bounded.

    What Claude Code planned before writing any code

    Before any code, it wrote a plan: in words, how it intended to solve the problem. That matters, because you can catch a bad assumption before it gets built into code.

    1. Read data/queries.csv with Python's csv module and recompute CTR itself rather than trusting the CTR column in the export

    2. Clean every query

      lower case, strip punctuation, keep part numbers whole, merge plurals and a few spellings, drop stop words and intent words like price, buy, best

    3. File each query under its main word, the word most queries in that group share; broad words like nvidia, amd or gpu only count when nothing more specific is left

    4. For each cluster, work out the number of queries, clicks, impressions, CTR, and average position weighted by impressions

    5. Flag a cluster when it holds at least 1% of all impressions in the file AND its CTR is under 1%. Both thresholds can be changed from the command line

    6. Write out/clusters.csv sorted by impressions, highest first, with each cluster's top 3 queries, then print the cluster count, flagged count, a top 10 table, and the flagged list

    7. Run it on the real export, check the cluster totals match the file totals, and fix anything that breaks

    Standard library only mattered more than it sounds: nothing to install meant the tool could run on any machine with Python already on it, no setup step, no dependency to maintain later.

    Step 3: running it and checking the work

    It built one Python file, cluster.py, and ran it straight on the real file. The core of it is short enough to read: sum the clicks and impressions in each cluster, divide to get CTR, and mark the ones that clear the flag rule.

    Name the file, the one job, the real data, the self-check
    Group, add up, flag, write out, run, show me the top 10
    cluster.py against the real export, totals printed and checked
    A jumbled cluster name and a split cluster, both caught and fixed in the same session

    It also checked its own work: the totals were re-read from the export and from the output file separately, and they matched. That's the check I'd insist on before trusting any agent's output. Ask it to prove the result against the source file.

    What it found: the top 10 clusters by impressions

    Here's the top of the output, straight from the printed table after the final run.

    ClusterQueriesClicksImpressionsCTRAvg PositionFlagged
    h1004912312,2901.00%11.3No
    h203947410,5794.48%3.3No
    antrack8387,9820.48%6.2Yes
    h200611566,4892.40%17.7No
    amd gpu22445,6780.77%8.2Yes
    antminer s23 hydro23495,6400.87%18.8Yes
    a10016244,5060.53%10.3Yes
    5090421174,4862.61%5.8No
    gddr ddr8163,8920.41%4.1Yes
    vipera127283,71919.58%5.8No

    Two rows worth stopping on. h100 is the biggest cluster by impressions and sits right on the line at exactly 1.00% CTR, so the flag rule correctly leaves it alone: it's a cluster to watch, not fix. And vipera, the branded cluster, gets a 19.58% CTR, which is roughly what you'd expect when someone is already searching for the company by name. The flagged clusters below are a different story: unbranded, high impressions, barely clicked.

    The 10 flagged clusters: seen but not clicked

    The flag rule was simple and both numbers in it are adjustable: a cluster counts as having lots of impressions when it holds at least 1% of all impressions in the file (1,559 or more here), and it only gets flagged when its CTR is also under 1%.

    ClusterImpressionsCTRAvg Position
    antrack7,9820.48%6.2
    amd gpu5,6780.77%8.2
    antminer s23 hydro5,6400.87%18.8
    a1004,5060.53%10.3
    gddr ddr3,8920.41%4.1
    sys-822gs-nb3rt3,4270.82%5.8
    nvidia b1003,0470.95%8.0
    l402,6870.37%10.4
    nvidia l202,2260.54%7.6
    buy ai server1,9170.05%27.0
    Antrack is the biggest flagged cluster: 7,982 impressions, 38 clicks and a 0.48% CTR at an average position of 6.2, against 2.37% for the whole export.

    A CTR under half a percent at position six points at the listing, not the ranking. The page already earns a spot on the results page; its title and description are not getting the click, so those are what I'd rewrite first.

    What broke, and how it got fixed

    It wasn't perfect first time. The 26-minute build includes a re-run after Claude Code spotted and corrected two problems itself.

    ✅ Do

    • Fixed: cluster names now follow the word order of the most-searched queries in that cluster, not an arbitrary order
    • Fixed: sizes and speeds (like 48gb) no longer decide which cluster a query falls into, so a single product stopped splitting into two clusters
    • Result: 242 clusters, 129 with two or more queries, nothing crashed

    ❌ Avoid

    • First run: one cluster name came out jumbled ("amd vera helios nvidia rubin")
    • First run: "nvidia a40 48gb" split away from "nvidia a40 price" because 48gb appeared in more queries than a40
    • First run totals: 245 clusters, 127 with two or more queries

    Both issues were in the clustering logic, not the arithmetic: the totals (3,691 clicks, 155,875 impressions) matched on both runs. What changed between runs was how queries got grouped, which is exactly the kind of thing worth testing against real data before trusting the output, because a clean-looking sample file would never have surfaced either problem.

    What I'd fix first from this list

    Treat the output as a to-do list. A cluster like antrack is already ranking and already being shown, and the people who see it rarely click. That gap can be fixed without a ranking fight.

    1. Open the ranking page or pages behind the cluster and read the current title and meta description as a searcher would

    2. Rewrite the title to include the specific term people are searching (the exact query wording, not a generic category label)

    3. Rewrite the description to answer the thing the query implies (price, availability, spec) rather than restate the title

    4. Wait for Search Console to refresh, then check the cluster's CTR again against its old number

    This is standard on-page SEO work, the clustering just told me exactly where to aim it instead of guessing from 1,000 rows of raw queries. If your own CTR has dropped across pages that used to convert, that's worth checking against what I cover in why SEO rankings drop, since position and clicks don't always move together.

    Where OpenAI's Codex fits

    📌

    I don't have a paid ChatGPT plan, so Codex isn't demoed anywhere in this build and I haven't used it myself. Everything below comes from OpenAI's own published material, not my testing.

    Codex is OpenAI's own coding agent, built to do a similar job to Claude Code: take a plain-English instruction and plan, write and run code against it. I can't compare the two first hand, so I won't pretend to.

    What I can cite is OpenAI's own case study: in its Proaction case study, OpenAI reports the team saved more than 75 hours using Codex, alongside a reported 60% boost in sales. That's OpenAI describing its own customer's results, not an independent test, so treat it as a sourced claim rather than a verdict on which agent is better.

    How to scope your own AI build

    The lesson here generalises past Search Console data. Any repetitive spreadsheet job with a clear rule behind it (group these, flag those, total these) is the kind of thing worth testing with an AI coding agent before paying for custom development. The free AI Agent Blueprint has the full checklist for scoping a build like this.

    • ✓Write down the exact file and format you want back, not a vague description
    • ✓Give the agent one job per prompt, not a wishlist of features
    • ✓Test it on your real, messy data on the first run, not a clean sample
    • ✓Build in a self-checkask it to confirm the output totals match the source file

    This scoping discipline applies to AI workflow automation and AI agent development work too, and the clustering approach itself is useful input for generative engine optimization: grouping queries by topic is a close cousin of deciding which pages need expanding so AI answer engines can cite them properly. If you'd rather not write the prompt yourself, SEORoger is a tool I run for site analysis, and a free SEO audit shows where your own site has the same gap between impressions and clicks.

    ✅

    Scoping the exact output and testing on real data in the same session is what turned one prompt into a finished, self-checking tool in about 26 minutes, not a half-built script that needed a developer to finish.

    Want this kind of clustering run on your own Search Console data?

    I'll show you where your own impressions and clicks are pulling apart, and what to rewrite first.

    $8M+ ad spend managed150+ page-one rankings10+ years in Google Ads, SEO and AI
    Book a Free Strategy Call →

    Frequently Asked Questions

    Claude Code is Anthropic's coding agent: you describe a task in plain English and it plans, writes and runs the code itself, rather than you writing it line by line. It's available in Anthropic's desktop app and on the web, and in this build it ran on a paid Claude plan.
    Yes. In this build it read a real queries export (data/queries.csv) with Python's standard csv module, which copes with commas and line breaks inside a query, and recomputed CTR itself rather than trusting the CTR column already in the file.
    About 26 minutes from the first prompt to a finished, checked tool, including a re-run after two fixes. That covers Claude Code writing a plan, building the script, running it, catching two clustering errors, fixing them, and running it again.
    It means deciding, before you prompt, the exact file you want back, giving the agent one job instead of several, testing it on your real data rather than a clean sample, and asking it to check that its totals match the source file.
    It depends on the query and position, but in this export the overall CTR across the top 1,000 queries was 2.37%. The flagged clusters in this build were well under 1%, which is what made them worth fixing rather than normal variation.
    Start with the clusters that combine high impressions, low CTR, and a strong average position. A cluster already ranking around position 6 with a CTR under 1% is being seen but not clicked, which points to the title and description rather than the ranking itself.
    There's no fair comparison here because Codex wasn't used or demoed in this build, only cited from OpenAI's own published case study. OpenAI's Proaction case study reports more than 75 hours saved and a 60% increase in sales using Codex, but that's one customer's reported result, not a side-by-side test against Claude Code.
    Not for a build this size. The entire interaction was a plain-English prompt describing the file, the job, and the output wanted; Claude Code wrote the plan, the Python script, and ran it without any code being typed by hand.
    In this build, the check was built into the process: an independent recompute of totals from both the export and the output file confirmed they matched before the result was trusted. Any build like this should include that same self-check rather than relying on the agent's own printed summary.
    Yes, the logic doesn't depend on the site: it groups queries by their shared main word, adds up clicks and impressions, and flags clusters with high impressions and low CTR, which works on any Search Console export with query, click, impression and position data.
    Hamza Jameel, digital marketing consultant in Dubai
    Hamza Jameel
    Digital Marketing Consultant · Google Ads, SEO & AI · Global
    Hamza Jameel is a Dubai-based digital marketing consultant who has managed more than $8M in ad spend and built over 150 page-one rankings for clients across the UAE, UK, USA and Australia. He writes about SEO, Google Ads and the AI tools he uses on his own agency work, including Claude Code. Read more →