Agent skill

Adding Analytics

by spencerpauly in spencerpauly/awesome-cursor-skills

Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

CC0-1.0Auto-check: notesData & Analytics

Install Adding Analytics

skills CLI
$ npx skills add spencerpauly/awesome-cursor-skills --skill adding-analytics -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install spencerpauly/awesome-cursor-skills adding-analytics --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/spencerpauly/awesome-cursor-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/resources/adding-analytics .claude/skills/adding-analytics && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
adding-analytics
GitHub stars
841
Token cost
~670 tokens
SKILL.md length
272 words
Files
1
Skills in repo
59
Repo updated
First seen
Licence
CC0-1.0

At a glance

Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

  • Works in 8 steps: Detect the framework — check for… → Install the SDK → Create a provider / init module → …
  • Tasks that involve Product analytics
  • SKILL.md covers Steps and Notes
  • Calls npm and pip; reaches us.i.posthog.com; needs NEXT_PUBLIC_POSTHOG_KEY

What it does

Adding Analytics is an agent skill from spencerpauly/awesome-cursor-skills. Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

Its SKILL.md is about 670 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Data & Analytics, covering Product analytics. It works with PostHog, npm and Next.js. The repository describes itself as: A curated list of awesome skills for Cursor. The licence is CC0-1.0.

When your agent uses it

  • Tasks that involve Product analytics

Example prompts

  • “/adding-analytics”

Requirements

  • Python 3
  • Node.js
  • A credential in NEXT_PUBLIC_POSTHOG_KEY

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Detect the framework — check for next.config.*, vite.config.*, package.json scripts, or index.html to determine if this is Next.js, React…
  2. Install the SDK
  3. Create a provider / init module
  4. Add page-view tracking — for SPAs, create a component that calls posthog.capture('$pageview') on route change using the framework's router…
  5. Add .env variables — prompt the user for their PostHog project API key and host
  6. Add custom events — if the user specifies events to track (e.g. sign-up, purchase), add posthog.capture("event_name", { ...properties })…
  7. Feature flags (optional) — if requested, show how to use posthog.isFeatureEnabled("flag-name") or the useFeatureFlagEnabled hook.
  8. Session replay (optional) — enable by adding session_recording: { maskAllInputs: false } to the init config if requested.

What it can do on your machine

Read from SKILL.md and the folder at commit 99cd265. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • us.i.posthog.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • NEXT_PUBLIC_POSTHOG_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Adding Analytics loads about 670 tokens when it runs. Until then it costs about 33 tokens; SKILL.md has 272 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~33
When it runs · the whole SKILL.md, loaded when a task matches
~670

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:48
    5. **Add `.env` variables** — prompt the user for their PostHog project API key and host:

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from spencerpauly/awesome-cursor-skills at commit 99cd265, republished under its CC0-1.0 licence (© spencerpauly). 272 words, ~670 tokens.

Download SKILL.mdSave it as .claude/skills/adding-analytics/SKILL.md (or your agent's skills folder).
name
adding-analytics
description
Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

Add Analytics (PostHog)

Use this skill when the user asks to add analytics, event tracking, page views, feature flags, or session replay to a web application.

Steps

  1. Detect the framework — check for next.config.*, vite.config.*, package.json scripts, or index.html to determine if this is Next.js, React (Vite/CRA), Vue, Svelte, or plain HTML.

  2. Install the SDK

    • Next.js / React: npm install posthog-js
    • Next.js (server-side): npm install posthog-js posthog-node
    • Python: pip install posthog
    • Node.js backend: npm install posthog-node
  3. Create a provider / init module

    • For Next.js App Router, create app/providers.tsx:

      tsx
      "use client";
      import posthog from "posthog-js";
      import { PostHogProvider as PHProvider } from "posthog-js/react";
      import { useEffect } from "react";
      
      export function PostHogProvider({ children }: { children: React.ReactNode }) {
        useEffect(() => {
          posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
            api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST ?? "https://us.i.posthog.com",
            capture_pageview: false, // we capture manually for SPAs
          });
        }, []);
        return <PHProvider client={posthog}>{children}</PHProvider>;
      }
    • Wrap {children} in the root layout with <PostHogProvider>.

    • For Pages Router, init in _app.tsx inside a useEffect.

  4. Add page-view tracking — for SPAs, create a component that calls posthog.capture('$pageview') on route change using the framework's router events.

  5. Add .env variables — prompt the user for their PostHog project API key and host:

    NEXT_PUBLIC_POSTHOG_KEY=phc_...
    NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

    Add these keys to .env.example as well.

  6. Add custom events — if the user specifies events to track (e.g. sign-up, purchase), add posthog.capture("event_name", { ...properties }) calls in the relevant handlers.

  7. Feature flags (optional) — if requested, show how to use posthog.isFeatureEnabled("flag-name") or the useFeatureFlagEnabled hook.

  8. Session replay (optional) — enable by adding session_recording: { maskAllInputs: false } to the init config if requested.

Notes

  • Never hardcode API keys — always use environment variables.
  • Add posthog-js to the Content Security Policy if the project has one.
  • For monorepos, install in the package that renders the UI, not the root.

© spencerpauly, CC0-1.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in resources/adding-analytics of spencerpauly/awesome-cursor-skills.

Open the folder on GitHubat commit 99cd265

Compare with similar skills

Adding Analytics next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Adding Analytics compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Adding Analytics this skillspencerpauly/awesome-cursor-skills841—~670Automated safety check: NotesCC0-1.0
Prod TelemetryUsefulSoftwareCo/executor4.1k—~1.9kAutomated safety check: PassMIT
Posthog Product Health Auditboardsesh/boardsesh163—~2.1kAutomated safety check: PassApache-2.0
Posthog Instrumentationlangfuse/langfuse35k—~3.2kAutomated safety check: PassCustom licence
Posthog Analyticsalinaqi/maggy7071 repos~5.2kAutomated safety check: NotesMIT
Almost Paidnestyme/awesome-prompts149—~3.9kAutomated safety check: PassNone

Similar skills

  • Prod Telemetry

    UsefulSoftwareCo/executor

    Query Executor's production telemetry — Axiom traces (executor-cloud dataset), prod Postgres via PlanetScale, PostHog product analytics — through the Executor MCP.

    4.1k GitHub stars~1.9k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Posthog Product Health Audit

    boardsesh/boardsesh

    Mine Boardsesh's PostHog telemetry (error tracking, session recordings, product analytics) with a multi-agent workflow, then file verified, deduplicated, severity-labelled GitHub issues.

    163 GitHub stars~2.1k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Posthog Instrumentation

    langfuse/langfuse

    Product analytics with posthog. An agent skill from langfuse/langfuse.

    35k GitHub stars~3.2k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Posthog Analytics

    alinaqi/maggy

    PostHog analytics, event tracking, feature flags, dashboards

    707 GitHub starsUsed in 1 repo~5.2k tokens
    Data & AnalyticsAuto-check: notes
  • Almost Paid

    nestyme/awesome-prompts

    Find the users who almost paid — saw the paywall, started checkout, ran out of free credits, let a trial lapse — size what they are worth, and turn them into a one-screen dashboard with a…

    149 GitHub stars~3.9k tokensUpdated 7 days ago
    Data & AnalyticsAuto-check passed
  • Flags SDK

    vercel/vercel-plugin

    Official

    Set up and use feature flags and A/B tests with the Flags SDK (flags npm package) and Vercel Flags.

    301 GitHub stars~6.9k tokensUpdated yesterday
    Marketing & SEOAuto-check: notes

More from spencerpauly/awesome-cursor-skills

All 59 skills in this repo
  • Generating Images

    spencerpauly/awesome-cursor-skills

    Generate or edit images using the OpenAI Image API (gpt-image-2).

    841 GitHub stars~3.7k tokensUpdated 2 mo ago
    Auto-check: notes
  • Babysitting PR

    spencerpauly/awesome-cursor-skills

    Monitor a pull request for CI failures, review comments, and merge conflicts — then fix them automatically.

    841 GitHub stars~930 tokensUpdated 2 mo ago
    Auto-check passed
  • Best Of N Solving

    spencerpauly/awesome-cursor-skills

    Solve a hard problem by trying multiple approaches in parallel using isolated git worktrees.

    841 GitHub stars~698 tokensUpdated 2 mo ago
    Auto-check passed
  • Grinding Until Pass

    spencerpauly/awesome-cursor-skills

    Keep iterating on code changes until the tests pass, the build succeeds, or linting is clean.

    841 GitHub stars~796 tokensUpdated 2 mo ago
    Auto-check passed
  • Parallel CI Triage

    spencerpauly/awesome-cursor-skills

    When GitHub Actions fails, fetch failing job logs and assign each failing job to a separate subagent that fixes its slice of the problem in parallel.

    841 GitHub stars~793 tokensUpdated 2 mo ago
    Auto-check passed
  • Parallel Exploring

    spencerpauly/awesome-cursor-skills

    Explore a large codebase in parallel by launching multiple explore subagents that each investigate a different area simultaneously.

    841 GitHub stars~787 tokensUpdated 2 mo ago
    Auto-check: notes

Questions about Adding Analytics

What does Adding Analytics do?

Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay. Adding Analytics is an agent skill from spencerpauly/awesome-cursor-skills. Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

When should I use Adding Analytics?

Adding Analytics fits situations like: tasks that involve Product analytics.

How do I install Adding Analytics in Claude Code?

Run `npx skills add spencerpauly/awesome-cursor-skills --skill adding-analytics -a claude-code`. Or copy the skill folder (resources/adding-analytics in spencerpauly/awesome-cursor-skills) into .claude/skills/adding-analytics in your project. Claude Code loads it when a task matches its description.

How do I install Adding Analytics in Codex?

Run `npx skills add spencerpauly/awesome-cursor-skills --skill adding-analytics -a codex`. Or copy the skill folder (resources/adding-analytics in spencerpauly/awesome-cursor-skills) into .agents/skills/adding-analytics in your project. Codex loads it when a task matches its description.

Can I use Adding Analytics in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add spencerpauly/awesome-cursor-skills --skill adding-analytics -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/adding-analytics, .gemini/skills/adding-analytics, .github/skills/adding-analytics and .opencode/skills/adding-analytics in your project.

What does Adding Analytics need to run?

Going by SKILL.md and its folder, Adding Analytics needs the command-line tools its instructions call (npm and pip) and credentials named NEXT_PUBLIC_POSTHOG_KEY. Our summary lists: Python 3; Node.js; A credential in NEXT_PUBLIC_POSTHOG_KEY.

Does Adding Analytics access the network?

SKILL.md names 1 domain. In commands or code: us.i.posthog.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Adding Analytics safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Adding Analytics use?

Adding Analytics is published under the CC0-1.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Adding Analytics use?

About 670 tokens (SKILL.md is roughly 2.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Adding Analytics?

Skills that share tags, products or a category with Adding Analytics: Prod Telemetry (UsefulSoftwareCo/executor, 4.1k stars), Posthog Product Health Audit (boardsesh/boardsesh, 163 stars), Posthog Instrumentation (langfuse/langfuse, 35k stars) and Posthog Analytics (alinaqi/maggy, 707 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Adding Analytics?

spencerpauly (a GitHub user) maintains it in spencerpauly/awesome-cursor-skills, which has 841 GitHub stars. The repository holds 59 skills in this directory. The repository was last updated on August 2, 2026.

Source: spencerpauly/awesome-cursor-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.