heymegabyte/agent-skills / 13-observability-and-growth
observability-and-growth
VerifiedFull instrumentation from day one. PostHog consolidates product analytics + feature flags + error tracking (one platform, one bill). GA4 via GTM (14-step automation, custom dimensions over events, server-side tagging). Sentry (deep error tracking + performance). Stripe (webhook-first with idempotent processing). Listmonk on Coolify (newsletters via Amazon SES SMTP relay). PLG 7-layer framework. Programmatic SEO (5 page types). Incident auto-remediation via Sentry→Inngest pipeline. AI search (GEO) awareness. Local business conversions (phone_click, direction_click, form_submit, booking_click) with CRO patterns for both SaaS and local.
13 — Observability and Growth
Tiered PostHog+Sentry+GA4 stacks wired from day one; feature flags, PLG patterns, incident auto-remediation.
Instrumentation tiers
Per _kernel/standards.md#integrations:
- Tier 1 (solo) — PostHog + Workers Tracing OTLP (2 vendors max, cookie-free, free tier covers <10k MAU)
- Tier 2 (enterprise) — + Sentry
@sentry/cloudflarev9 + GA4/GTM + Axiom - Tier 3 (LLM-heavy >10k calls/mo) — + AI Gateway
PostHog (Tier 1 cornerstone)
- Snippet on every HTML page w/
persistence:'memory'(cookie-free);capture_pageview+capture_pageleave+autocapture:true - Unified platform: product analytics + feature flags + session replay + error tracking
- CSP:
script-src+connect-srcfor posthog domain - Per-feature event naming:
<feature>:<action>(signup:complete,editor:save,share:copy)
Sentry (Tier 2)
@sentry/cloudflarev11 (stream trace lifecycle default since 11.0) +withSentrywrapper; project viamcp__sentry__create_project(org:megabyte-labs)SENTRY_DSNviawrangler secret put- Pattern:
withSentry(env => ({ dsn, tracesSampleRate: 1.0, sendDefaultPii: false }), worker) - Breadcrumbs before risky ops; capture exception w/ context tags (
worker|route|userId) - Release tracking via
SENTRY_RELEASEenv; Workers Tracing handles I/O spans
Workers Tracing (Tier 1 + 2) / GA4 + GTM (Tier 2) / AI Gateway (Tier 3)
- Workers Tracing:
[observability] enabled = trueinwrangler.jsonc— zero-config OTel I/O tracing; export to Axiom, Honeycomb, Grafana, Datadog via@opentelemetry/exporter-trace-otlp-http - GA4 + GTM: container snippet (head script + noscript iframe); CSP:
googletagmanager.com+google-analytics.com+analytics.google.com+region1.google-analytics.com; server-side tagging for EU; custom dimensions over custom events - AI Gateway:
env.AI.run()auto-routes; direct Anthropic:https://gateway.ai.cloudflare.com/v1/{account}/{gateway}/anthropic/v1/messages; caching + rate-limit + fallback + per-call logging
Stripe + Link (accept-money default, ALL flows — per rules/payments.md)
- Accept default w/ Link ON everywhere (Payment Element / Checkout / Payment Links); Instant Bank Payments on high-ticket + donation flows
- Webhook-first w/ idempotent processing (D1 dedupe table
payment_events(event_id, source, processed_at)UNIQUE) Stripe-SignatureHMAC + 5-min replay window- Mint products + prices via MCP (idempotent via
lookup_key); subscription state machine in D1 STRIPE_WEBHOOK_SECRETviaPOST /v1/webhook_endpoints
Square (on-request rail ONLY — per rules/payments.md)
- Only when the prompt names Square: Web Payments SDK card form + Apple Pay + Google Pay + Cash App Pay
Square-SignatureHMAC-SHA256 w/ 6-hr replay window;idempotency_keyUUID per request (24-hr dedupe)- No 501(c)(3) discount exists (verified 2026-10) — custom rates only ≥$250K/yr
Listmonk (newsletter — self-hosted on Coolify)
- Amazon SES SMTP relay (
LISTMONK_FROM_EMAIL);listmonkSendTx(env, { templateAlias, ... })via KV-cached alias→id map - Templates in
emails/*.htmlsynced viascripts/listmonk-sync.mjs - Auth:
Authorization: token <user>:<key>(Listmonk 3.x API-user pattern)
PLG 7-Layer Framework
- Discovery — SEO + AI search + word-of-mouth + paid
- Sign-up — passwordless preferred (Clerk M2M JWT)
- Activation — first-value-in-X-min metric (aha moment per
rules/feature-flags.mdinstrumentation) - Engagement — DAU/MAU ratio, session depth
- Retention — D1/D7/D30 cohort
- Revenue — upgrade trigger, expansion
- Referral — viral coefficient, two-sided rewards
Programmatic SEO (5 page types)
/integrations/{tool}·/compare/{a}-vs-{b}·/for/{audience}·/templates/{type}·/{city}-{service}- Each: unique H1 + meta desc + 800+ unique words + 1 unique image + 3+ internal links + 1+ outbound citation. Cap 200 pages per axis.
- Per
rules/copy-writing.md§ pSEO +rules/thin-source-amplification.md.
GEO / AI search
- Quotable answer blocks 40-60 words (LLM citation magnet); FAQPage schema highest AI-citation rate (ChatGPT / Perplexity / Google AI Overviews)
- JSON-LD facts MUST also appear as visible HTML body text; lead paragraphs answer query in <40 words
- EEAT: author bio +
Personschema +sameAs+ dated revision + ownership statement llms.txtat site root (DX-only, <0.3% adoption — not build gate)
Local-business conversions + CRO
Track per local-conversions.md: phone_click (tel:) · direction_click (Google Maps) · form_submit · booking_click (Calendly/Cal.com) · chat_click · review_click (Google Business/Yelp). Each fires PostHog + Sentry breadcrumb + (Tier 2) GA4 conversion event.
CRO: sticky CTA bar on mobile · scroll-progress bar (subtle) · exit-intent modal (cart/pricing only, not blogs) · social proof near every CTA · urgency without dark patterns ("3 spots left this week" if true) · trust strip above fold · single primary CTA per surface.
Incident auto-remediation
Sentry → Inngest pipeline: (1) Sentry webhook on event.alert.triggered → (2) Inngest dispatches incident-responder agent → (3) agent reads event, traces to source file, proposes fix, opens PR via gh MCP → (4) PR auto-merges if all CI gates pass per rules/ai-seniority.md.
See submodules: posthog, ga4-gtm, sentry, stripe-billing, square-payments, listmonk, plg-framework, programmatic-seo, incident-remediation, geo-ai-search, local-conversions.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |