Creating box plot insights
SkillDatabases & dataThis skill lets an AI agent create and save box plot insights in PostHog, showing how a numeric value is distributed. It picks between a standard Trends box plot and a SQL-backed one depending on the question, checks that the data is a real numeric distribution, saves the insight, and reads it back to confirm it works.
Use Creating box plot insights in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Creating box plot insights and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Creating box plot insights skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; ahel provides instructions and does not run this skill.
No other account needed.
Have access to a PostHog project and the PostHog tools available to your agent.
What your AI can do with it
- Build a standard Trends box plot from an event or action numeric property
- Build a SQL box plot for custom grouping, joins, or derived values
- Validate that SQL returns min, p25, median, mean, p75, and max per row
- Save the insight with posthog:insight-create
- Read the insight back with posthog:insight-get to confirm it works
Getting started
- Have access to a PostHog project and the PostHog tools available to your agent.
- Decide whether the question fits a standard Trends box plot or needs custom SQL.
- For a standard box plot, identify the event or action and confirm its numeric property.
- For SQL, write HogQL that returns one pre-aggregated row per X-axis and series pair with min, p25, median, mean, p75, and max.
- Run the query, save the insight, then read it back to confirm the property, interval, and display.
What this skill tells your AI
The instructions your AI receives, as published by posthog/posthog in products/product_analytics/skills/creating-box-plot-insights/SKILL.md and read by ahel’s review.
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 as a starting point.
Do not use SQL only to reproduce a standard Trends query.
Standard product analytics box plot
- Identify the event or action and its numeric property. Confirm the property is numeric before saving.
- Build an
InsightVizNodewhose source is aTrendsQuery:- Set the series event or action.
- Set
math_propertyto the numeric property. - Set
trendsFilter.displaytoBoxPlot. - Choose the date range and interval that match the question.
- Run the query with
posthog:query-trends. - If it returns distribution rows, save it with
posthog:insight-create. - Read it back with
posthog:insight-getand 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:
x, series, min, p25, median, mean, p75, max
x and series are optional:
- Set
xAxisColumntonullfor one overall distribution or one box per series. - Set
seriesColumntonullfor one series.
Validate the HogQL with posthog:execute-sql before saving. Check that:
- Every required statistic is numeric.
min <= p25 <= median <= p75 <= maxfor 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:
{
"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
- Read the saved insight with
posthog:insight-get. - Run it with
posthog:insight-query. - Confirm the result still has the expected columns and one row per box.
- 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.
Signals
- GitHub stars
- 40k
- Forks
- 3k
- Last commit
- Sep 2026
Others that do the same job
Questions
- When should I use a SQL box plot instead of a standard Trends box plot?
- Use SQL when you need custom grouping, joins, derived values, or bespoke SQL. Do not use SQL only to reproduce a standard Trends query.
- What statistics must a SQL box plot return?
- One pre-aggregated row per X-axis and series pair with minimum, 25th percentile, median, mean, 75th percentile, and maximum. The easiest aliases are x, series, min, p25, median, mean, p75, max.
Advanced
- Item type
- skill
- Key
creating-box-plot-insights- Source
- github.com/posthog/posthog
More in Databases & data
Skill · supabase
More in Databases & dataconnect
Skill · composiohq
More in Databases & dataanalytics
Skill · coreyhaines31
More in Databases & dataazure-kusto
Skill · microsoft
More in Databases & dataagentic-os
Skill · affaan-m
More in Databases & dataai-regression-testing
Skill · affaan-m
More in Databases & data