Agent skill

Posthog Observability

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

Observe a PostHog integration through application-side delivery metrics, ingestion warnings, billing volume, destination logs, and status evidence.

MITAuto-check passedDevOps & Cloud

Install Posthog Observability

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

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

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

At a glance

Observe a PostHog integration through application-side delivery metrics, ingestion warnings, billing volume, destination logs, and status evidence.

  • Works in 5 steps: Event Ingestion Health Check → Instrument Flag Evaluation Latency → Monitor Event Volume and Billing → …
  • Defining health signals
  • SKILL.md covers Overview, Prerequisites, Instructions and Error Handling, plus 3 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 Observability is an agent skill from jeremylongshore/tons-of-skills-marketplace. Observe a PostHog integration through application-side delivery metrics, ingestion warnings, billing volume, destination logs, and status evidence. Use when defining health signals or investigating silent analytics loss. Trigger with "monitor PostHog", "PostHog ingestion health", or "PostHog alerts".

Its SKILL.md is about 2.4k 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 Observability and Monitoring and alerting. It works with PostHog and Prometheus. 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

  • Defining health signals
  • Investigating silent analytics loss
  • With monitor PostHog
  • PostHog ingestion health

Example prompts

  • “monitor PostHog”
  • “PostHog ingestion health”
  • “PostHog alerts”
  • “/posthog-observability”

Requirements

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

Workflow steps

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

  1. Event Ingestion Health Check
  2. Instrument Flag Evaluation Latency
  3. Monitor Event Volume and Billing
  4. Prometheus Alert Rules
  5. Health Check Dashboard Queries

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

    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
    • status.posthog.com
    • prometheus.io

    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 Observability loads about 2.4k tokens when it runs, and up to ~2.6k if it reads all its reference files. Until then it costs about 81 tokens; SKILL.md has 291 words of instructions outside code blocks.

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

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

Download SKILL.mdSave it as .claude/skills/posthog-observability/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
posthog-observability
description
Observe a PostHog integration through application-side delivery metrics, ingestion warnings, billing volume, destination logs, and status evidence. Use when defining health signals or investigating silent analytics loss. Trigger with "monitor PostHog", "PostHog ingestion health", or "PostHog alerts".
allowed-tools
Read, Write, Edit
compatibility
Designed for Claude Code
argument-hint
[service] [signal]
version
1.14.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, posthog, monitoring, observability, dashboard

PostHog Observability

Overview

Observe four boundaries independently: application capture attempts and failures, SDK queue and flush behavior, PostHog ingestion warnings and accepted event volume, and feature-flag cache or remote-fallback behavior. Treat every Prometheus metric below as application-owned instrumentation, not as a metric exported by PostHog.

Prerequisites

  • PostHog project with personal API key (phx_...)
  • Application instrumented with PostHog SDK
  • Prometheus/Grafana or equivalent monitoring stack (optional)

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: Event Ingestion Health Check
bash
set -euo pipefail
# Check if events are flowing (last 24 hours)
curl "https://us.posthog.com/api/projects/$POSTHOG_PROJECT_ID/query/" \
  -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": {
      "kind": "HogQLQuery",
      "query": "SELECT toStartOfHour(timestamp) AS hour, count() AS events FROM events WHERE timestamp > now() - interval 24 hour GROUP BY hour ORDER BY hour"
    }
  }' | jq '.results | map({hour: .[0], events: .[1]}) | .[-3:]'
Step 2: Instrument Flag Evaluation Latency
typescript
// posthog-instrumented.ts
import { PostHog } from 'posthog-node';

const posthog = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
  host: 'https://us.i.posthog.com',
  personalApiKey: process.env.POSTHOG_FEATURE_FLAGS_SECURE_API_KEY,
});

// Wrap flag evaluation with timing
async function getFlag(flagKey: string, userId: string): Promise<any> {
  const start = performance.now();
  const value = await posthog.getFeatureFlag(flagKey, userId);
  const durationMs = performance.now() - start;

  // Emit metrics to your monitoring system
  emitHistogram('posthog_flag_eval_duration_ms', durationMs, { flag: flagKey });
  emitCounter('posthog_flag_evals_total', 1, { flag: flagKey, result: String(value) });

  // Alert on slow evaluations (likely means local eval not configured)
  if (durationMs > 200) {
    console.warn(`[PostHog] Slow flag eval: ${flagKey} took ${durationMs.toFixed(0)}ms — inspect secure-key cache and fallback behavior`);
  }

  return value;
}

// Example: emit to Prometheus via prom-client
import { Histogram, Counter, Gauge } from 'prom-client';

const flagDuration = new Histogram({
  name: 'posthog_flag_eval_duration_ms',
  help: 'PostHog feature flag evaluation duration',
  labelNames: ['flag'],
  buckets: [1, 5, 10, 50, 100, 200, 500, 1000],
});

const flagEvals = new Counter({
  name: 'posthog_flag_evals_total',
  help: 'Total PostHog feature flag evaluations',
  labelNames: ['flag', 'result'],
});

function emitHistogram(name: string, value: number, labels: Record<string, string>) {
  flagDuration.observe(labels, value);
}

function emitCounter(name: string, value: number, labels: Record<string, string>) {
  flagEvals.inc(labels, value);
}
Step 3: Monitor Event Volume and Billing
typescript
// Run on a cron (e.g., every 6 hours)
async function checkEventVolume() {
  const result = await fetch(
    `https://us.posthog.com/api/projects/${process.env.POSTHOG_PROJECT_ID}/query/`,
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${process.env.POSTHOG_PERSONAL_API_KEY}`,
      },
      body: JSON.stringify({
        query: {
          kind: 'HogQLQuery',
          query: `
            SELECT
              count() AS events_this_month,
              uniq(distinct_id) AS unique_users,
              count() / dateDiff('day', toStartOfMonth(now()), now()) AS daily_avg
            FROM events
            WHERE timestamp > toStartOfMonth(now())
          `,
        },
      }),
    }
  );

  const data = await result.json();
  const [eventsThisMonth, uniqueUsers, dailyAvg] = data.results[0];
  const projectedMonthly = dailyAvg * 30;
  const approvedMonthlyLimit = Number(process.env.POSTHOG_MONTHLY_EVENT_LIMIT);
  if (!Number.isFinite(approvedMonthlyLimit)) {
    throw new Error('Set POSTHOG_MONTHLY_EVENT_LIMIT from the live billing configuration');
  }

  const metrics = {
    events_this_month: eventsThisMonth,
    unique_users: uniqueUsers,
    daily_average: Math.round(dailyAvg),
    projected_monthly: Math.round(projectedMonthly),
    pct_of_approved_limit: Math.round((projectedMonthly / approvedMonthlyLimit) * 100),
  };

  // Emit gauge metrics
  const volumeGauge = new Gauge({
    name: 'posthog_events_month_total',
    help: 'PostHog events this month',
  });
  volumeGauge.set(eventsThisMonth);

  // Apply the organization's reviewed warning ratio to the live product limit.
  const warningRatio = Number(process.env.POSTHOG_USAGE_WARNING_RATIO ?? '0.8');
  if (projectedMonthly > approvedMonthlyLimit * warningRatio) {
    await sendAlert(`PostHog projected usage is ${Math.round(projectedMonthly / approvedMonthlyLimit * 100)}% of the reviewed limit`);
  }

  return metrics;
}
Step 4: Prometheus Alert Rules
yaml
# prometheus/posthog-alerts.yml
# These are application-emitted metrics. Rename them to match the target service.
groups:
  - name: posthog
    rules:
      - alert: PostHogCaptureDeliveryFailures
        expr: rate(posthog_capture_delivery_failures_total[5m]) > 0
        for: 15m
        labels:
          severity: warning
        annotations:
          summary: "The application is reporting PostHog delivery failures"

      - alert: PostHogFlagEvalSlow
        expr: increase(posthog_flag_eval_slo_breaches_total[5m]) > 0
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "Application-observed PostHog flag evaluation latency exceeded its reviewed threshold"

      - alert: PostHogUsageLimitWarning
        expr: posthog_usage_limit_ratio > posthog_usage_warning_ratio
        labels:
          severity: info
        annotations:
          summary: "Projected PostHog usage crossed the organization's reviewed warning ratio"

      - alert: PostHogCaptureErrors
        expr: rate(posthog_capture_errors_total[5m]) > 0
        for: 5m
        labels:
          severity: critical
        annotations:
          summary: "PostHog capture errors elevated — events may be lost"
Step 5: Health Check Dashboard Queries
typescript
// Dashboard panels to track PostHog health
const dashboardQueries = {
  // Events per hour (last 24h)
  eventRate: `
    SELECT toStartOfHour(timestamp) AS hour, count() AS events
    FROM events WHERE timestamp > now() - interval 24 hour
    GROUP BY hour ORDER BY hour
  `,

  // Events by type (last 7 days)
  eventsByType: `
    SELECT event, count() AS total
    FROM events WHERE timestamp > now() - interval 7 day
    GROUP BY event ORDER BY total DESC LIMIT 15
  `,

  // Unique users per day (last 30 days)
  dailyActiveUsers: `
    SELECT toDate(timestamp) AS day, uniq(distinct_id) AS users
    FROM events WHERE timestamp > now() - interval 30 day
    GROUP BY day ORDER BY day
  `,

  // Event ingestion latency estimate
  ingestionFreshness: `
    SELECT max(timestamp) AS latest_event,
           dateDiff('second', max(timestamp), now()) AS seconds_behind
    FROM events
  `,
};

Error Handling

IssueCauseSolution
Zero events for 1h+SDK not initialized or API downCheck PostHog status, verify SDK init
Flag evaluation exceeds the service SLOCold cache, fallback, or network pathInspect secure-key configuration, cache state, and fallback counts
Event volume spikeNew feature autocapturingReview autocapture config, add filters
Rate limit 429Too many API queriesCache results, reduce poll frequency

Output

  • Flag evaluation latency instrumentation
  • Event volume and billing monitoring
  • Prometheus rules over application-emitted integration metrics
  • HogQL dashboard queries for key metrics
  • Automated alerts for ingestion drops and billing limits

Examples

For a server event pipeline, instrument queue depth, flush failures, request latency, and fallback counts in the application; correlate them with ingestion warnings and billing volume. Do not claim PostHog exposes Prometheus metrics unless the target deployment proves that surface.

Resources

See official PostHog references for current authority and verification boundaries.

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

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

Open the folder on GitHubat commit cfae287

Compare with similar skills

Posthog Observability 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 Observability compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Posthog Observability this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.4kAutomated safety check: PassMIT
Happy Infra Metrics and Grafanaslopus/happy24k—~2kAutomated safety check: NotesMIT
WizTelemetry Platform Servicekubesphere/kubesphere17k—~1.8kAutomated safety check: PassCustom licence
Redis Observabilityredis/agent-skills1662 repos~911Automated safety check: PassMIT
Exploring Apm TracesPostHog/posthog40k—~3.5kAutomated safety check: PassCustom licence
Developing Funboost Mixinydf0509/funboost895—~2.1kAutomated safety check: PassNone

Similar skills

  • Queries live Prometheus metrics and manages Grafana dashboards as code for Happy's infrastructure, using the grafanactl CLI and the Grafana datasource proxy API.

    24k GitHub stars~2k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • WizTelemetry Platform Service

    kubesphere/kubesphere

    Installs and configures the WizTelemetry Platform Service extension for KubeSphere, the shared API server behind its observability extensions.

    17k GitHub stars~1.8k tokensUpdated 2 mo ago
    DevOps & CloudAuto-check passed
  • Redis Observability

    redis/agent-skills

    Official

    Redis observability guidance — which metrics to monitor (memory, connections, hit ratio, ops/sec, rejected connections), which built-in commands to reach for during incident triage (SLOWLOG, INFO…

    166 GitHub starsUsed in 2 repos~911 tokens
    DevOps & CloudAuto-check passed
  • Exploring Apm Traces

    PostHog/posthog

    Official

    Investigates distributed application performance using PostHog APM (OpenTelemetry span) data via MCP.

    40k GitHub stars~3.5k tokensUpdated today
    DevOps & CloudAuto-check passed
  • 当需要为 funboost 创建 Consumer 或 Publisher 的 Mixin 扩展类时使用。触发场景:添加监控、熔断、限流、链路追踪等横切关注点,编写自定义前置/后置处理钩子。关键词:mixin, consumeroverridecls, publisheroverridecls, ConsumerMixin, 自定义消费者, hook, 拦截器, 熔断器, 监控…

    895 GitHub stars~2.1k tokensUpdated 2 mo ago
    DevOps & CloudAuto-check passed
  • Prometheus System Health Check

    prometheus/prometheus-mcp

    Builds a picture of whether Prometheus itself is healthy and successfully monitoring its targets, covering readiness, firing alerts, target health and TSDB load.

    121 GitHub stars~584 tokensUpdated yesterday
    DevOps & CloudAuto-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

Categories

Questions about Posthog Observability

What does Posthog Observability do?

Observe a PostHog integration through application-side delivery metrics, ingestion warnings, billing volume, destination logs, and status evidence. Posthog Observability is an agent skill from jeremylongshore/tons-of-skills-marketplace. Observe a PostHog integration through application-side delivery metrics, ingestion warnings, billing volume, destination logs, and status evidence.

When should I use Posthog Observability?

Posthog Observability fits situations like: defining health signals; investigating silent analytics loss; with monitor PostHog; postHog ingestion health.

How do I install Posthog Observability in Claude Code?

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

How do I install Posthog Observability in Codex?

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

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

What does Posthog Observability need to run?

Going by SKILL.md and its folder, Posthog Observability 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 POSTHOG_PERSONAL_API_KEY; A credential in NEXT_PUBLIC_POSTHOG_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit. Compatibility (from SKILL.md): Designed for Claude Code.

Does Posthog Observability access the network?

SKILL.md names 5 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, status.posthog.com and prometheus.io. This is read from the text; nothing was executed.

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

Posthog Observability 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 Observability use?

About 2.4k tokens (SKILL.md is roughly 9.5k 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 Observability?

Skills that share tags, products or a category with Posthog Observability: Happy Infra Metrics and Grafana (slopus/happy, 24k stars), WizTelemetry Platform Service (kubesphere/kubesphere, 17k stars), Redis Observability (redis/agent-skills, 166 stars) and Exploring Apm Traces (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 Observability?

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.