Agent skill

Posthog CI Integration

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

Build repository-specific PostHog CI gates for SDK initialization, typed capture tests, release annotations, and secret boundaries.

MITAuto-check passedDevOps & Cloud

Install Posthog CI Integration

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

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

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

At a glance

Build repository-specific PostHog CI gates for SDK initialization, typed capture tests, release annotations, and secret boundaries.

  • Works in 5 steps: Configure GitHub Secrets → GitHub Actions Workflow → Unit Tests with Mocked PostHog → …
  • Reviewing PostHog checks in continuous integration
  • SKILL.md covers Overview, Prerequisites, Instructions and Error Handling, plus 4 more sections
  • Calls gh; reaches us.i.posthog.com and us.posthog.com; needs POSTHOG_TEST_KEY and POSTHOG_PERSONAL_API_KEY

What it does

Posthog CI Integration is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build repository-specific PostHog CI gates for SDK initialization, typed capture tests, release annotations, and secret boundaries. Use when adding or reviewing PostHog checks in continuous integration. Trigger with "posthog CI", "PostHog GitHub Actions", or "test PostHog integration".

Its SKILL.md is about 2k 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 DevOps & Cloud, covering CI/CD, Unit testing and Integration testing. It works with PostHog and GitHub Actions. 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

  • Reviewing PostHog checks in continuous integration
  • With posthog CI
  • PostHog GitHub Actions
  • Test PostHog integration

Example prompts

  • “posthog CI”
  • “PostHog GitHub Actions”
  • “test PostHog integration”
  • “/posthog-ci-integration”

Requirements

  • A credential in POSTHOG_TEST_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(gh:*)

Workflow steps

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

  1. Configure GitHub Secrets
  2. GitHub Actions Workflow
  3. Unit Tests with Mocked PostHog
  4. Integration Tests (Real PostHog Project)
  5. Package Scripts

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(gh:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • gh

    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

    Also links to:

    • docs.github.com
    • posthog.com
    • vitest.dev

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

  • Credentials

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

    • POSTHOG_TEST_KEY
    • POSTHOG_PERSONAL_API_KEY
    • NEXT_PUBLIC_POSTHOG_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 CI Integration loads about 2k tokens when it runs, and up to ~2.2k if it reads all its reference files. Until then it costs about 77 tokens; SKILL.md has 293 words of instructions outside code blocks.

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

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 passed

The automated check found no risky patterns in SKILL.md.

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). 293 words, ~2,041 tokens.

Download SKILL.mdSave it as .claude/skills/posthog-ci-integration/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
posthog-ci-integration
description
Build repository-specific PostHog CI gates for SDK initialization, typed capture tests, release annotations, and secret boundaries. Use when adding or reviewing PostHog checks in continuous integration. Trigger with "posthog CI", "PostHog GitHub Actions", or "test PostHog integration".
allowed-tools
Read, Write, Edit, Bash(gh:*)
compatibility
Designed for Claude Code
argument-hint
[project-path] [ci-provider]
version
1.14.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, posthog, testing, ci-cd

PostHog CI Integration

Overview

Set up CI/CD pipelines for PostHog integrations. Covers mocked unit tests (no API key needed), integration tests against a PostHog dev project, and deployment annotations that mark releases in your PostHog timeline.

Prerequisites

  • GitHub repository with Actions enabled
  • PostHog dev project API key for integration tests
  • PostHog personal API key for deployment annotations
  • npm/pnpm project with vitest or jest

Instructions

Tool discipline

Use Read to inspect the relevant configuration and implementation before proposing changes. 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: Configure GitHub Secrets
bash
set -euo pipefail
# Project key for integration tests (phc_... from dev project)
gh secret set POSTHOG_TEST_KEY --body "phc_dev_project_key"

# Personal key for deployment annotations (phx_...)
gh secret set POSTHOG_PERSONAL_API_KEY --body "phx_your_personal_key"

# Project ID for annotations
gh secret set POSTHOG_PROJECT_ID --body "12345"
Step 2: GitHub Actions Workflow
yaml
# .github/workflows/posthog-tests.yml
name: PostHog Tests

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  unit-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm test -- --coverage
        # Unit tests use mocked PostHog — no API key needed

  integration-tests:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    needs: unit-tests
    env:
      NEXT_PUBLIC_POSTHOG_KEY: ${{ secrets.POSTHOG_TEST_KEY }}
      POSTHOG_HOST: https://us.i.posthog.com
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm run test:integration
        timeout-minutes: 5

  annotate-deploy:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    needs: integration-tests
    steps:
      - name: Create PostHog annotation
        env:
          POSTHOG_PERSONAL_API_KEY: ${{ secrets.POSTHOG_PERSONAL_API_KEY }}
          POSTHOG_PROJECT_ID: ${{ secrets.POSTHOG_PROJECT_ID }}
        run: |
          curl -X POST "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/annotations/" \
            -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
            -H "Content-Type: application/json" \
            -d "{
              \"content\": \"Deploy: ${GITHUB_SHA::8} — ${GITHUB_EVENT_HEAD_COMMIT_MESSAGE:-$(git log -1 --pretty=%s)}\",
              \"date_marker\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",
              \"scope\": \"project\"
            }"
Step 3: Unit Tests with Mocked PostHog
typescript
// tests/analytics.test.ts — runs in CI without any API keys
import { describe, it, expect, vi, beforeEach } from 'vitest';

vi.mock('posthog-node', () => ({
  PostHog: vi.fn().mockImplementation(() => ({
    capture: vi.fn(),
    identify: vi.fn(),
    getFeatureFlag: vi.fn().mockResolvedValue('control'),
    isFeatureEnabled: vi.fn().mockResolvedValue(true),
    getAllFlags: vi.fn().mockResolvedValue({ 'new-feature': true }),
    flush: vi.fn().mockResolvedValue(undefined),
    shutdown: vi.fn().mockResolvedValue(undefined),
  })),
}));

import { PostHog } from 'posthog-node';

describe('PostHog Analytics', () => {
  let ph: InstanceType<typeof PostHog>;

  beforeEach(() => {
    vi.clearAllMocks();
    ph = new PostHog('phc_test');
  });

  it('captures events with required properties', () => {
    ph.capture({
      distinctId: 'user-1',
      event: 'subscription_started',
      properties: { plan: 'pro', interval: 'annual' },
    });

    expect(ph.capture).toHaveBeenCalledWith(
      expect.objectContaining({
        event: 'subscription_started',
        properties: expect.objectContaining({ plan: 'pro' }),
      })
    );
  });

  it('evaluates feature flags with default fallback', async () => {
    const enabled = await ph.isFeatureEnabled('new-feature', 'user-1');
    expect(enabled).toBe(true);
  });

  it('gets multivariate flag variant', async () => {
    const variant = await ph.getFeatureFlag('experiment', 'user-1');
    expect(variant).toBe('control');
  });
});
Step 4: Integration Tests (Real PostHog Project)
typescript
// tests/integration/posthog.test.ts
import { describe, it, expect, afterAll } from 'vitest';
import { PostHog } from 'posthog-node';

const KEY = process.env.NEXT_PUBLIC_POSTHOG_KEY;

describe.skipIf(!KEY)('PostHog Integration', () => {
  const ph = new PostHog(KEY!, {
    host: process.env.POSTHOG_HOST || 'https://us.i.posthog.com',
    flushAt: 1,
    flushInterval: 0,
  });

  afterAll(async () => await ph.shutdown());

  it('captures and flushes an event', async () => {
    ph.capture({
      distinctId: `ci-${Date.now()}`,
      event: 'ci_integration_test',
      properties: {
        ci: true,
        run_id: process.env.GITHUB_RUN_ID || 'local',
      },
    });
    await expect(ph.flush()).resolves.not.toThrow();
  });

  it('evaluates feature flags', async () => {
    const flags = await ph.getAllFlags(`ci-${Date.now()}`);
    expect(typeof flags).toBe('object');
  });

  it('resolves the flags endpoint', async () => {
    const response = await fetch(`${process.env.POSTHOG_HOST}/flags?v=2`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ api_key: KEY, distinct_id: 'ci-test' }),
    });
    expect(response.status).toBe(200);
    const data = await response.json();
    expect(data).toHaveProperty('flags');
  });
});
Step 5: Package Scripts
json
{
  "scripts": {
    "test": "vitest run",
    "test:integration": "vitest run tests/integration/",
    "test:coverage": "vitest run --coverage"
  }
}

Error Handling

IssueCauseSolution
Integration tests fail in CISecret not configuredRun gh secret set POSTHOG_TEST_KEY
Tests timeoutPostHog unreachable from CI runnerIncrease timeout, add retry
Annotation failsWrong personal keyVerify phx_ key, check project ID
Mock type mismatchPostHog SDK updatedUpdate mock to match new SDK exports

Output

  • Unit test suite with mocked PostHog (runs everywhere, no keys needed)
  • Integration test suite against PostHog dev project (runs on main only)
  • Deployment annotations marking each release in PostHog timeline
  • GitHub Actions workflow with proper secret management

Examples

For a Next.js service, inspect the analytics wrapper and test setup, add a mocked capture contract, and gate the workflow on type checks plus the focused test. Report the changed files, commands run, and whether a deployment annotation remains opt-in behind protected credentials.

Resources

See official PostHog references for current authority and verification boundaries.

Next Steps

For deployment patterns, see posthog-deploy-integration.

© 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-ci-integration of jeremylongshore/tons-of-skills-marketplace.

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

Open the folder on GitHubat commit cfae287

Compare with similar skills

Posthog CI Integration 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 CI Integration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Posthog CI Integration this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2kAutomated safety check: PassMIT
Megatron Core Testing GuideNVIDIA/Megatron-LM18k—~2.1kAutomated safety check: PassApache-2.0
Code PatternsAedelon/claude-code-blueprint120—~1.2kAutomated safety check: PassCustom licence
Flaker Storage Cache On CImizchi/skills360—~1.6kAutomated safety check: PassNone
Mirrord CImetalbear-co/mirrord5.4k1 repos~3.2kAutomated safety check: WarnMIT
Bats Shell Testing Patternswshobson/agents40k12 repos~1.3kAutomated safety check: PassMIT

Similar skills

  • Megatron Core Testing Guide

    NVIDIA/Megatron-LM

    Official

    Guide to the Megatron-LM test system: layout, recipe YAML, running and adding unit and functional tests, golden values, marker filters and CI parity.

    18k GitHub stars~2.1k tokensUpdated today
    Testing & QAAuto-check passed
  • Code Patterns

    Aedelon/claude-code-blueprint

    Reference patterns for REST APIs, pytest/vitest testing, Docker multi-stage builds, GitHub Actions CI/CD, PostgreSQL, TypeScript generics, Python async, and React Server Components.

    120 GitHub stars~1.2k tokensUpdated 7 mo ago
    DevOps & CloudAuto-check passed
  • Persist flaker's DuckDB storage across GitHub Actions runs and feed it from multiple sources (vitest reports, custom adapter reports, etc.).

    360 GitHub stars~1.6k tokensUpdated 9 days ago
    DevOps & CloudAuto-check passed
  • Mirrord CI

    metalbear-co/mirrord

    Help users set up mirrord in CI pipelines for testing against real Kubernetes environments.

    5.4k GitHub starsUsed in 1 repo~3.2k tokens
    DevOps & CloudAuto-check: warnings
  • Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.

    40k GitHub starsUsed in 12 repos~1.3k tokens
    Testing & QAAuto-check passed
  • Depot CI

    PostHog/posthog

    Official

    Configures and manages Depot CI, a drop-in replacement for GitHub Actions that runs workflows entirely within Depot.

    40k GitHub stars~6k tokensUpdated yesterday
    DevOps & CloudAuto-check: notes

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

Questions about Posthog CI Integration

What does Posthog CI Integration do?

Build repository-specific PostHog CI gates for SDK initialization, typed capture tests, release annotations, and secret boundaries. Posthog CI Integration is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build repository-specific PostHog CI gates for SDK initialization, typed capture tests, release annotations, and secret boundaries.

When should I use Posthog CI Integration?

Posthog CI Integration fits situations like: reviewing PostHog checks in continuous integration; with posthog CI; postHog GitHub Actions; test PostHog integration.

How do I install Posthog CI Integration in Claude Code?

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

How do I install Posthog CI Integration in Codex?

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

Can I use Posthog CI Integration 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-ci-integration -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-ci-integration, .gemini/skills/posthog-ci-integration, .github/skills/posthog-ci-integration and .opencode/skills/posthog-ci-integration in your project.

What does Posthog CI Integration need to run?

Going by SKILL.md and its folder, Posthog CI Integration needs the command-line tools its instructions call (gh) and credentials named POSTHOG_TEST_KEY, POSTHOG_PERSONAL_API_KEY and NEXT_PUBLIC_POSTHOG_KEY. Our summary lists: A credential in POSTHOG_TEST_KEY; A credential in POSTHOG_PERSONAL_API_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(gh:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Posthog CI Integration access the network?

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

Is Posthog CI Integration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Posthog CI Integration use?

Posthog CI Integration 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 CI Integration use?

About 2k tokens (SKILL.md is roughly 8.2k 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 199 tokens, read only when the agent opens those files.

What are the alternatives to Posthog CI Integration?

Skills that share tags, products or a category with Posthog CI Integration: Megatron Core Testing Guide (NVIDIA/Megatron-LM, 18k stars), Code Patterns (Aedelon/claude-code-blueprint, 120 stars), Flaker Storage Cache On CI (mizchi/skills, 360 stars) and Mirrord CI (metalbear-co/mirrord, 5.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Posthog CI Integration?

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.