Manage PostHog feature flags, cohorts, dashboards, and insights via the `piglet` CLI. Use when the user needs to list, create, update, or delete PostHog resources, check flag status, manage rollouts, or export configuration.
86
82%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
Use the piglet command-line interface to manage PostHog resources. This skill handles feature flags, cohorts, dashboards, insights, and projects across US Cloud, EU Cloud, or self-hosted PostHog instances.
Install piglet:
uv tool install cased-piglet
piglet --versionConfigure authentication (one of):
# Environment variables (recommended)
export POSTHOG_API_KEY="phx_your_key"
export POSTHOG_PROJECT_ID="12345"
# Or config file: ~/.piglet/config.toml
# api_key = "phx_your_key"
# project_id = 12345
# host = "us"Verify setup:
piglet projects listConfirm context
piglet projects listFeature flags
# List all flags
piglet flags list
piglet flags list --active # only active
piglet flags list --json # for parsing
# Get specific flag (by ID or key)
piglet flags get my-feature-flag
# Create a flag
piglet flags create --key new-flag --name "New Feature" --rollout-percentage 50
# Update rollout or status
piglet flags update 123 --rollout-percentage 100
piglet flags update 123 --active
piglet flags update 123 --inactive
# Delete (with confirmation)
piglet flags delete 123
piglet flags delete 123 --yes # skip confirmationCohorts
piglet cohorts list
piglet cohorts list --static # only static cohorts
piglet cohorts get 456
piglet cohorts create --name "Power Users"
piglet cohorts create --name "Beta Testers" --static
piglet cohorts update 456 --name "New Name"
piglet cohorts delete 456Dashboards
piglet dashboards list
piglet dashboards list --pinned
piglet dashboards get 789
piglet dashboards create --name "Engineering Metrics"
piglet dashboards update 789 --pinned
piglet dashboards delete 789Insights
piglet insights list
piglet insights list --saved
piglet insights get abc123 # by short_id
piglet insights create --name "Daily Active Users"
piglet insights update 101 --name "Weekly Active Users"
piglet insights delete 101Projects
piglet projects list # list all accessible projects
piglet projects get 12345 # get project detailsPiglet supports three output formats:
# Rich table (default) - human readable
piglet flags list
# JSON - for programmatic use
piglet flags list --json
# Plain tab-separated - for scripting
piglet flags list --plain
piglet flags list --plain | cut -f2 # extract just flag keys# US Cloud (default)
piglet flags list
# EU Cloud
piglet --host eu flags list
# Self-hosted
piglet --host https://posthog.mycompany.com flags listpiglet flags get my-feature-flag# Start at 10%
piglet flags create --key gradual-release --name "Gradual Release" --rollout-percentage 10
# Later, increase to 50%
piglet flags update <flag_id> --rollout-percentage 50
# Full rollout
piglet flags update <flag_id> --rollout-percentage 100piglet flags list --json > flags-backup.json
piglet cohorts list --json > cohorts-backup.json# Disable a flag immediately
piglet flags update 123 --inactive
# Re-enable
piglet flags update 123 --active# Find all flags with "beta" in the key
piglet flags list --plain | grep betaPOSTHOG_API_KEY env var or use --api-keyPOSTHOG_PROJECT_ID env var or use --project-idpiglet projects list, then use --project-id--host eu for EU Cloud data--json output when parsing results programmatically--plain output when piping to other CLI tools--yes flag in scripts to skip confirmation promptsa026516
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.