choosing-trend-or-slope-view

作成者: posthog

時間範囲における変化を可視化する方法を明確にしてからトレンドを構築します。ユーザーが何かがどれだけ変化したか、成長したか、減少したか、改善したかなどを尋ねたときに使用します。

npx skills add https://github.com/posthog/ai-plugin --skill choosing-trend-or-slope-view

Choosing a trend line vs a slope view

"How did X change between A and B?" is ambiguous. Two charts answer two different questions, so clarify before you build unless the user already named one:

  • Change over time (line) — the value at every interval across the range. Shows the path: dips, spikes, when it moved. This is the default trend.
  • Start vs end (slope) — only the first and last point, one line per series connecting them. Shows the net change and, across many series, which rose, which fell, and any rank flips — without the noise of the path between.

When the request could be either, ask a short either/or, e.g.:

Do you want to see how it moved across the whole period (a line chart), or just the change from the start to the end (a slope chart)?

If the user clearly wants one — "just tell me how much it grew start to end" → slope; "show me the trend / when did it spike" → line — skip the question and build it.

How to render each

Both come from the same TrendsQuery over the same date range — the slope is that series collapsed to its first and last point, not a different query.

Change over time → line

Default trends behavior. Create or run a TrendsQuery and leave trendsFilter.display as ActionsLineGraph (the default, "change over time"):

{
  "kind": "TrendsQuery",
  "series": [{ "kind": "EventsNode", "event": "$pageview", "math": "total" }],
  "dateRange": { "date_from": "2025-01-01", "date_to": "2025-03-31" },
  "trendsFilter": { "display": "ActionsLineGraph" }
}

Start vs end → slope

Run the trend with posthog:query-trends. The result card Max renders has a Line / Bar / Slope view toggle — switch it to Slope to show each series as a single line from its first to its last point, with the per-series change in the legend. Tell the user they can flip to the Slope view on the result.

The slope view is best for a clean before→after comparison, especially with several series/categories whose relative movement matters. Pick a date range whose two ends are the points you want compared (the slope uses the first and last interval).

Important limits

  • Two surfaces, one computation. Both the inline slope (Max's query-trends result card) and the saved-insight slope (ChartDisplayType.SlopeGraph, behind the slope-graph-insight feature flag) show the same thing: the first interval's value vs the last interval's value, at the chosen group-by interval. The grouping defines the slope — group by month to compare the first vs last month, by day for the first vs last day. Use the inline view for a quick before→after on a result you're already looking at; reach for the saved display to persist it on a dashboard where the flag is enabled. A still-accumulating final period is shown as-is with a dashed connector, the same affordance the line chart uses for an incomplete tail.
  • For period-over-period on a single series (this month vs last), a line with compareFilter: { "compare": true } overlays the two periods; a slope is the better fit when comparing the endpoints of many series at once.

posthogのその他のスキル

managing-experiment-lifecycle
posthog
実験の状態遷移をガイドします:起動、一時停止、再開、終了、バリアントの出荷、アーカイブ、リセット、複製。前提条件などをカバーします。
official
configuring-experiment-analytics
posthog
Configures the analytics side of a PostHog experiment — exposure criteria (default `$feature_flag_called` vs custom exposure events), primary and secondary…
official
error-tracking-hono
posthog
PostHogのHono向けエラートラッキング
official
error-tracking-react
posthog
PostHogのReact向けエラートラッキング
official
integration-android
posthog
Androidアプリケーション向けPostHogインテグレーション
official
integration-ruby
posthog
PostHog統合:Ruby SDKを使用するRubyアプリケーション向け
official
tuning-incremental-sync-config
posthog
同期の設定はExternalDataSchemaに保存され、external-data-schemas-partial-updateを使用していつでも変更できます。ほとんどの変更は非破壊的(次の同期で反映)ですが、一部(sync_typeの切り替え、プライマリキーの変更)は、同期データの破損を防ぐために慎重な対応が必要です。
official
instrument-integration
posthog
このスキルを使用して、アプリケーションにPostHog SDKを追加します。PostHogを初めてセットアップする場合や、PostHogの初期化が必要なPRをレビューする場合に使用してください。SDKのインストール、プロバイダーのセットアップ、基本設定をカバーします。任意のフレームワークや言語に対応しています。
official