posthog-analytics

posthog-analytics is a skill for Claude Code from alinaqi/maggy. It costs 17 tokens per session (5,275 once invoked), scanned A, original, MIT.

A guide to adding PostHog product analytics, which records how people use an application. It covers events, user identification, feature flags, and dashboards for questions about activation, retention, funnels, and feature use.

In plain words
What is it for?
Use it to define and send events, identify users, control feature flags, and build project dashboards for product metrics.
Why use it?
It helps turn user activity into evidence about where people succeed, stop, or engage, instead of relying only on guesses about product usage.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

not rated 713repo +1 3d ago A scan Socket: passSnyk: passSkillSpector: warn 17 tokens original MIT

Good fit Use it to define and send events, identify users, control feature flags, and build project dashboards for product metrics.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alinaqi/maggy/posthog-analytics
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alinaqi/maggy --skill posthog-analytics
Clone the repo
git clone --depth 1 https://github.com/alinaqi/maggy

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for posthog-analytics

README.md
[![agentmods](https://agentmods.dev/badge/skills/alinaqi/maggy/posthog-analytics/github.svg)](https://agentmods.dev/skills/alinaqi/maggy/posthog-analytics)
Your own site
<a href="https://agentmods.dev/skills/alinaqi/maggy/posthog-analytics"><img src="https://agentmods.dev/badge/skills/alinaqi/maggy/posthog-analytics/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for posthog-analytics

Your own site · 80×15
<a href="https://agentmods.dev/skills/alinaqi/maggy/posthog-analytics"><img src="https://agentmods.dev/badge/skills/alinaqi/maggy/posthog-analytics.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,275 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 14 Jul 2026
  • Snyk pass 14 Jul 2026
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 211
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 215
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.05275
Opus 5.5 $0.00007 $0.02110
Sonnet 5.5 $0.00003 $0.01055
Haiku 4.5 $0.00002 $0.00528

Measured 2mo ago against content hash 0343699b60c8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

posthog-analytics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/posthog-analytics/SKILL.md · 957 lines

How it starts

The opening of the file, as written. The whole thing — 957 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostHog Analytics Skill

For implementing product analytics with PostHog - event tracking, user identification, feature flags, and project-specific dashboards.

Sources: PostHog Docs | Product Analytics | Feature Flags


Philosophy

Measure what matters, not everything.

Analytics should answer specific questions:

  • Are users getting value? (activation, retention)
  • Where do users struggle? (funnels, drop-offs)
  • What features drive engagement? (feature usage)
  • Is the product growing? (acquisition, referrals)

Don't track everything. Track what informs decisions.


Installation

Next.js (App Router)

npm install posthog-js
// lib/posthog.ts
import posthog from 'posthog-js';

export function initPostHog() {
  if (typeof window !== 'undefined' && !posthog.__loaded) {
    posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
      api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://us.i.posthog.com',
      person_profiles: 'identified_only', // Only create profiles for identified users
      capture_pageview: false, // We'll handle this manually for SPA
      capture_pageleave: true,
      loaded: (posthog) => {
        if (process.env.NODE_ENV === 'development') {
          posthog.debug();
        }
      },
    });
  }
  return posthog;
}

export { posthog };
// app/providers.tsx
'use client';

import { useEffect } from 'react';
import { usePathname, useSearchParams } from 'next/navigation';
import { initPostHog, posthog } from '@/lib/posthog';

export function PostHogProvider({ children }: { children: React.ReactNode }) {
  const pathname = usePathname();
  const searchParams = useSearchParams();

  useEffect(() => {
    initPostHog();
  }, []);

  // Track pageviews
  useEffect(() => {
    if (pathname) {
      let url = window.origin + pathname;
      if (searchParams.toString()) {
        url += `?${searchParams.toString()}`;
      }
      posthog.capture('$pageview', { $current_url: url });
    }
  }, [pathname, searchParams]);

  return <>{children}</>;
}

Read the full file on GitHub · 957 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 957 lines · 17 tokens per session scan A 0343699b60c8

Subscribe to this mod's changes

posthog-analytics is a skill published in the GitHub repository alinaqi/maggy (713 stars, last pushed 3d ago), licensed MIT. It adds 17 tokens to every session and 5,275 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

posthog-analytics compared with skills from other repositories

posthog-analytics next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
posthog-analyticsalinaqi/maggySkill7133d agoMITA17Claude Code
claude-apihashgraph-online/awesome-codex-pluginsSkill1.6ktodayApache-2.0A53Claude Code, Codex
fastapiericrisco/rsc-harnessSkill6825d agoMITA94Claude Code, Codex
modalericrisco/rsc-harnessSkill6825d agoMITA78Claude Code, Codex
pythonericrisco/rsc-harnessSkill6825d agoMITA94Claude Code, Codex
djangoericrisco/rsc-harnessSkill6825d agoMITA84Claude Code, Codex
ai-ml-developmenttravisjneuman/.claudeSkill115yesterdayMITA43Claude Code