profiling-slow-api-endpoints
Skill by PostHog
Profiles slow PostHog API endpoints when most of the time is spent in Postgres or Python. It is for engineers investigating slow screens, lists, or Django endpoints with high tail latency. ClickHouse and HogQL latency is covered by a different skill.
Install profiling-slow-api-endpoints
Built from the published package, never by AI.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/.agents/skills/profiling-slow-api-endpoints ~/.claude/skills/profiling-slow-api-endpointsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install profiling-slow-api-endpoints in Claude Code
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/posthog/.agents/skills/profiling-slow-api-endpoints ~/.gemini/antigravity-cli/skills/profiling-slow-api-endpointsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install profiling-slow-api-endpoints in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill guides the investigation of slow PostHog API requests whose cost sits in Postgres or Python. It starts with the user action, endpoint, request shape, and a latency percentile such as p95, then reads slow APM traces to see where time is spent. It asks the assistant to capture the exact SQL and parameters, inspect production plans with EXPLAIN on a read replica, and compare the smallest useful change against the original using the same parameters.
The skill also covers choosing between query plans based on tenant size, testing each plan and its failure path, and verifying the result after deployment with the same latency measure, error rate, and database load. It is written for PostHog engineers who need production evidence before adding an index or changing a query. For ClickHouse or HogQL work, the source points to a separate skill.
Written from the project's SKILL.md and checked against it.
What it can do
- Trace analysisReads slow APM traces with posthog:query-apm-spans and the exploring-apm-traces skill to find where time is spent.
- Production EXPLAINInspects query plans on the production read replica, using EXPLAIN and EXPLAIN (ANALYZE, BUFFERS) when the SELECT is safe to run.
- Plan comparisonCompares original and candidate queries with the same parameters and checks that results match.
- Tenant-size checksGuides measuring plan behavior across tenant sizes before selecting a threshold or conditional plan.
- Post-deploy verificationLists the latency, request volume, error rate, and database load checks to run after a change ships.
What you need
- Access to APM traces through posthog:query-apm-spans
- Access to the production read replica through the Metabase skill
Try asking
- Profile the slow p95 latency on our project list endpoint
- Run EXPLAIN on the production SQL for this slow picker request
- Compare the query plan before and after adding an index for this endpoint
Good to know
- Covers Postgres and Python latency only; ClickHouse or HogQL latency needs the optimizing-clickhouse-and-hogql-queries skill.
- Use EXPLAIN (ANALYZE, BUFFERS) only when the exact SELECT is safe to run.
- Unit tests cannot prove latency, so plan and timing comparisons need a representative database.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/profiling-slow-api-endpoints/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md4 KB
Alternatives to profiling-slow-api-endpoints
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
profiling-slow-api-endpoints: common questions
When should I use this skill instead of the ClickHouse one?
Use it when the request spends most of its time in Postgres or Python. The source says ClickHouse or HogQL latency should use optimizing-clickhouse-and-hogql-queries instead.
Does it run EXPLAIN ANALYZE on production?
The source says EXPLAIN ANALYZE with BUFFERS should be used only when the exact SELECT is safe to run. Plain EXPLAIN is the starting point.
Why does the skill say to measure the user action, not just the query?
The source states that a faster query does not help if the action stays slow, so the same user action is measured before and after the change.
How do I install profiling-slow-api-endpoints?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is profiling-slow-api-endpoints free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is profiling-slow-api-endpoints safe to use?
It scores 80 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to profiling-slow-api-endpoints?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
