본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트41k · #6897

querying-posthog-data

하는 일

이 스킬은 트렌드, 퍼널, 사람에 대한 질문부터 다른 PostHog 항목까지 PostHog 데이터에 어떻게 질문할지 설명합니다. 방법을 추측하지 않고 정확한 숫자를 원하는 사람을 위한 것입니다.

사용하는 경우

  • ✓PostHog에서 트렌드, 퍼널, 유지, 생애주기 숫자가 필요할 때.
  • ✓인사이트, 대시보드, 코호트, 기능 플래그, 실험을 찾거나 세고 싶을 때.
  • ✓SQL만 표현할 수 있는 사용자 지정 계산이 필요할 때.

스킬 링크

https://github.com/PostHog/posthog/blob/master/products/posthog_ai/skills/querying-posthog-data/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/posthog_ai/skills/querying-posthog-data/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“지난달 매주 몇 명의 고유 사용자가 가입했고, 그것은 그 전 달과 비교해 어땠나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

질문에 맞는 타입 쿼리 도구를 추천하는데, 이는 PostHog의 표준 정의를 따르기 때문입니다. 타입 도구가 계산을 표현할 수 없을 때만 SQL을 씁니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Querying data in PostHog

The guidelines explain SQL syntax and schema discovery. Read them when you choose posthog:execute-sql. You do not need them for typed queries.

Choose the query path

Default to typed query tools for new product-analytics questions and dashboard insights when their schemas support the requested calculation. This includes simple event counts, unique users, property sums, breakdowns, and time series. Choose SQL only when the task needs SQL capabilities or explicitly requests SQL.

For governed measures, follow the semantic-layer workflow below before deriving a query. Reuse a matching approved metric or saved query when it defines the requested measure.

Typed query tools

Use the matching typed query tool for supported product analytics:

  • posthog:query-trends for native trends with series, breakdowns, formulas, and period comparisons.
  • posthog:query-funnel for conversion rates, drop-off, and step completion.
  • posthog:query-retention for users returning over time.
  • posthog:query-stickiness for engagement frequency.
  • posthog:query-paths for navigation flows.
  • posthog:query-lifecycle for new, returning, resurrecting, and dormant users.

Do not approximate these analyses with SQL when the user expects PostHog's standard definitions. Confirm that the selected tool supports the required calculation and output.

SQL queries

Use posthog:execute-sql when:

  • The request searches system.* tables for PostHog entities.
  • The user requests SQL, record inspection, or changes to an existing SQL query.
  • The analysis needs custom joins, CTEs, window functions, or warehouse SQL.
  • You need to inspect records or discover entities before constructing a later typed query. Use those findings to select events, properties, and filters; typed query tools cannot accept SQL result rows as input.

When either method fits

When both methods fit a new event-analytics query, use the typed runner. SQL being familiar, an example being written in SQL, or an earlier discovery call using SQL is not a reason to choose SQL for the final analysis. Use SQL directly when the task needs its capabilities; a failed typed-query attempt is not required.

Keep a valid existing query when it fits the task. Choose the method again when the task changes. For each new dashboard tile, run the matching typed query and save its native query node (such as TrendsQuery or FunnelsQuery) with insight-create; do not wrap an equivalent SQL query in HogQLQuery. Use SQL-backed insights only for tiles that need SQL. Both methods support visualizations, so a chart or table request alone does not justify SQL.

Render query results

Choose the presentation path from the harness's capabilities, independently of the query method. A query tool having a UI resource does not mean every harness displays it, especially when the call runs inside exec.

  • Already displayed: direct tool calls and some exec harnesses render query results inline. When the harness says the interactive view is visible (for example, the response says "The user already sees this result as an interactive view"), summarize the conclusion without rendering the same chart again.
  • Exec returned data without a chart: if the harness exposes the top-level posthog:render-ui tool and the query tool is in its tool_name enum, call it after the query succeeds. Pass the same tool name and validated input (for example, tool_name: "query-trends" with the successful trends input as tool_input). Call render-ui directly, not through exec. The widget fetches its own data; pass query inputs, not result rows or a new SQL query.
  • No supported UI tool: follow the harness's rendering instructions or provide a written summary. Keep the typed query; lack of an inline chart is not a reason to switch to SQL.

Keep a concise written conclusion alongside the visualization.

When to use this skill

Finding a specific PostHog entity

When the user wants to find a specific entity created in PostHog (insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, data warehouse items, etc.), or when a list/search tool returns too many results to narrow down:

  1. Read the appropriate schema reference under Data Schema to understand the entity's table and columns.
  2. Use posthog:execute-sql to query the system table and find the matching entity (typically returning its ID).
  3. Use the dedicat
자주 묻는 질문

항상 SQL을 쓰면 안 되나요?

타입 도구는 PostHog의 표준 정의를 따르므로, 숫자가 제품에서 보는 것과 일치합니다.

승인된 지표를 먼저 확인하나요?

네. 승인된 지표가 측정을 이미 정의하고 있다면, 스킬은 그것을 재사용합니다.

SQL 규칙은 어디에 있나요?

SQL이 필요할 때 읽히는 지침 파일에 있습니다.

상세 정보

작성자의 원본 설명

Explains how to query PostHog data, defaulting to typed runners for supported product analytics. Read it before you write HogQL/SQL. Also read it before you call execute-sql against PostHog. Use it to find or aggregate PostHog entities. These entities include insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, warehouse data, and persons. Use it for trends, funnels, retention, lifecycle, paths, stickiness, web analytics, error tracking, logs, sessions, and LLM traces. Before you calculate a governed business or telemetry measure, check system.information_schema.metri

repo: PostHog/posthog

인기도

GitHub 스타
41k
순위
#6897
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬