adding-analytics
Skill2 starsChanged 6 months agoMITView on GitHub
Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay. Use when the user says "/adding-analytics", "adding analytics", or asks about adding analytics.
- Reads credentials
- Installs packages
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when the user asks to add analytics, event tracking, page views, feature flags, or session replay to a web application.
- Very specific: line 55
Add these keys to .env.example as well.
- Distinctive: line 65
Never hardcode API keys — always use environment variables.
- Very specific: line 66
Add posthog-js to the Content Security Policy if the project has one.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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
- Detect the framework — check for
next.config.*,vite.config.*,package.jsonscripts, orindex.htmlto determine if this is Next.js, React (Vite/CRA), Vue, Svelte, or plain HTML. 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
- Next.js / React:
Create a provider / init module
For Next.js App Router, create
app/providers.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.tsxinside auseEffect.
- Add page-view tracking — for SPAs, create a component that calls
posthog.capture('$pageview')on route change using the framework's router events. Add
.envvariables — prompt the user for their PostHog project API key and host:NEXT_PUBLIC_POSTHOG_KEY=phc_... NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.comAdd these keys to
.env.exampleas well.- 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. - Feature flags (optional) — if requested, show how to use
posthog.isFeatureEnabled("flag-name")or theuseFeatureFlagEnabledhook. - 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-jsto the Content Security Policy if the project has one. - For monorepos, install in the package that renders the UI, not the root.
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- ZeroTokenClaw/agents-skills★ 199% same
- matarpeles/skills-registry-demo★ 099% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository85 other files it gives its agents.
- accessibility-auditingSkill
- adding-api-docsSkill
- adding-authSkill
- adding-dockerSkill
- adding-e2e-testsSkill
- adding-error-trackingSkill
- adding-feature-flagsSkill
- adding-stripeSkill
- api-smoke-testingSkill
- architecture-decision-recordsSkill
- auditing-performanceSkill
- auditing-securitySkill
- auto-type-checkingSkill
- babysitting-prSkill
- best-of-n-solvingSkill
- building-skills-from-patternsSkill
- cavemanSkill
- codebase-onboardingSkill
- comparing-branches-visuallySkill
- converting-css-modules-to-tailwindSkill
- converting-css-to-tailwindSkill
- creating-prSkill
- dark-mode-testingSkill
- database-designSkill
- design-an-interfaceSkill
- detecting-port-conflictsSkill
- domain-modelSkill
- edit-articleSkill
- exporting-to-pngSkill
- finding-dev-server-urlSkill
- fixing-broken-linksSkill
- form-testingSkill
- generating-imagesSkill
- git-guardrails-claude-codeSkill
- github-triageSkill
- grill-meSkill
- grinding-until-passSkill
- improve-codebase-architectureSkill
- incident-responseSkill
- kubernetes-deployingSkill
- migrate-to-shoehornSkill
- monitoring-terminal-errorsSkill
- network-request-auditingSkill
- obsidian-vaultSkill
- parallel-ci-triageSkill
- parallel-code-reviewSkill
- parallel-exploringSkill
- parallel-test-fixingSkill
- profiling-performanceSkill
- prompt-engineeringSkill
- python-tdd-with-uvSkill
- qaSkill
- react-native-patternsSkill
- recording-browser-flow-as-testSkill
- request-refactor-planSkill
- responsive-testingSkill
- reviewing-codeSkill
- saving-workspace-contextSkill
- scaffold-exercisesSkill
- screenshotting-changelogSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

