Creating Box Plot Insights

作者 PostHog469d1773e9cb無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Creates product analytics or SQL-backed box plot insights in PostHog. Use when a user asks to create, build, or save a box plot, visualize a numeric distribution, compare quartiles or medians across dates or groups, or turn SQL results into a box plot. Chooses between a standard Trends box plot and a SQL insight, validates the distribution data, saves the insight, and verifies it.

僅含說明Data & Analytics
AI 產生的概覽

在 PostHog 中依據產品分析資料或經驗證的 HogQL 查詢建立並儲存盒鬚圖洞察。

功能
引導代理在 PostHog 中建構盒鬚圖洞察,並在標準 Trends 盒鬚圖與以 SQL 為基礎的盒鬚圖之間做選擇。它規定了所需的數值屬性、六項彙總統計量(最小值、第 25 百分位數、中位數、平均值、第 75 百分位數、最大值),以及排序與資料列唯一性等驗證規則。接著儲存該洞察並透過讀取與重新執行加以驗證,回報洞察連結與分組選擇。
適用情境
適用於使用者要求建立、建構或儲存盒鬚圖、視覺化數值分布、依日期或分組比較四分位數或中位數,或將 SQL 結果轉為盒鬚圖的情況。適合需要分布資料而非預先彙總平均值的 PostHog 產品分析工作。
執行需求
需要 PostHog 存取權限,以及 posthog:query-trends、posthog:execute-sql、posthog:insight-create、posthog:insight-get 與 posthog:insight-query 工具。撰寫 HogQL 時需參考查詢 PostHog 資料的相關技能。不包含指令碼,另附一份 SQL 範例參考檔案。

Creating box plot insights

Box plots need distribution data, not an already-aggregated average or total. Choose the simplest query type that can express the user's question.

Choose the query type

Use a standard product analytics box plot when all of these are true:

  • The source is an event, action, or warehouse table supported by Trends.
  • One numeric property contains the values to distribute.
  • The user wants the distribution over a normal time interval.

Use a SQL box plot when the user needs custom grouping, joins, derived values, or bespoke SQL. Read querying-posthog-data before writing HogQL, then use references/sql-examples.md [blocked] as a starting point.

Do not use SQL only to reproduce a standard Trends query.

Standard product analytics box plot

  1. Identify the event or action and its numeric property. Confirm the property is numeric before saving.
  2. Build an InsightVizNode whose source is a TrendsQuery:
    • Set the series event or action.
    • Set math_property to the numeric property.
    • Set trendsFilter.display to BoxPlot.
    • Choose the date range and interval that match the question.
  3. Run the query with posthog:query-trends.
  4. If it returns distribution rows, save it with posthog:insight-create.
  5. Read it back with posthog:insight-get and confirm the property, interval, and display.

A box plot without a numeric math_property is invalid. Do not substitute event counts unless counts are the values the user wants to distribute.

SQL box plot

The SQL must return one pre-aggregated row for each X-axis and series pair. Calculate the summary in the database. Never calculate percentiles from the limited result rows in the client.

Required numeric roles:

  • minimum
  • 25th percentile
  • median
  • mean
  • 75th percentile
  • maximum

The easiest result shape uses these aliases:

text
x, series, min, p25, median, mean, p75, max

x and series are optional:

  • Set xAxisColumn to null for one overall distribution or one box per series.
  • Set seriesColumn to null for one series.

Validate the HogQL with posthog:execute-sql before saving. Check that:

  • Every required statistic is numeric.
  • min <= p25 <= median <= p75 <= max for every row.
  • The mean is between the minimum and maximum.
  • Each X-axis and series pair appears once.
  • There are at most 200 series and 10,000 X-axis by series cells.

Then save this shape with posthog:insight-create:

json
{  "query": {    "kind": "DataVisualizationNode",    "source": {      "kind": "HogQLQuery",      "query": "<validated HogQL>"    },    "display": "BoxPlot",    "chartSettings": {      "boxPlot": {        "xAxisColumn": "x",        "seriesColumn": "series",        "minColumn": "min",        "p25Column": "p25",        "medianColumn": "median",        "meanColumn": "mean",        "p75Column": "p75",        "maxColumn": "max",        "excludeOutliers": true      }    }  }}

Use the actual aliases when the query uses different names. Do not map the six statistics as six Y-axis series.

Verify the saved insight

  1. Read the saved insight with posthog:insight-get.
  2. Run it with posthog:insight-query.
  3. Confirm the result still has the expected columns and one row per box.
  4. Report the insight link, the numeric value being distributed, and the grouping choices.

If an individual row has a missing or invalid summary, PostHog omits that box while keeping valid boxes visible. Fix the SQL when omitted boxes are not expected.

Related skills

  • querying-posthog-data - required before authoring or changing the HogQL for a SQL box plot.
  • formatting-insight-axes - use when the value axis needs currency, duration, percentage, or other formatting.
  • building-a-dashboard - use when the box plot should be placed with other insights on a dashboard.

來源與署名

來源:PostHog/ai-plugin位於skills/creating-box-plot-insights提交469d177

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架

更多來自 PostHog/ai-plugin 的技能

Writing Simplified Technical English

PostHog

套用 ASD-STE100 簡化技術英語規則,讓代理撰寫的文字語意明確、方便執行。

Writing & Content2026年10月8日

Working With Task Comments

PostHog

透過 PostHog MCP exec 調度器讀取並解讀 PostHog 任務、成品和畫布上的留言。

Productivity & Workflow2026年10月8日

Working With Skills

PostHog

指導代理使用 PostHog 的 skill-* MCP 工具來探索、讀取、建立、更新與重構技能。

AI & Agents2026年10月8日

Working With Scouts

PostHog

說明如何把監看工作委派給 PostHog Signals 偵察代理、處理其回報,並長期調校整個代理團隊的操作手冊。

AI & Agents2026年10月8日

Validating And Publishing Canvases

PostHog

Validate and publish a canvas source project safely: the source-project shape, declared capabilities, reading the current version pointer, iterating on validation diagnostics, guarded publishing with expected_current_version_id, staging a draft build and promoting it, waiting out the queued build, and recovering from a 409 version_conflict or a 429 capacity limit without overwriting concurrent work. Use whenever a canvas edit is ready to save, a draft build is wanted, a canvas publish or build returns diagnostics or a conflict, or a task needs to understand canvas version history.

待分類2026年10月8日

Understanding Billing Usage

PostHog

Explains PostHog billing usage and spend from the customer's visible Billing MCP tools. Use when the user asks why usage or spend is high, which product or project is driving usage, what a usage type means, how to reduce usage, what changed over time, why they got a usage change alert, or whether a spike/drop alert was real or noisy. Also use before product-specific analytics skills when the user names a billable PostHog product metric such as events, recordings, feature flag requests, exceptions, survey responses, synced rows, logs, AI events, AI credits, or Inbox credits. Starts from Billing usage/spend tools, then routes to customer-visible product MCP surfaces for deeper investigation.

待分類2026年10月8日