Skip to content

Capabilities

PageSpeed Insights Loop

Runs a Google PageSpeed Insights audit on any URL, then treats the output as a to-do list rather than a report. Claude picks the top opportunity, applies a code fix, waits for the deploy, re-runs the audit, confirms the score moved, and loops. The loop only stops when the score hits the target (typically 90+ on mobile, 95+ on desktop) or no further fixable issues remain.

The point: most people run PageSpeed, see a 62, and move on. Running PSI as a loop is the difference between “I know my site is slow” and “my site is fast now.”

  • After any website migration or major deploy. Themes change, JS bundles change, scores drop.
  • When a site feels sluggish. Start with a mobile audit on the homepage.
  • As a monthly health check on the properties that matter most (TMS, MyTechSupport, All Things Handy).
  • When you say: “run PageSpeed on X”, “audit X for speed”, “fix the performance on X”, “loop PSI until green on X”.

Not a standalone slash command yet (see Known Gaps). Invoke conversationally:

Run a PageSpeed loop on https://themarketingshow.com until mobile is 90+

Claude will:

  1. Run python3 ~/apps/google-search-console/psi.py <url> --mobile
  2. Pick the top actionable opportunity from the output
  3. Propose a code fix (image format, lazy loading, unused CSS removal, font preload, etc.)
  4. Apply the fix with user approval
  5. Commit, push, wait for Cloudflare or Vercel deploy to go live
  6. Re-run the audit
  7. Compare the new score
  8. Loop until target is met or all easy wins are exhausted
RequirementWhere
PageSpeed Insights API accessGOOGLE_PSI_API_KEY in shared-secrets.env (optional — works at lower rate limits without)
Source code accessJames must own the code for the target site (headless WordPress, GHL-hosted sites fall back to “suggest” mode only)
Deploy verification~/apps/cc/verify-deploy.sh polls the live site until build.txt matches
  • Script: ~/apps/google-search-console/psi.py
  • Usage: python3 psi.py <url> for mobile + desktop, or --mobile / --desktop for one strategy
  • Output modes: human-readable terminal output (default), or --json for programmatic handoff
James: Run a PageSpeed loop on https://mytechsupport.com until mobile is 90+.
Claude: Baseline mobile score: 62. Top opportunities:
1. Serve images as WebP (est +15)
2. Eliminate render-blocking CSS (est +8)
3. Defer off-screen images (est +4)
Starting with #1. Proposed edit: add <picture> elements with
WebP sources for /public/images/hero.png plus 7 others.
Apply?
James: yes
Claude: [edits, commits, pushes, waits for Vercel deploy]
Deploy confirmed. Re-running audit...
New mobile score: 78. +16.
Next opportunity: Eliminate render-blocking CSS.
Proposed edit: move critical CSS inline, defer the rest.
Apply?
James: yes
Claude: [repeats]
New mobile score: 91. Target reached.

This is the iteration loop at its purest. The student watches one number go up across three commits. It is the difference between Claude as a search engine (“here is your score”) and Claude as a collaborator (“here is your score, here is what I am doing about it, let me know when to stop”).

Good material for the Mastery School curriculum — not the crash course. Students need to understand CLAUDE.md, GitHub, and deploy verification before a loop this compound is meaningful.

  • No /pagespeed slash command yet. Invoked conversationally only. A skill file in ~/.claude/commands/ would make the trigger phrases deterministic.
  • No historical benchmarks. Unlike GSC audits, PSI runs are one-shot. A benchmark DB (like gsc-benchmarks.db) would show score trends over time.
  • No portfolio mode. You have to point it at one site at a time. A “loop across all my sites” pass would catch regressions.
  • No fallback for GHL-hosted pages. If the code is not in a repo you control, the loop drops to suggest-only mode. Worth documenting which sites that applies to.
  • GSC Audit — the complementary SEO health pass; often catches the same slow pages via different signals.
  • Three Scales of Editing — this loop is a concrete example of scale two (global-site edits driven by a single trigger).