investigate-metric
它能做什么
本技能利用细分、漏斗、留存及其他相关查询,解释某个 PostHog 图表为何发生变化。适合需要了解变化原因的分析师和产品经理。
适用场景
- ✓当某项指标下降或激增,你想知道原因时。
- ✓当有人要求你解释一张你看不懂的图表时。
- ✓当漏斗、留存或生命周期指标发生变化,你需要找出根本原因的时候。
技能链接
https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/investigate-metric/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“注册人数上周二急剧下降。请帮我查明原因。”
每周 5 个新技能,1 分钟读完。
工作原理
它会运行几项相关查询,例如按属性细分,以及查看导致变化的用户,然后检查标注中可能解释该变化的事件。它会把结果综合为最可能的原因。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Investigating a metric change
For "why did X change?" questions about a saved insight, dashboard tile, or pasted query, and for "explain this chart" or "walk me through this" when the user names no change. Don't load this skill for plain "what is X?" questions — only when there's a chart or an observed change to explain.
Tools
Targets PostHog MCP v2. Typed query tools accept the query body directly — pass
kind, series, dateRange as top-level fields, do not wrap in InsightVizNode.
| Tool | Purpose |
|---|---|
posthog:query-trends |
Trends (count over time) |
posthog:query-funnel |
Funnels (multi-step conversion) |
posthog:query-retention |
Retention (cohort return rates) |
posthog:query-stickiness |
Stickiness (active days per user) |
posthog:query-lifecycle |
Lifecycle (new/returning/resurrecting/dormant) |
posthog:query-paths |
Paths (navigation flow) |
posthog:query-trends-actors |
Users behind a trend bucket (trends source only) |
posthog:execute-sql |
Existing SQL insights and custom analysis |
posthog:read-data-schema |
Discover events, properties, sample values |
posthog:insight-get / -query |
Fetch a saved insight's metadata / data |
posthog:explain-chart |
Walk the user through a trends chart (Step 5) |
Plus the standard PostHog tools the playbooks reference by name (feature-flag-get-all,
experiment-list, annotations-list, query-error-tracking-issues-list, query-logs,
query-session-recordings-list, cohorts-list/-create, annotation-create,
insight-create).
Helper scripts
compare_to_prior_periods.py— auto-detects interval and compares recent values to the natural cycle (day-of-week, hour-of-week, or sequential). Use to resolve step 2.2 cheaply.breakdown_attribution.py— ranks breakdown segments by absolute delta and flags offsetting moves.
python3 scripts/compare_to_prior_periods.py < query_result.json
WINDOW=7 python3 scripts/breakdown_attribution.py < breakdown_result.json
Step 1 — Classify the metric
Read query.kind from the source the user pointed at:
- Saved insight (URL,
short_id):posthog:insight-get→query.kind. Useposthog:insight-queryif you also need the numbers. - A query you already ran or the user pasted: read
kinddirectly. - A metric the user only names, such as "signups", or shows in a screenshot: find its event
with
posthog:read-data-schemaand run it as one series over time withposthog:query-trends. That query is yourTrendsQuery. Whenquery-trendscannot express the metric, such as a warehouse-only metric or a custom SQL join, run it withposthog:execute-sqland treat it as aHogQLQuery. - Nothing pointed at, or several events could be the metric: ask which one. Don't guess.
| kind | Playbook |
|---|---|
TrendsQuery |
trend-playbook.md |
FunnelsQuery |
funnel-playbook.md |
RetentionQuery |
retention-playbook.md |
StickinessQuery |
stickiness-playbook.md |
LifecycleQuery |
lifecycle-playbook.md |
PathsQuery |
paths-playbook.md |
HogQLQuery |
route by what the SQL aggregates (see below) |
If kind === "TrendsQuery" and trendsFilter.display === "BoxPlot", use
box-plot-playbook.md — distribution metric, no
breakdowns.
For HogQLQuery insights, classify by the SQL's shape: count over time → trend
playbook, multi-step conversion → funnel playbook, cohort return → retention playbook.
Run the SQL through posthog:execute-sql to get the data, then follow the closest
playbook's steps. See HogQL insights in shared-patterns.md.
常见问题
它只能用于已保存的洞察吗?
不是。它也可以用于仪表盘中的图块,或你粘贴的查询。
它会解释指标是什么意思吗?
不会。它用于需要解释的变化或图表,而不是简单的定义。
它如何找出变化背后的用户?
它使用趋势参与者查询,查看哪些人位于发生变化的分组中。
详情
作者的原始描述
Diagnose why a product metric changed (dropped, spiked, or plateaued) by orchestrating breakdowns, actors, paths, lifecycle, retention, and annotations queries. Use when the user reports an anomaly, asks "why did X change?", asks to explain or walk them through a chart, or needs root-cause analysis for a trend, funnel, retention, stickiness, or lifecycle metric.
repo: PostHog/posthog
热度
- GitHub 星标
- 41k
- 排名
- #6904
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
depot-ci
41k帮你的智能体设置并运行 Depot CI 工作流(GitHub Actions 的替代方案),包括迁移现有工作流和读取运行日志。
depot-container-builds
41k帮你的智能体在 Depot 的远程构建器上构建 Docker 镜像,包括多平台镜像、推送到镜像仓库,以及修复构建失败。
depot-github-runners
41k帮你的智能体把 GitHub Actions 任务迁移到 Depot 托管的运行器上,选择运行器规格和标签,并排查运行器设置问题。
editing-agents-md
41k帮你的智能体判断某条规则应写入 AGENTS.md 还是 CLAUDE.md,并以不会让文件臃肿的方式写下,确保规则真正生效。