Agent skill

Posthog Install Auth

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Install an official PostHog SDK and configure the correct project token, regional host, and server-only credentials.

MITAuto-check: notesBackend & APIs

Install Posthog Install Auth

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-install-auth -a claude-code

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace posthog-install-auth --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/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/posthog-install-auth .claude/skills/posthog-install-auth && 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
posthog-install-auth
GitHub stars
2.8k
Token cost
~1.7k tokens
SKILL.md length
392 words
Files
2 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Install an official PostHog SDK and configure the correct project token, regional host, and server-only credentials.

  • Works in 6 steps: Install the SDK → Configure Environment Variables → Initialize Browser SDK (posthog-js) → …
  • Repairing SDK authentication
  • SKILL.md covers Overview, Prerequisites, Instructions and API Key Reference, plus 6 more sections
  • Calls npm and pip; reaches us.i.posthog.com and us.posthog.com; needs NEXT_PUBLIC_POSTHOG_KEY and POSTHOG_FEATURE_FLAGS_SECURE_API_KEY

What it does

Posthog Install Auth is an agent skill from jeremylongshore/tons-of-skills-marketplace. Install an official PostHog SDK and configure the correct project token, regional host, and server-only credentials. Use when bootstrapping or repairing SDK authentication. Trigger with "install PostHog", "configure PostHog", or "PostHog API key".

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/official-docs.md`). Compatibility notes: Designed for Claude Code

It sits in Backend & APIs. It works with PostHog. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Repairing SDK authentication
  • With install PostHog
  • Configure PostHog
  • PostHog API key

Example prompts

  • “install PostHog”
  • “configure PostHog”
  • “PostHog API key”
  • “/posthog-install-auth”

Requirements

  • Python 3
  • Node.js
  • A credential in NEXT_PUBLIC_POSTHOG_KEY
  • A credential in POSTHOG_PERSONAL_API_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Install the SDK
  2. Configure Environment Variables
  3. Initialize Browser SDK (posthog-js)
  4. Initialize Server SDK (posthog-node)
  5. Initialize Python SDK
  6. Verify Connection

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(npm:*)
    • Bash(pip:*)
    • Grep

    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
    • us.posthog.com
    • eu.i.posthog.com
    • eu.posthog.com

    Also links to:

    • 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
    • POSTHOG_FEATURE_FLAGS_SECURE_API_KEY
    • POSTHOG_PERSONAL_API_KEY

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

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Posthog Install Auth loads about 1.7k tokens when it runs, and up to ~1.9k if it reads all its reference files. Until then it costs about 67 tokens; SKILL.md has 392 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~67
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.9k

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:53
    # .env (add to .gitignore — never commit)
  • NoteMentions a .env fileSKILL.md:178
    - `.env` file with project and personal API keys

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 jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 392 words, ~1,709 tokens.

Download SKILL.mdSave it as .claude/skills/posthog-install-auth/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
posthog-install-auth
description
Install an official PostHog SDK and configure the correct project token, regional host, and server-only credentials. Use when bootstrapping or repairing SDK authentication. Trigger with "install PostHog", "configure PostHog", or "PostHog API key".
allowed-tools
Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep
compatibility
Designed for Claude Code
argument-hint
[project-path] [sdk] [region]
version
1.14.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, posthog, api, authentication

PostHog Install & Auth

Overview

Install PostHog SDKs and configure authentication. PostHog uses two key types: Project API Key (phc_...) for event capture (public, safe for frontend) and Personal API Key (phx_...) for private API endpoints (never expose to clients).

Prerequisites

  • Node.js 20+ or Python 3.10+
  • PostHog account at app.posthog.com
  • Project API key from Project Settings > Project API Key
  • Personal API key from Settings > Personal API Keys (for server-side admin)

Instructions

Tool discipline

Use Read to inspect the relevant configuration and implementation before proposing changes. Use Grep to locate initialization, capture, flag, and credential boundaries. Use Write only for a new, explicitly requested artifact inside the target project. Use Edit for minimal changes to existing project files after the evidence pass.

Step 1: Install the SDK
bash
set -euo pipefail
# Browser SDK (posthog-js)
npm install posthog-js

# Node.js server SDK (posthog-node)
npm install posthog-node

# Python SDK
pip install posthog
Step 2: Configure Environment Variables
bash
# .env (add to .gitignore — never commit)
NEXT_PUBLIC_POSTHOG_KEY=phc_your_project_api_key    # Safe for frontend
POSTHOG_HOST=https://us.i.posthog.com               # US Cloud (or eu.i.posthog.com)
POSTHOG_PERSONAL_API_KEY=phx_your_personal_key      # Server-only, never expose
POSTHOG_FEATURE_FLAGS_SECURE_API_KEY=your_project_specific_secure_key # Server-side only
POSTHOG_PROJECT_ID=12345                             # From project URL
Step 3: Initialize Browser SDK (posthog-js)
typescript
// lib/posthog.ts
import posthog from 'posthog-js';

export function initPostHog() {
  if (typeof window === 'undefined') return;

  posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
    api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://us.i.posthog.com',
    capture_pageview: true,        // Auto-capture $pageview
    capture_pageleave: true,       // Auto-capture $pageleave
    autocapture: true,             // Auto-capture clicks, inputs, form submits
    persistence: 'localStorage+cookie',
    loaded: (ph) => {
      if (process.env.NODE_ENV === 'development') {
        ph.debug();  // Logs all events to console
      }
    },
  });
}
Step 4: Initialize Server SDK (posthog-node)
typescript
// lib/posthog-server.ts
import { PostHog } from 'posthog-node';

let client: PostHog | null = null;

export function getPostHog(): PostHog {
  if (!client) {
    client = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
      host: process.env.POSTHOG_HOST || 'https://us.i.posthog.com',
      flushAt: 20,           // Send batch when 20 events queued
      flushInterval: 10000,  // Or every 10 seconds
      // The option name is retained by the SDK; pass the feature flags secure API key.
      personalApiKey: process.env.POSTHOG_FEATURE_FLAGS_SECURE_API_KEY,
    });
  }
  return client;
}

// CRITICAL: Flush before process exits (especially in serverless)
export async function shutdownPostHog() {
  if (client) {
    await client.shutdown();
    client = null;
  }
}
Step 5: Initialize Python SDK
python
import posthog
import os

posthog.project_api_key = os.getenv('NEXT_PUBLIC_POSTHOG_KEY')
posthog.host = os.getenv('POSTHOG_HOST', 'https://us.i.posthog.com')
posthog.personal_api_key = os.getenv('POSTHOG_FEATURE_FLAGS_SECURE_API_KEY')
posthog.debug = os.getenv('NODE_ENV') == 'development'

# Capture an event
posthog.capture('user-123', 'my_event', {'property_key': 'value'})
Step 6: Verify Connection
typescript
import { getPostHog } from './posthog-server';

async function verifyPostHog() {
  const ph = getPostHog();
  ph.capture({
    distinctId: 'test-setup',
    event: 'posthog_setup_verified',
    properties: { source: 'install-auth-skill' },
  });
  await ph.flush();
  console.log('PostHog event sent — check Activity tab in app.posthog.com');
}

verifyPostHog();

API Key Reference

Key TypePrefixUseExpose to Client?
Project API Keyphc_Capture events, evaluate flagsYes (public)
Personal API Keyphx_Private API scripts and HogQL queriesNever
Feature Flags Secure API Keyproject-specific secretServer-side local flag evaluationNever

API Hosts

RegionIngest HostApp Host
US Cloudhttps://us.i.posthog.comhttps://us.posthog.com
EU Cloudhttps://eu.i.posthog.comhttps://eu.posthog.com
Self-hostedYour domainYour domain
Show full SKILL.md (178 more words)Show less

Error Handling

ErrorCauseSolution
posthog.init ignoredCalled server-sideGuard with typeof window !== 'undefined'
Events not appearingWrong API key prefixUse phc_ project key for capture
401 Unauthorized on APIPersonal key expired/missingGenerate new key in Settings > Personal API Keys
ECONNREFUSEDWrong host URLVerify US vs EU region in api_host
Module not foundSDK not installedRun npm install posthog-js or npm install posthog-node

Output

  • Installed PostHog SDK(s) in node_modules or site-packages
  • .env file with project and personal API keys
  • Initialization code for browser and/or server
  • Verified event delivery to PostHog dashboard

Examples

For a Node service, install posthog-node, initialize one long-lived client with the project token and regional ingest host, and add a shutdown path. Add a feature-flags secure key only for server-side local evaluation; use a scoped personal key, project secret key where available, or OAuth for private API calls.

Resources

See official PostHog references for current authority and verification boundaries.

Next Steps

After setup, proceed to posthog-hello-world for your first event capture.

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

Files

SKILL.md and 1 other file (references) in skills/.curated/posthog-install-auth of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/official-docs.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Posthog Install Auth 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.

Posthog Install Auth compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Posthog Install Auth this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.7kAutomated safety check: NotesMIT
Feature Flagspeakeasy-api/gram273—~2.6kAutomated safety check: PassAGPL-3.0
tRPC Release Compatibility Checksuperset-sh/superset15k—~1.7kAutomated safety check: PassCustom licence
Adding Personhog RpcPostHog/posthog40k—~2.1kAutomated safety check: PassCustom licence
Authoring Error Tracking AlertsPostHog/posthog40k—~2.8kAutomated safety check: PassCustom licence
Improving Drf EndpointsPostHog/posthog40k—~3kAutomated safety check: PassCustom licence

Similar skills

  • Feature Flag

    speakeasy-api/gram

    A skill your agent uses when gating a feature behind a flag, dogfooding or gradually rolling out a change, choosing between productfeatures and PostHog feature flags, adding or checking a product…

    273 GitHub stars~2.6k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Checks whether a tRPC procedure change is safe for released desktop, mobile, CLI and SDK builds, picks a compatible pattern and decides when a deprecated procedure can go.

    15k GitHub stars~1.7k tokensUpdated today
    Backend & APIsAuto-check passed
  • Adding Personhog Rpc

    PostHog/posthog

    Official

    Guide for adding a new RPC to personhog-replica and personhog-router.

    40k GitHub stars~2.1k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Official

    Author error tracking alerts that fire when an issue is created, reopened, or starts spiking.

    40k GitHub stars~2.8k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Official

    A skill your agent uses when editing, reviewing, or auditing DRF viewsets and serializers in PostHog.

    40k GitHub stars~3k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Official

    Guides PostHog engineers through dashboard widget platform work — ship a new widgettype (WIDGETREGISTRY, catalog, runwidgets, WidgetCard) or update a shipped type (config, query, layout, RBAC, tile…

    40k GitHub stars~2.3k tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Posthog Install Auth

What does Posthog Install Auth do?

Install an official PostHog SDK and configure the correct project token, regional host, and server-only credentials. Posthog Install Auth is an agent skill from jeremylongshore/tons-of-skills-marketplace. Install an official PostHog SDK and configure the correct project token, regional host, and server-only credentials.

When should I use Posthog Install Auth?

Posthog Install Auth fits situations like: repairing SDK authentication; with install PostHog; configure PostHog; postHog API key.

How do I install Posthog Install Auth in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-install-auth -a claude-code`. Or copy the skill folder (skills/.curated/posthog-install-auth in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/posthog-install-auth in your project. Claude Code loads it when a task matches its description.

How do I install Posthog Install Auth in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-install-auth -a codex`. Or copy the skill folder (skills/.curated/posthog-install-auth in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/posthog-install-auth in your project. Codex loads it when a task matches its description.

Can I use Posthog Install Auth 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 jeremylongshore/tons-of-skills-marketplace --skill posthog-install-auth -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/posthog-install-auth, .gemini/skills/posthog-install-auth, .github/skills/posthog-install-auth and .opencode/skills/posthog-install-auth in your project.

What does Posthog Install Auth need to run?

Going by SKILL.md and its folder, Posthog Install Auth needs the command-line tools its instructions call (npm and pip) and credentials named NEXT_PUBLIC_POSTHOG_KEY, POSTHOG_FEATURE_FLAGS_SECURE_API_KEY and POSTHOG_PERSONAL_API_KEY. Our summary lists: Python 3; Node.js; A credential in NEXT_PUBLIC_POSTHOG_KEY; A credential in POSTHOG_PERSONAL_API_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Posthog Install Auth access the network?

SKILL.md names 5 domains. In commands or code: us.i.posthog.com, us.posthog.com, eu.i.posthog.com and eu.posthog.com; the agent is likely to contact these when it follows the instructions. As links in the text: posthog.com. This is read from the text; nothing was executed.

Is Posthog Install Auth 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 Posthog Install Auth use?

Posthog Install Auth is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Posthog Install Auth use?

About 1.7k tokens (SKILL.md is roughly 6.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 201 tokens, read only when the agent opens those files.

What are the alternatives to Posthog Install Auth?

Skills that share tags, products or a category with Posthog Install Auth: Feature Flag (speakeasy-api/gram, 273 stars), tRPC Release Compatibility Check (superset-sh/superset, 15k stars), Adding Personhog Rpc (PostHog/posthog, 40k stars) and Authoring Error Tracking Alerts (PostHog/posthog, 40k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Posthog Install Auth?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

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