:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(skills): use product.yaml as source of truth for team ownership (#62678)
Robbie441ac237fb48
diff --git a/.agents/skills/optimizing-clickhouse-and-hogql-queries/SKILL.md b/.agents/skills/optimizing-clickhouse-and-hogql-queries/SKILL.mdindex 71ae3e26c76f..4b878a1a2fde 100644--- a/.agents/skills/optimizing-clickhouse-and-hogql-queries/SKILL.md+++ b/.agents/skills/optimizing-clickhouse-and-hogql-queries/SKILL.md@@ -15,9 +15,14 @@ This skill assumes you already know how to write HogQL. For writing new ClickHouSometimes the job isn't one slow query — it's "optimize all the ClickHouse/HogQL queries owned by team X." Before diving into individual queries, build the full inventory first, or you'll optimize a subset and miss the rest.-**Find the team's code via `.github/CODEOWNERS` and `.github/CODEOWNERS-soft`.** Grep both for the team's handle (e.g. `@PostHog/team-surveys`) to get every path the team owns. `CODEOWNERS-soft` in particular carries the product-area ownership most teams rely on.+**Find the team's owned code — `products/*/product.yaml` is the source of truth, CODEOWNERS is the backup.** Check the two places in this order:-**The ownership paths drift out of date — verify each one exists before trusting it.** Products move (e.g. into `products/<name>/`), files get renamed, directories get restructured, but `CODEOWNERS-soft` often lags. After extracting the owned paths, check each actually exists on disk; for any that don't, find where the code moved (the product likely relocated under `products/`) and **flag the stale entries to the operator** so they can fix `CODEOWNERS-soft` — don't silently substitute and move on. A stale path you skip is a query you never optimized.+1. **`products/*/product.yaml` (start here).** Each product declares its owning team(s) under `owners:` as a bare slug — the team's CODEOWNERS handle minus the `@PostHog/` prefix (`conversations`, `logs`, `team-signals`, …). Grep every `products/*/product.yaml` for the team's slug; each hit means the team owns **all of `products/<name>/**`**. This is exactly what the reviewer auto-assigner uses, and one team often owns several products — don't stop at the first match. A team whose code all lives under `products/` may have **nothing** in CODEOWNERS, and that's correct, not a gap.+2. **`.github/CODEOWNERS-soft` (backup, for paths outside `products/`).** Grep for the team's handle (`@PostHog/team-surveys`, `@PostHog/conversations`, …). This file covers what product.yaml can't: shared backend (`posthog/tasks/`, `posthog/hogql/database/schema/`, `posthog/temporal/`), frontend scenes not yet moved into a product, and sub-folder overrides. (`.github/CODEOWNERS` — the hard, blocking file — is mostly infrastructure and rarely names product paths, but a grep there is cheap.)++If the team name you were given doesn't resolve, try both the bare and `team-`-prefixed slug (`conversations` vs `team-conversations`) — the convention isn't uniform.++**Verify the CODEOWNERS-soft paths exist — they drift; product.yaml doesn't.** `product.yaml` ownership is self-consistent: it sits inside the directory it owns, so `products/<name>/**` always exists. The staleness is in `CODEOWNERS-soft`, where a product that moved under `products/` often leaves its old paths behind. Check each CODEOWNERS-soft path on disk; for any that's gone, the code most likely relocated into a `products/<name>/` the team already owns via product.yaml — **flag the stale entry to the operator** so they can fix `CODEOWNERS-soft`, don't silently substitute and move on. A stale path you skip is a query you never optimized.**Search both backend AND frontend — owned paths include both.** A team's ownership almost always spans `frontend/src/...` as well as backend Python. The majority of ClickHouse/HogQL queries are written in Python (query runners, `execute_hogql_query`, raw `sync_execute`), **but not all of them** — plenty of products still build HogQL client-side in kea logics / React / TypeScript and POST it to the `/query` endpoint. If you only search backend paths and backend idioms, you'll miss these entirely (this is a real, recurring miss). When scoping a team, either search every owned path — frontend included — with both backend and frontend query idioms, or tell the operator up front that you're covering backend only and ask whether they want frontend too. Don't let an unstated "queries live in the backend" assumption narrow the search silently.