Official agent skill

Profiling Slow API Endpoints

by PostHog in PostHog/posthog-foss

Profiles slow PostHog API endpoints when the main cost is in Postgres or Python.

OfficialMITAuto-check passedDatabases

Install Profiling Slow API Endpoints

skills CLI
$ npx skills add PostHog/posthog-foss --skill profiling-slow-api-endpoints -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install PostHog/posthog-foss profiling-slow-api-endpoints --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/PostHog/posthog-foss.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/profiling-slow-api-endpoints .claude/skills/profiling-slow-api-endpoints && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
profiling-slow-api-endpoints
GitHub stars
721
Token cost
~1k tokens
SKILL.md length
537 words
Files
1
Skills in repo
213
Repo updated
First seen
Licence
MIT

At a glance

Profiles slow PostHog API endpoints when the main cost is in Postgres or Python.

  • A Django endpoint has high tail latency
  • SKILL.md covers Find the source of the delay, Capture the exact work, Compare the smallest useful… and Verify the change, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • A query plan changes with tenant size

What it does

Profiling Slow API Endpoints is an agent skill from PostHog/posthog-foss, published by the product's own GitHub organization. Profiles slow PostHog API endpoints when the main cost is in Postgres or Python. Use when a screen, picker, or list is slow; a Django endpoint has high tail latency; a query plan changes with tenant size; or a proposed database fix needs production evidence. Covers APM traces, safe production EXPLAIN, representative measurements, implementation choices, tests, rollout, and post-deploy verification. For ClickHouse or HogQL latency, use optimizing-clickhouse-and-hogql-queries instead.

Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering REST APIs, Data warehousing and Monitoring and alerting. It works with PostHog, ClickHouse, PostgreSQL and Django. The repository describes itself as: PostHog FOSS is a read-only mirror of PostHog, with all proprietary code removed. NOTE: This repo is synced automatically from the main PostHog repo. Please raise any issues and… The licence is MIT.

When your agent uses it

  • A Django endpoint has high tail latency
  • A query plan changes with tenant size
  • A proposed database fix needs production evidence

Example prompts

  • “Use the profiling-slow-api-endpoints skill to profile slow PostHog API endpoints when the main cost is in Postgres or Python”
  • “/profiling-slow-api-endpoints”

What it can do on your machine

Read from SKILL.md and the folder at commit 2c48221. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Profiling Slow API Endpoints loads about 1k tokens when it runs. Until then it costs about 130 tokens; SKILL.md has 537 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~130
When it runs · the whole SKILL.md, loaded when a task matches
~1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from PostHog/posthog-foss at commit 2c48221, republished under its MIT licence (© PostHog). 537 words, ~1,022 tokens.

Download SKILL.mdSave it as .claude/skills/profiling-slow-api-endpoints/SKILL.md (or your agent's skills folder).
name
profiling-slow-api-endpoints
description
Profiles slow PostHog API endpoints when the main cost is in Postgres or Python. Use when a screen, picker, or list is slow; a Django endpoint has high tail latency; a query plan changes with tenant size; or a proposed database fix needs production evidence. Covers APM traces, safe production EXPLAIN, representative measurements, implementation choices, tests, rollout, and post-deploy verification. For ClickHouse or HogQL latency, use `optimizing-clickhouse-and-hogql-queries` instead.

Profiling slow API endpoints

Use this skill when a PostHog API request spends most of its time in Postgres or Python. For ClickHouse and HogQL, use optimizing-clickhouse-and-hogql-queries.

Measure the same user action before and after the change. A faster query does not help if the action stays slow.

Find the source of the delay

Record the page action, endpoint, request shape, affected users, request volume, and a latency percentile such as p95. Read slow APM traces with posthog:query-apm-spans and the exploring-apm-traces skill. The distribution shows how often requests are slow. The traces show where they spend time.

  • Django ORM and cursor.execute spans point to Postgres.
  • ClickHouse work belongs in the ClickHouse skill.
  • Time outside database spans can indicate repeated calls, serialization, or excess data loading.

Follow the request to the function that creates the work. Do not optimize a view wrapper when another function owns the delay.

Capture the exact work

Get the SQL and parameters from a slow request. Keep its filters, ordering, and page size. Check for repeated queries, count queries, and work that does not block the response. A reduced query can use a different plan. Local data and statistics can also produce a different plan.

Use querying-production-databases-via-metabase to inspect the production read replica. Start with EXPLAIN. Use EXPLAIN (ANALYZE, BUFFERS) only when the exact SELECT is safe to run. Inspect row estimates, indexes, join types, loops, filters, sorts, and buffer use.

Compare the smallest useful change

Remove work that the response does not need before you change a query or add an index. Compare the original and candidate with the same parameters. Run each more than once, record the cache state, and verify equal results.

Measure the tenant-size distribution when plans can change with tenant size. Test both sides of a plan crossover before you select a threshold. One tenant is not enough evidence for a conditional plan.

Prefer one plan when it performs well across the measured range. If a size check or cache selects the plan:

  • keep the check cheaper than the work it avoids
  • let stale data affect latency, not results
  • keep the request working when the cache fails
  • record the selected plan on the request span

Use a feature flag when behavior is uncertain or the change needs a staged rollout. Do not use a flag as a substitute for measurements.

Show full SKILL.md (148 more words)Show less

Verify the change

Test public behavior at the lowest useful level. Add plan or SQL-shape tests only when the improvement depends on that shape. Test each plan and the failure path when the code selects between plans. Use a representative database for plan and timing comparisons because unit tests cannot prove latency.

After deployment, check the same latency measure, request volume, error rate, and database load. Compare recorded plan attributes when more than one plan exists. Remove the change if it does not improve the user action without a regression.

Common mistakes

  • Starting with a code theory instead of a slow trace.
  • Measuring only the mean or one warm query.
  • Testing SQL that differs from the endpoint SQL.
  • Selecting a threshold from one tenant.
  • Moving the first response behind optional work.
  • Adding an index before checking the current plan.
  • Declaring success from tests instead of the production measure.

© PostHog, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/profiling-slow-api-endpoints of PostHog/posthog-foss.

Open the folder on GitHubat commit 2c48221

Compare with similar skills

Profiling Slow API Endpoints next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Profiling Slow API Endpoints compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Profiling Slow API Endpoints this skillPostHog/posthog-foss721—~1kAutomated safety check: PassMIT
Backend Dev Guidelineslitefuse/litefuse1001 repos~5.8kAutomated safety check: PassCustom licence
Clickhouse Managed Postgres RcaClickHouse/agent-skills544—~1.2kAutomated safety check: PassApache-2.0
Dsqlawslabs/agent-plugins912—~6.9kAutomated safety check: PassApache-2.0
Django Query Plan Readinghashgraph-online/awesome-codex-plugins1.2k—~660Automated safety check: PassMIT
Chdb SQLvemetric/vemetric3941 repos~1.2kAutomated safety check: PassApache-2.0

Similar skills

  • Backend Dev Guidelines

    litefuse/litefuse

    Comprehensive backend development guide for Litefuse's Next.js 14/tRPC/Express/TypeScript monorepo.

    100 GitHub starsUsed in 1 repo~5.8k tokens
    Backend & APIsAuto-check passed
  • Clickhouse Managed Postgres Rca

    ClickHouse/agent-skills

    MUST USE when investigating performance issues on a ClickHouse-managed Postgres instance.

    544 GitHub stars~1.2k tokensUpdated 8 days ago
    DatabasesAuto-check passed
  • Dsql

    awslabs/agent-plugins

    Official

    Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed…

    912 GitHub stars~6.9k tokensUpdated yesterday
    DatabasesAuto-check passed
  • Django Query Plan Reading

    hashgraph-online/awesome-codex-plugins

    Read and compare Django/PostgreSQL query execution plans using QuerySet.explain(), EXPLAIN, EXPLAIN ANALYZE, scan types, joins, estimates, actual timing, buffers, and row counts.

    1.2k GitHub stars~660 tokensUpdated today
    DatabasesAuto-check passed
  • Chdb SQL

    vemetric/vemetric

    A skill your agent uses when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse…

    394 GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • Querying Tempo

    tempoxyz/tidx

    Query indexed Tempo chain data via tidx HTTP API and CLI. An agent skill from tempoxyz/tidx.

    107 GitHub stars~3.1k tokensUpdated today
    DatabasesAuto-check passed

More from PostHog/posthog-foss

All 213 skills in this repo
  • Authoring Log Alerts

    PostHog/posthog-foss

    Official

    Author useful, low-noise log alerts on services in a PostHog project.

    721 GitHub stars~3k tokensUpdated today
    Auto-check passed
  • Autoresolving PR Conflicts

    PostHog/posthog-foss

    Official

    Operating procedure for the conflict-autoresolver agent: sweep open PostHog/posthog PRs that conflict with master, resolve the trivial conflicts (generated artifacts deterministically, source…

    721 GitHub stars~4.2k tokensUpdated today
    Auto-check passed
  • Official

    Help users debug PostHog Error Tracking stack-trace symbolication for any supported platform — JavaScript/TypeScript web, React Native (Hermes), Android (Proguard / R8), or iOS / macOS (dSYM).

    721 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • Exploring Apm Traces

    PostHog/posthog-foss

    Official

    Investigates distributed application performance using PostHog APM (OpenTelemetry span) data via MCP.

    721 GitHub stars~3.5k tokensUpdated today
    Auto-check passed
  • Exploring LLM Traces

    PostHog/posthog-foss

    Official

    Debug and inspect LLM/AI agent traces using PostHog's MCP tools.

    721 GitHub stars~4.4k tokensUpdated today
    Auto-check passed
  • Investigate Metric

    PostHog/posthog-foss

    Official

    Diagnose why a product metric changed (dropped, spiked, or plateaued) by orchestrating breakdowns, actors, paths, lifecycle, retention, and annotations queries.

    721 GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Questions about Profiling Slow API Endpoints

What does Profiling Slow API Endpoints do?

Profiles slow PostHog API endpoints when the main cost is in Postgres or Python. Profiling Slow API Endpoints is an agent skill from PostHog/posthog-foss, published by the product's own GitHub organization. Profiles slow PostHog API endpoints when the main cost is in Postgres or Python.

When should I use Profiling Slow API Endpoints?

Profiling Slow API Endpoints fits situations like: A Django endpoint has high tail latency; A query plan changes with tenant size; A proposed database fix needs production evidence.

How do I install Profiling Slow API Endpoints in Claude Code?

Run `npx skills add PostHog/posthog-foss --skill profiling-slow-api-endpoints -a claude-code`. Or copy the skill folder (.agents/skills/profiling-slow-api-endpoints in PostHog/posthog-foss) into .claude/skills/profiling-slow-api-endpoints in your project. Claude Code loads it when a task matches its description.

How do I install Profiling Slow API Endpoints in Codex?

Run `npx skills add PostHog/posthog-foss --skill profiling-slow-api-endpoints -a codex`. Or copy the skill folder (.agents/skills/profiling-slow-api-endpoints in PostHog/posthog-foss) into .agents/skills/profiling-slow-api-endpoints in your project. Codex loads it when a task matches its description.

Can I use Profiling Slow API Endpoints in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PostHog/posthog-foss --skill profiling-slow-api-endpoints -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/profiling-slow-api-endpoints, .gemini/skills/profiling-slow-api-endpoints, .github/skills/profiling-slow-api-endpoints and .opencode/skills/profiling-slow-api-endpoints in your project.

What does Profiling Slow API Endpoints need to run?

SKILL.md names no scripts, command-line tools or credentials: Profiling Slow API Endpoints is instructions for the agent only.

Does Profiling Slow API Endpoints access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Profiling Slow API Endpoints safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Profiling Slow API Endpoints use?

Profiling Slow API Endpoints is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Profiling Slow API Endpoints use?

About 1k tokens (SKILL.md is roughly 4.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Profiling Slow API Endpoints?

Skills that share tags, products or a category with Profiling Slow API Endpoints: Backend Dev Guidelines (litefuse/litefuse, 100 stars), Clickhouse Managed Postgres Rca (ClickHouse/agent-skills, 544 stars), Dsql (awslabs/agent-plugins, 912 stars) and Django Query Plan Reading (hashgraph-online/awesome-codex-plugins, 1.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Profiling Slow API Endpoints?

PostHog (a GitHub organization, an official publisher) maintains it in PostHog/posthog-foss, which has 721 GitHub stars. The repository holds 213 skills in this directory. The repository was last updated on October 7, 2026.

Source: PostHog/posthog-foss on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.