/lich-skills:google-analyticsfrom lich-skills
Analyzes Google Analytics 4 data to review website performance, traffic patterns, bounce rates, and conversions. Generates prioritized recommendations from GA4 Data API reports.
Ships in lich-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Pull GA4 data via the Data API and turn it into actionable, prioritized recommendations. Scripts are TypeScript (run with Bun or npx tsx).
daily-report.ts (the out-of-the-box default)export GOOGLE_ANALYTICS_PROPERTY_ID="YOUR_PROPERTY_ID_HERE" # numeric, not the G- id
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-key.json"
Or copy .env.example → .env (Bun auto-loads .env; under tsx, export the vars instead). Full service-account walkthrough is inside .env.example.
Never commit the JSON key or .env. Store the key outside the repo; grant the service account only the Viewer role on the GA4 property.
cd skills/google-analytics/scripts
bun install # or: npm install
The only runtime dep is @google-analytics/data (official Google client, fully typed).
daily-report.ts — SEO daily report (out-of-the-box default) ⭐Point it at one property and get a complete, opinionated organic-search report — zero config beyond credentials. This is the SEO-expert default template.
bun run daily-report.ts --property 123456789 # one property → one report
bun run daily-report.ts # uses GOOGLE_ANALYTICS_PROPERTY_ID
bun run daily-report.ts --format json --output today.json
Default template (in order): Organic KPIs (rolling 28d vs prior 28d — the Search-Console 4-week-block convention that removes day-of-week skew) · daily anomaly check (yesterday vs same weekday last week, flags drops ≥ 25%) · organic trend sparkline · top organic landing pages (the SEO money view) · by search engine · by country · by device (mobile-first) · auto-generated prioritized recommendations. Everything is filtered to sessionDefaultChannelGroup = "Organic Search".
Flags: --property <id>, --days <n> (default 28), --channel <name> (default "Organic Search"), --anomaly-threshold <pct> (default 25), --format md|json (default md), --output FILE, --help. Writes seo-daily-<date>.md by default.
It auto-detects whether the property uses GA4's conversions or the newer keyEvents metric, and any single failing sub-query degrades gracefully instead of aborting the report.
GA4 limitation: GA4 has no keyword / impression / CTR / average-position data — that lives in Google Search Console (a different API). This report covers the organic behavior GA4 owns; pair with GSC for the query side.
ga-client.ts — raw report queryThin wrapper over runReport. Any metrics × dimensions combo.
# Last 30 days of sessions + users (JSON)
bun run ga-client.ts --days 30 --metrics sessions,users
# Top pages by views, table output
bun run ga-client.ts --days 7 --metrics screenPageViews \
--dimensions pagePath --order-by screenPageViews --limit 20 --format table
# Specific window, filtered by country
bun run ga-client.ts --start 2026-01-01 --end 2026-01-31 \
--metrics sessions,bounceRate --dimensions country --filter "country:United States"
Flags: --days N | --start --end (YYYY-MM-DD or NdaysAgo/yesterday), --metrics (required, comma-sep), --dimensions, --limit (default 10), --order-by (prefix - desc / + asc), --filter "field:value", --format json|table, --output FILE.
analyze.ts — higher-level analysis + recommendationsPre-built analyses that return metrics plus prioritized recommendations.
bun run analyze.ts --analysis-type seo --days 28 # organic-only KPIs + top landing pages
bun run analyze.ts --analysis-type overview --days 30 # current vs previous period
bun run analyze.ts --analysis-type sources --days 30 # traffic sources + optimizations
bun run analyze.ts --analysis-type content --days 30 # high-bounce pages + diagnosis (all channels)
bun run analyze.ts --analysis-type devices --days 30 # mobile vs desktop gap (all channels)
--output FILE writes JSON to disk instead of stdout. --channel <name> overrides the organic channel group for the seo cut.
Which report do I actually need? For SEO, reach for daily-report.ts first and --analysis-type seo for a quick organic snapshot. overview / sources are useful general cuts. content and devices are all-channel (not organic-only) and content keys off bounceRate (a de-emphasized GA4 metric) — keep them for general GA use, but for SEO the daily report's organic-filtered device/landing cuts supersede them.
No Bun? Swap
bun run X.ts→npx tsx X.tseverywhere (andexportthe env vars, since tsx won't read.env).
When the user asks an analytics question:
ga-client.ts; a "how are we doing / what should we fix" question → analyze.ts.See EXAMPLES.md for end-to-end question → command → analysis patterns, and REFERENCE.md for the full metric/dimension catalog.
The report is a single self-contained command, so any scheduler works. Two options:
Plain cron — write a dated report to a folder each morning (GA4 finalizes "yesterday" within ~24h, so an early-AM run is safe):
# crontab -e (8:00 every day) — adjust the absolute paths
0 8 * * * cd /path/to/skills/google-analytics/scripts && \
GOOGLE_ANALYTICS_PROPERTY_ID=123456789 \
GOOGLE_APPLICATION_CREDENTIALS=/secure/sa.json \
/usr/local/bin/bun run daily-report.ts --output "/reports/seo-$(date +\%F).md"
Claude Code /schedule — schedule an agent that runs daily-report.ts, then reads the Markdown and messages you the 2-3 highest-priority recommendations (turns the raw report into a daily briefing). Ask: "schedule a daily 8am SEO report for property 123456789 and summarize the HIGH recommendations."
Either way: one property in → one report out, every day.
GOOGLE_APPLICATION_CREDENTIALS points at a valid JSON key, the service account has Viewer on the property, and GOOGLE_ANALYTICS_PROPERTY_ID is the numeric property ID (not the G-XXXX measurement ID).yesterday (not today) — today's data is incomplete.bun install (or npm install) inside scripts/..env only — never hardcoded.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub lichamnesia/lich-skills --plugin lich-skills12 skills in this plugin
/build-until-passUse when a build, typecheck, lint, or test command is failing and you want the agent to drive it to green on its own — run the check, read the errors, apply the smallest fix, re-run, repeat until exit code 0. Stops the human from being the while-loop (run → read error → fix one line → run again) and stops the agent from bulldozing huge speculative rewrites between checks./debug-hypothesisUse when debugging any non-trivial bug — wrong output, crash, flaky test, performance regression, or "it works locally but not in CI." Forces a scientific-method loop (Observe → Hypothesize → Experiment → Conclude) so the agent stops guessing and starts reasoning. Prevents the/frontend-designCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics./go-no-goUse BEFORE any spec, plan, or code exists — the Stage 0 gate that decides whether a project should start at all. NO-GO is the default. GO requires passing five framework checks (Differentiation · Audience–Market Fit · Acquisition Channel · Capacity · 7-Factor Wedge), a memory check against your own prior attempts, and a 24-hour pattern-interrupt if enthusiasm-high is detected. Output is a public commitment artifact with pre-mortemed kill criteria (D14/D30/D60/D90 review gates). Triggered by "/go-no-go [project]", any "I want to build / start / take on X" intent, or before opening any new repo or signing any new contract. Pairs with spec-driven-dev (this is Stage 0, that is Stage 1)./nano-bananaGenerate or edit images with Google's Nano Banana 2 (`gemini-3.1-flash-image-preview`). Use when the user asks to generate an image, edit an image, or create a picture. Supports 512 / 1K / 2K / 4K resolutions./skills-mapUse at the START of any task, or whenever you are unsure which lich-skill applies. The router for this collection — it maps every lich-skill to the phase of work it belongs to (Decide → Spec → Plan → Build → Debug → Fan-out → Research → Media → Analyze) and walks a decision tree to pick the right one. Prevents the two failure modes of a skill collection: forgetting a skill exists, and reaching for the wrong skill at the wrong phase. Triggered by "/skills-map", "which skill should I use", "what skills do I have", or any moment of skill-selection doubt.Other plugins' skills for the same job