К основному содержанию
скилл CX Codex

formatting-insight-axes — скилл для Claude Code: формат оси Y

Подбирает правильную единицу оси Y при создании инсайта в PostHog: секунды, миллисекунды, проценты, валюта. Избавляет от формул ради пересчёта единиц.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add PostHog/skills --skill formatting-insight-axes -a claude-code
Открыть на GitHub

Что делает formatting-insight-axes

Скилл подсказывает агенту, какой формат оси Y поставить при создании или обновлении инсайта через posthog:insight-create и posthog:insight-update. Работает с двумя видами инсайтов: в TrendsQuery формат задаётся в trendsFilter.aggregationAxisFormat, в SQL-инсайтах (DataVisualizationNode) — по колонкам через chartSettings.yAxis[].settings.formatting.

Главная задача — отучить агента от ручного пересчёта. Вместо formula: "A / 60" с постфиксом «mins» скилл ставит duration, и PostHog сам подбирает удобную единицу под каждое значение: 90s показывается как 1m 30s, а 5400s — как 1h 30m. Есть форматы numeric, duration, duration_ms, percentage, percentage_scaled, currency и short. Рядом — aggregationAxisPrefix, aggregationAxisPostfix и decimalPlaces.

С валютой нужна аккуратность. currency рендерит в базовой валюте проекта, поэтому для значений, жёстко привязанных к доллару, скилл советует поставить aggregationAxisPrefix: "$" и decimalPlaces: 2 — иначе на проекте с базой в евро доллары подпишутся знаком €. Постфикс "%" не ставьте: процентные форматы добавляют знак сами, и получится 50%%. В SQL-инсайтах style бывает только none, number, short или percent — длительность и валюту там выражают через prefix/suffix или прямо в SQL.

Какие задачи решает

  • показать длительность сессии в удобных единицах без пересчёта в формуле
  • вывести latency в миллисекундах на графике TrendsQuery
  • подписать ось в валюте проекта или закрепить конкретный символ
  • отобразить конверсию из отношения 0–1 в процентах
  • сжать крупные счётчики до вида 1.2K и 3.4M

Примеры запросов агенту

  • Построй инсайт по $pageleave со средней $session_duration и поставь формат оси duration
  • Сделай график конверсии checkout_completed к checkout_started с формулой A / B и форматом percentage_scaled
  • В SQL-инсайте по conversion_rate задай форматирование колонки percent с одним знаком после запятой

Как установить formatting-insight-axes

1Через Skills CLI (Vercel)

npx skills add PostHog/skills --skill formatting-insight-axes -a claude-code

2Вручную: положить файлы

~/.claude/skills/formatting-insight-axes/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/formatting-insight-axes/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора21

exploring-live-traffic Скилл учит агента читать вкладку Live в PostHog Web analytics: кто на сайте прямо сейчас, какие боты стучатся и куда идут люди. CX Codex +1 378установок finding-replay-for-issue Находит среди сессий, привязанных к ошибке в PostHog, ту запись, по которой видно, что пользователь делал до сбоя. CX Codex +1 375установок suggesting-data-imports Подсказывает, каких данных не хватает в PostHog, и ведёт к подключению источника в дата-вейрхаусе. Пригодится, когда запрос падает из-за отсутствующей таблицы. CX Codex +1 372установок inbox-exploration Скилл для работы с PostHog Inbox: показывает отчёты, помогает разобрать их и превратить в задачу или PR. CX Codex +1 370установок authoring-log-alerts Помогает настроить алерты по логам в проекте PostHog: выбирает сервисы, считает базовую линию и подбирает порог, чтобы алерт срабатывал 0–3 раза в неделю. CX Codex +1 356установок triaging-error-issues Собирает короткий список ошибок PostHog, на которые стоит смотреть: новые, всплески и те, что задели много пользователей. Пригодится на утреннем или дежурном разборе. CX Codex +1 329установок signals-scout-general Скилл для PostHog: ищет корреляции между продуктами и заглядывает туда, куда не смотрят узкие скауты. Пишет отчёт в инбокс. CX Codex +1 314установок designing-email-templates Скилл создаёт и редактирует шаблоны писем для кампаний и рабочих процессов PostHog через MCP. Пригодится, когда письмо нужно собрать из редактируемых блоков и персонализировать с помощью Liquid. CX Codex +1 301установок

Похожие

revenuecat-charts RevenueCat Скилл учит агента запрашивать графики RevenueCat: сначала схему опций, потом данные, с разбором метрик подписок. CX Codex +1 757установок posthog-analytics alinaqi Скилл для внедрения продуктовой аналитики PostHog: события, идентификация пользователей, фича-флаги и дашборды. Пригодится, когда нужно добавить трекинг в проект. CX Codex +1 809установок adding-analytics spencerpauly Помогает ассистенту внедрить PostHog в веб-приложение: от настройки провайдера до трекинга событий, веб-аналитики и флагов фич. CX Codex +1 371установок chdb-sql chdb-io Скилл учит агента писать аналитический SQL по parquet, CSV, S3 и удалённым базам через chDB — это ClickHouse, встроенный в процесс Python, сервер поднимать не нужно. CX Codex +1 8 900установок data-analyst cline Скилл превращает агента в аналитика: уточняет вопрос, пишет ограниченный SQL к ClickHouse и объясняет, что стоит за цифрой. CX Codex +1 2 200установок using-dbt-for-analytics-engineering dbt-labs Скилл ведёт агента через сборку dbt-моделей, SQL-трансформации на ref() и source(), тесты и проверку результатов через dbt show. CX Codex +1 1 200установок

Рядом в теме «Данные и базы»

Все скиллы по теме «Данные и базы» →

Вопросы о formatting-insight-axes

Как установить formatting-insight-axes в Claude?

Выполните npx skills add PostHog/skills --skill formatting-insight-axes -a claude-code. Скилл встанет в ~/.claude/skills/formatting-insight-axes/SKILL.md.

Что делает formatting-insight-axes?

Подбирает формат оси Y для инсайтов PostHog: duration, duration_ms, percentage, percentage_scaled, currency, short. Тем самым убирает формулы, которые добавляли только ради пересчёта единиц.

Чем currency отличается от aggregationAxisPrefix?

currency рендерит в базовой валюте проекта, а aggregationAxisPrefix прибивает символ к данным независимо от настроек проекта. Для значений в долларах на проекте с другой базовой валютой нужен второй вариант.

Исходный текст

SKILL.md · MIT
---
name: formatting-insight-axes
description: >
  Pick the right y-axis unit when creating or updating an insight via
  `posthog:insight-create` or `posthog:insight-update` — both TrendsQuery
  (`trendsFilter.aggregationAxisFormat`) and SQL insights
  (`DataVisualizationNode`, `chartSettings.yAxis[].settings.formatting`).
  Use when the agent is about to add a `formula` purely to convert units
  (e.g. dividing seconds by 60 to display minutes), when a `math_property`
  or SQL column is a duration, currency, ratio, or large count, or whenever
  the user mentions "format the y-axis", "duration", "seconds", "minutes",
  "hours", "milliseconds", "ms", "percentage", "%%", "currency", "decimals",
  "axis label", or "axis unit" in the context of a graph insight.
---

# Formatting insight axes

PostHog renders insights with a built-in axis formatter. Use it instead of
contorting the query or a literal prefix/postfix to fake units.

The two insight kinds configure it in different places:

- **TrendsQuery** — `trendsFilter.aggregationAxisFormat` (this page, below)
- **SQL insights** (`DataVisualizationNode`) — per-column
  `settings.formatting` (see [SQL insights](#sql-insights-datavisualizationnode))

## 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:

| Value               | Use when the series is...                | Renders as                  |
| ------------------- | ---------------------------------------- | --------------------------- |
| `numeric` (default) | a plain count                            | `1,234`                     |
| `duration`          | **seconds** (any scale)                  | `45s`, `2m 12s`, `1h 4m`    |
| `duration_ms`       | **milliseconds**                         | `850ms`, `1.5s`, `1m 4s`    |
| `percentage`        | already 0-100                            | `47.3%`                     |
| `percentage_scaled` | a ratio 0-1                              | `47.3%`                     |
| `currency`          | money in the **project's base currency** | `$1,234.56` (or local code) |
| `short`             | large counts you want compacted          | `1.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

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

### Average session length — duration in seconds

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

### Revenue — currency in the project's base currency

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

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

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

### Conversion rate — percentage from a 0-1 formula

```json
{
  "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
  }
}
```

## SQL insights (DataVisualizationNode)

SQL insights have no `trendsFilter`.
Formatting is per column, on `chartSettings.yAxis[].settings.formatting` for a chart and top-level `tableSettings.columns[].settings.formatting` for a table.

```json
{
  "kind": "DataVisualizationNode",
  "source": { "kind": "HogQLQuery", "query": "SELECT week, conversion_rate FROM ..." },
  "display": "ActionsLineGraph",
  "chartSettings": {
    "xAxis": { "column": "week" },
    "yAxis": [
      {
        "column": "conversion_rate",
        "settings": { "formatting": { "style": "percent", "decimalPlaces": 1 } }
      }
    ]
  }
}
```

`style` is `none`, `number`, `short`, or `percent` — no `duration` or `currency`.
Express those with `prefix` / `suffix`, or in the SQL itself.

`percent` both appends the `%` sign and multiplies the value by 100 (like the trends `percentage_scaled` format; there is no unscaled variant).
So feed it a 0-1 ratio and leave `suffix` unset — pick one shape, never a mix:

| SQL returns                       | `formatting`                                             | Renders |
| --------------------------------- | -------------------------------------------------------- | ------- |
| a 0-1 ratio (`a / b`)             | `{"style": "percent", "decimalPlaces": 1}`               | `47.3%` |
| 0-100 (`round(100.0 * a / b, 1)`) | `{"style": "number", "suffix": "%", "decimalPlaces": 1}` | `47.3%` |

A mix renders broken: `style: "percent"` plus a `"%"` suffix gives `47.3%%`, and `percent` on an already-scaled 0-100 column gives `4730%`.
Prefer the ratio form — it keeps the `100.0 *` out of the query, so the stored column stays a plain ratio for anything else that reads it.

## Updating an existing insight

If an insight you are already editing uses one of these anti-patterns — a
trends `formula`/`postfix` pair, or a SQL column with both `style: "percent"`
and a `"%"` suffix — fix it in the same `posthog:insight-update` call: drop the
divide-by-N or `100.0 *` and the literal `%`, and let the format own the unit.
Values stay the same, only labels change. Do not scan unrelated insights — fix
only the ones you are already touching.

© PostHog · MIT · PostHog/skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой