Agent skill

Posthog Core Workflow B

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

Implement a safe PostHog feature-flag and experiment lifecycle with defaults, exposure integrity, rollout ownership, and cleanup.

MITAuto-check passedMarketing & SEO

Install Posthog Core Workflow B

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill posthog-core-workflow-b -a claude-code

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

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

At a glance

Implement a safe PostHog feature-flag and experiment lifecycle with defaults, exposure integrity, rollout ownership, and cleanup.

  • Works in 6 steps: Evaluate Feature Flags (Browser) → Evaluate Feature Flags (Server —… → Create Feature Flags via API → …
  • Releasing behind flags
  • SKILL.md covers Overview, Prerequisites, Instructions and Error Handling, plus 4 more sections
  • Calls curl and jq; reaches us.posthog.com and us.i.posthog.com; needs POSTHOG_PERSONAL_API_KEY and NEXT_PUBLIC_POSTHOG_KEY

What it does

Posthog Core Workflow B is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement a safe PostHog feature-flag and experiment lifecycle with defaults, exposure integrity, rollout ownership, and cleanup. Use when releasing behind flags or running controlled experiments. Trigger with "PostHog feature flag", "PostHog experiment", or "A/B test".

Its SKILL.md is about 2.3k 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 Marketing & SEO, covering A/B testing. 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

  • Releasing behind flags
  • Running controlled experiments
  • With PostHog feature flag
  • PostHog experiment

Example prompts

  • “PostHog feature flag”
  • “PostHog experiment”
  • “A/B test”
  • “/posthog-core-workflow-b”

Requirements

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

Workflow steps

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

  1. Evaluate Feature Flags (Browser)
  2. Evaluate Feature Flags (Server — posthog-node)
  3. Create Feature Flags via API
  4. Set Up an Experiment
  5. Query Experiment Results via API
  6. Manage Cohorts via API

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:*)
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl
    • jq

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

    • POSTHOG_PERSONAL_API_KEY
    • NEXT_PUBLIC_POSTHOG_KEY
    • POSTHOG_FEATURE_FLAGS_SECURE_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 Core Workflow B loads about 2.3k tokens when it runs, and up to ~2.5k if it reads all its reference files. Until then it costs about 74 tokens; SKILL.md has 329 words of instructions outside code blocks.

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

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). 329 words, ~2,291 tokens.

Download SKILL.mdSave it as .claude/skills/posthog-core-workflow-b/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
posthog-core-workflow-b
description
Implement a safe PostHog feature-flag and experiment lifecycle with defaults, exposure integrity, rollout ownership, and cleanup. Use when releasing behind flags or running controlled experiments. Trigger with "PostHog feature flag", "PostHog experiment", or "A/B test".
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
compatibility
Designed for Claude Code
argument-hint
[project-path] [flag-or-experiment]
version
1.14.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, posthog, workflow, feature-flags, experiments

PostHog Core Workflow B — Feature Flags & Experiments

Overview

Feature flag management, A/B experiment evaluation, and cohort analysis with PostHog. Covers boolean and multivariate flags, local evaluation for performance, experiment setup and statistical significance, and cohort creation via the API.

Prerequisites

  • Completed posthog-install-auth setup
  • Familiarity with posthog-core-workflow-a (event capture)
  • Personal API key (phx_...) for flag management API

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: Evaluate Feature Flags (Browser)
typescript
import posthog from 'posthog-js';

// Boolean flag
if (posthog.isFeatureEnabled('new-checkout-flow')) {
  renderNewCheckout();
} else {
  renderLegacyCheckout();
}

// Multivariate flag (returns string variant name)
const variant = posthog.getFeatureFlag('pricing-page-experiment');
switch (variant) {
  case 'control':
    renderOriginalPricing();
    break;
  case 'annual-first':
    renderAnnualFirstPricing();
    break;
  case 'social-proof':
    renderSocialProofPricing();
    break;
  default:
    renderOriginalPricing(); // Fallback if flag not loaded yet
}

// Get flag payload (JSON data attached to a flag variant)
const payload = posthog.getFeatureFlagPayload('banner-config');
// payload: { text: "Spring sale!", color: "#ff6b35", discount: 20 }

// React: Wait for flags to load before rendering
posthog.onFeatureFlags(() => {
  // Flags are now loaded and ready
  const enabled = posthog.isFeatureEnabled('new-feature');
  setFeatureEnabled(enabled ?? false);
});
Step 2: Evaluate Feature Flags (Server — posthog-node)
typescript
import { PostHog } from 'posthog-node';

const posthog = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
  host: 'https://us.i.posthog.com',
  // The SDK option accepts the server-only feature flags secure API key.
  personalApiKey: process.env.POSTHOG_FEATURE_FLAGS_SECURE_API_KEY,
});

// Single flag evaluation
async function checkFlag(userId: string): Promise<boolean> {
  const enabled = await posthog.isFeatureEnabled('new-api-version', userId);
  return enabled ?? false;
}

// Multivariate flag
async function getVariant(userId: string): Promise<string> {
  const variant = await posthog.getFeatureFlag('onboarding-experiment', userId, {
    personProperties: { plan: 'pro', country: 'US' },
  });
  return (variant as string) || 'control';
}

// Get ALL flags for a user at once (one network call)
async function getUserFlags(userId: string) {
  const flags = await posthog.getAllFlags(userId, {
    personProperties: { plan: 'enterprise' },
    groupProperties: { company: { name: 'Acme' } },
  });
  // flags: { 'new-checkout': true, 'pricing-experiment': 'variant-a', ... }
  return flags;
}

// Get all flags with their payloads
async function getFlagsAndPayloads(userId: string) {
  const result = await posthog.getAllFlagsAndPayloads(userId);
  // result.featureFlags: { 'banner': true }
  // result.featureFlagPayloads: { 'banner': { text: 'Sale!' } }
  return result;
}
Step 3: Create Feature Flags via API
bash
set -euo pipefail
# Create a boolean feature flag with percentage rollout
curl -X POST "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/feature_flags/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "new-dashboard-v2",
    "name": "New Dashboard V2",
    "active": true,
    "filters": {
      "groups": [{
        "rollout_percentage": 25,
        "properties": []
      }]
    }
  }'

# Create a multivariate flag for A/B testing
curl -X POST "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/feature_flags/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "checkout-experiment",
    "name": "Checkout Flow Experiment",
    "active": true,
    "filters": {
      "multivariate": {
        "variants": [
          {"key": "control", "rollout_percentage": 50},
          {"key": "streamlined", "rollout_percentage": 50}
        ]
      },
      "groups": [{"rollout_percentage": 100, "properties": []}]
    }
  }'
Step 4: Set Up an Experiment
typescript
// Track experiment exposure and goal metrics
async function runExperiment(userId: string) {
  const posthog = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!);

  // PostHog automatically tracks $feature_flag_called when you evaluate
  const variant = await posthog.getFeatureFlag('checkout-experiment', userId);

  // Track the goal metric
  posthog.capture({
    distinctId: userId,
    event: 'purchase_completed',
    properties: {
      variant,
      order_value: 49.99,
      // PostHog will attribute this to the experiment automatically
    },
  });

  await posthog.flush();
  return variant;
}
Step 5: Query Experiment Results via API
bash
set -euo pipefail
# List experiments and their status
curl "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/experiments/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" | \
  jq '.results[] | {id, name, start_date, end_date, feature_flag_key}'

# Get experiment results
curl "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/experiments/EXPERIMENT_ID/results/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" | \
  jq '{
    variants: [.result.variants[] | {key, count, conversion_rate: .absolute_exposure}],
    significance: .result.significance_code,
    probability: .result.probability
  }'
Step 6: Manage Cohorts via API
bash
set -euo pipefail
# Create a behavioral cohort (users who signed up in last 30 days)
curl -X POST "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/cohorts/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Recent Signups (30d)",
    "is_calculating": true,
    "filters": {
      "properties": {
        "type": "AND",
        "values": [{
          "type": "AND",
          "values": [{
            "key": "user_signed_up",
            "type": "behavioral",
            "value": "performed_event",
            "time_value": 30,
            "time_interval": "day"
          }]
        }]
      }
    }
  }'

# List cohorts
curl "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/cohorts/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" | \
  jq '.results[] | {id, name, count, is_calculating}'

Error Handling

ErrorCauseSolution
Flag always returns undefinedFlags not loaded yetUse posthog.onFeatureFlags() callback
Flag returns default on serverSecure flag key or targeting context missingVerify the feature flags secure key and evaluation properties
Experiment not trackingGoal event name mismatchVerify event name matches experiment config
Cohort stuck is_calculatingLarge datasetWait for calculation; check PostHog status
getAllFlags slowLocal cache unavailable or remote fallbackPass the secure flag key through personalApiKey and inspect cache readiness

Output

  • Feature flag evaluation (boolean and multivariate)
  • Server-side local evaluation for low-latency flag checks
  • A/B experiment setup with goal metric tracking
  • Cohort creation and management via API
  • Experiment results with statistical significance

Examples

For a checkout redesign, define an owned flag, choose a safe default, evaluate it once at the boundary, test every variant plus undefined, and document rollback and removal criteria. Return the rollout contract and the evidence needed before increasing exposure.

Resources

See official PostHog references for current authority and verification boundaries.

Next Steps

For common errors, see posthog-common-errors.

© 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-core-workflow-b of jeremylongshore/tons-of-skills-marketplace.

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

Open the folder on GitHubat commit cfae287

Compare with similar skills

Posthog Core Workflow B 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 Core Workflow B compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Posthog Core Workflow B this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.3kAutomated safety check: PassMIT
Analyticsericrisco/rsc-harness190—~2.8kAutomated safety check: PassMIT
Flags SDKvercel/vercel-plugin301—~6.9kAutomated safety check: NotesCustom licence
Experimentation Platform Orchestratorrampstackco/claude-skills945—~6.6kAutomated safety check: PassMIT
Adding Feature Flagsspencerpauly/awesome-cursor-skills844—~550Automated safety check: NotesCC0-1.0
Ab Testingcoreyhaines31/marketingskills54k3 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • Analytics

    ericrisco/rsc-harness

    A skill your agent uses when instrumenting product or web analytics — GA4/PostHog SDK wiring, event taxonomy, funnels, double-counted events, consent gating, PII scrubbing.

    190 GitHub stars~2.8k tokensUpdated today
    Marketing & SEOAuto-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
  • Experimentation Platform Orchestrator

    rampstackco/claude-skills

    A platform decision framework for experimentation. An agent skill from rampstackco/claude-skills.

    945 GitHub stars~6.6k tokensUpdated 4 days ago
    Marketing & SEOAuto-check passed
  • Adding Feature Flags

    spencerpauly/awesome-cursor-skills

    Add feature flags to an application for gradual rollouts, A/B testing, and kill switches using PostHog, LaunchDarkly, or a simple local implementation.

    844 GitHub stars~550 tokensUpdated 2 mo ago
    Marketing & SEOAuto-check: notes
  • Ab Testing

    coreyhaines31/marketingskills

    When the user wants to plan, design, or implement an A/B test or experiment, or build a growth experimentation program.

    54k GitHub starsUsed in 3 repos~3.1k tokens
    Marketing & SEOAuto-check passed
  • Analytics

    Nexus-JPF/note-companion

    When the user wants to set up, improve, or audit analytics tracking and measurement.

    870 GitHub starsUsed in 7 repos~2.2k tokens
    Marketing & SEOAuto-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 Core Workflow B

What does Posthog Core Workflow B do?

Implement a safe PostHog feature-flag and experiment lifecycle with defaults, exposure integrity, rollout ownership, and cleanup. Posthog Core Workflow B is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement a safe PostHog feature-flag and experiment lifecycle with defaults, exposure integrity, rollout ownership, and cleanup.

When should I use Posthog Core Workflow B?

Posthog Core Workflow B fits situations like: releasing behind flags; running controlled experiments; with PostHog feature flag; postHog experiment.

How do I install Posthog Core Workflow B in Claude Code?

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

How do I install Posthog Core Workflow B in Codex?

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

Can I use Posthog Core Workflow B 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-core-workflow-b -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-core-workflow-b, .gemini/skills/posthog-core-workflow-b, .github/skills/posthog-core-workflow-b and .opencode/skills/posthog-core-workflow-b in your project.

What does Posthog Core Workflow B need to run?

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

Does Posthog Core Workflow B access the network?

SKILL.md names 3 domains. In commands or code: us.posthog.com and us.i.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 Core Workflow B 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 Core Workflow B use?

Posthog Core Workflow B 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 Core Workflow B use?

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

What are the alternatives to Posthog Core Workflow B?

Skills that share tags, products or a category with Posthog Core Workflow B: Analytics (ericrisco/rsc-harness, 190 stars), Flags SDK (vercel/vercel-plugin, 301 stars), Experimentation Platform Orchestrator (rampstackco/claude-skills, 945 stars) and Adding Feature Flags (spencerpauly/awesome-cursor-skills, 844 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Posthog Core Workflow B?

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.