New to Claude Skills? Learn how to install them →

posthog on GitHub

Formatting Insight Axes

Free

Easily format y-axis units for PostHog insights.

by posthog37.6k stars on posthog/posthog
1 views
Updated Aug 11, 2026
Get this skill

Free · Opens the source repo

What Formatting Insight Axes does

The Formatting Insight Axes skill streamlines the process of setting y-axis units in TrendsQuery insights within PostHog. This skill is particularly useful when creating or updating insights, allowing developers to specify the appropriate format for the y-axis without resorting to cumbersome formulas. By using this skill, you can ensure that the data is represented in a user-friendly manner, enhancing the readability and interpretability of your insights.

Instead of manually manipulating the data with formulas to convert units (like converting seconds to minutes), this skill leverages PostHog's built-in axis formatter. It automatically selects the most appropriate unit based on the underlying data values, which means you can avoid common pitfalls associated with hardcoding units. This not only keeps your data numerically correct but also simplifies the process of updating existing insights.

The skill supports various formats such as duration, currency, and percentages, allowing for flexible representation of data. For example, if you are tracking session lengths in seconds, the skill can automatically format these values into a more digestible format like minutes and seconds. This is particularly beneficial in one-shot contexts where user input is not available, as it defaults to the most logical format.

Overall, this skill is designed for developers and data analysts who work with PostHog and need to present data insights clearly and effectively. By utilizing this skill, you can enhance the quality of your visualizations and make your insights more accessible to stakeholders.

When to use it

Use this skill when creating or updating TrendsQuery insights in PostHog, especially when y-axis formatting is required.

When not to use it

Avoid this skill if you are not working with TrendsQuery insights or if your data does not require specific y-axis formatting.

What you can build with it

Visualizing Session Durations

When analyzing session lengths, use this skill to automatically format durations from seconds to a more readable format like minutes and seconds.

Displaying Revenue Data

For revenue insights, apply the currency format to ensure that monetary values are displayed correctly in your project's base currency.

Tracking Performance Metrics

When monitoring performance metrics such as latency, utilize the duration_ms format to present data in a clear and concise manner.

How to install Formatting Insight Axes

View source

1. Install with the skills CLI

npx skills add posthog/posthog/formatting-insight-axes --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by posthog

Formatting insight axes

PostHog renders TrendsQuery insights with a built-in axis formatter. Use it instead of contorting formula or aggregationAxisPostfix to fake units.

The anti-pattern

If you are reaching for any of these, stop and pick a format below first:

  • formula: "A / 60" with aggregationAxisPostfix: " mins" — manual seconds -> minutes
  • formula: "A / 1000" with aggregationAxisPostfix: " s" — manual ms -> seconds
  • formula: "A * 100" with aggregationAxisPostfix: "%" — manual ratio -> percent
  • aggregationAxisPostfix: "ms" / "s" / "min" / "hr" on raw values

These freeze the unit at one scale. The built-in formatter picks a friendly unit per value (1.5s, 2m 12s, 1h 4m) and keeps the underlying series numerically correct for further math, breakdowns, and alerts.

Available formats

Set trendsFilter.aggregationAxisFormat on the TrendsQuery:

ValueUse when the series is...Renders as
numeric (default)a plain count1,234
durationseconds (any scale)45s, 2m 12s, 1h 4m
duration_msmilliseconds850ms, 1.5s, 1m 4s
percentagealready 0-10047.3%
percentage_scaleda ratio 0-147.3%
currencymoney in the project's base currency$1,234.56 (or local code)
shortlarge counts you want compacted1.2K, 3.4M

Companion fields on trendsFilter:

  • aggregationAxisPrefix — literal prefix (e.g. "$") when you need a symbol pinned to a specific currency or unit, regardless of project settings
  • aggregationAxisPostfix — literal suffix; reserve for genuine units the format can't express (e.g. " req", " events"), never for "mins" / "s" / "%" — the percentage formats already append the % sign, so a "%" postfix renders 50%%
  • decimalPlaces — cap decimals (1 or 2 is usually right for currency / ratios)

Currency — pick format or prefix carefully

aggregationAxisFormat: "currency" renders with the project's base currency (set in project settings, defaults to USD). Use it when the underlying values are in that same currency — e.g. revenue events that PostHog auto-converts to the project's base currency.

If the values are pinned to a specific currency regardless of project (e.g. $ai_total_cost_usd is always USD, even on a EUR-base project), use aggregationAxisPrefix: "$" + decimalPlaces: 2 so the symbol matches the data. Using format: "currency" here would render USD values with on a EUR project.

When the series is in seconds

If the series is in seconds (latency, session length, time-to-first-event, processing time, page load, etc.), silently default to aggregationAxisFormat: "duration". Do not stop to ask — the formatter is non-destructive (the underlying values stay in seconds either way, only the labels change), so picking it is always at least as good as raw seconds.

Only confirm with the user when they have explicitly named a fixed unit they want pinned ("show this in minutes", "graph the average in hours"):

"I can pin the y-axis to minutes by dividing the series by 60, or use PostHog's duration formatter which auto-picks seconds / minutes / hours per value — 90s renders as 1m 30s and 5400s as 1h 30m. Which would you prefer?"

In one-shot MCP contexts where no user is in the loop, just pick duration and move on.

Examples

Latency — duration in milliseconds

{
  "kind": "TrendsQuery",
  "series": [
    {
      "kind": "EventsNode",
      "event": "$pageview",
      "math": "p95",
      "math_property": "$performance_page_loaded"
    }
  ],
  "trendsFilter": {
    "aggregationAxisFormat": "duration_ms"
  }
}

Average session length — duration in seconds

{
  "kind": "TrendsQuery",
  "series": [
    {
      "kind": "EventsNode",
      "event": "$pageleave",
      "math": "avg",
      "math_property": "$session_duration"
    }
  ],
  "trendsFilter": {
    "aggregationAxisFormat": "duration"
  }
}

Revenue — currency in the project's base currency

{
  "trendsFilter": {
    "aggregationAxisFormat": "currency",
    "decimalPlaces": 2
  }
}

Fixed-currency value (e.g. LLM cost in USD) — pin the symbol

{
  "trendsFilter": {
    "aggregationAxisPrefix": "$",
    "decimalPlaces": 2
  }
}

Conversion rate — percentage from a 0-1 formula

{
  "kind": "TrendsQuery",
  "series": [
    {
      "kind": "EventsNode",
      "event": "checkout_completed",
      "math": "dau"
    },
    {
      "kind": "EventsNode",
      "event": "checkout_started",
      "math": "dau"
    }
  ],
  "trendsFilter": {
    "formula": "A / B",
    "aggregationAxisFormat": "percentage_scaled",
    "decimalPlaces": 1
  }
}

Updating an existing insight

If you are updating an insight and notice it already uses the formula/postfix anti-pattern, fix it in the same posthog:insight-update call — drop the divide-by-N, drop the aggregationAxisPostfix, and set the matching aggregationAxisFormat. The series values stay the same, only the labels change. Do not go scanning unrelated insights for this pattern — fix only the ones you are already touching.

Frequently asked questions about Formatting Insight Axes

Similar skills