Skip to content

: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.

19.1 KB
Raw Blame

Community skills API

The community skills marketplace lets a team browse, install, and upvote agent skills shared through the PostHog/community-skills repo. The catalog is an instance-global read-model — it is not team-scoped — synced hourly from the repo's registry.json. Installing copies a catalog entry into the team as a regular LLMSkill. A catalog entry is either a skill, which installs that way, or a scout, which does not. See Entry kinds.

Viewset: products/skills/backend/api/community_skills.py (CommunitySkillViewSet). Route: registered in products/skills/backend/routes.py as community_skills under /api/projects/{team_id}/community_skills/.

Authentication and gating

  • Web-app session auth only (scope_object = "INTERNAL"); the endpoint is not exposed for personal-API-key scoping, since the catalog is instance-global.
  • Gated by CommunitySkillFeatureFlagPermission, which requires llm-analytics-community-skills alone. Skills went GA in June 2026 and the llm-analytics-skills flag was removed with it, so there is no base-product flag left to check. The flag is evaluated with the organization and project group so a per-project rollout matches in-app evaluation, and POSTHOG_FEATURE_FLAGS_FORCE_ENABLED is honored for self-hosted.
  • install and vote additionally require resource-level editor access on llm_skill, and are rate-limited by a burst + sustained throttle.

Endpoints

Method Path Purpose
GET community_skills/ List catalog entries (paginated; body omitted).
GET community_skills/{slug}/ Retrieve one entry, including body and file manifest.
POST community_skills/{slug}/install/ Copy the entry into the team as an LLMSkill.
POST community_skills/{slug}/render/ Bind template variables and return the text to prefill a create form.
POST community_skills/{slug}/vote/ Toggle the requesting user's upvote.

{slug} is the repo directory name. Slugs are validated at sync against the skill-name pattern, so they are always routable by DRF's default lookup regex (no . or /).

List filters (GET community_skills/)

Param Behavior
search Case-insensitive substring on name and description; also matches a tag exactly (case-insensitive).
tag Returns only skills carrying this exact tag (case-insensitive; tags are stored lowercased at sync).
trust_tier One of official, verified, community.
kind One of skill, scout. Omit to return both.
order_by One of name/created_at/published_at/install_count/vote_count (± prefix). Defaults to -install_count.

Entry kinds

CommunitySkill.kind says what an entry becomes in a team.

  • skill (the default) is copied in by install as a regular LLMSkill.
  • scout is a Signals scout. The coordinator auto-runs anything named signals-scout-* with privileged scopes, which is why install refuses that prefix outright. Installing a scout under some other name produces an inert skill with no schedule, so install refuses a scout entry with 400 instead. The store calls render and hands the result to the scout-create form through the #createScout= deep link, where a person reviews the schedule and submits it. POST signals/scout stays the only path that creates a scout config.

A scout entry may carry scout_config: the settings the scout-create form shows, and only those.

Field Bound
run_interval_minutes 30 to 43200 (30 days).
run_cron_schedule Five fields, 100 characters. Takes precedence over the interval.
emit Boolean. false runs the scout without writing to the inbox.
tags Up to 10 tags of 50 characters.

network_access, model and mcp_gateway_server_ids reach into a project's data and services, so a published scout never carries them: validate_shareable_scout_config rejects the whole entry rather than dropping the key, on both the sync and the publish side. The bounds are local copies of the ones Signals enforces (products.signals already depends on products.skills, so the reverse import would cycle), and Signals validates them again when the form is submitted.

Sync also refuses a scout entry with bundled files. The create form takes instructions but no files, so such a scout would arrive missing the references its body cites.

Rendering (POST community_skills/{slug}/render/)

Takes the same variables map as install and returns slug, kind, name, description, the rendered body, scout_config, and the variable_bindings used. It persists nothing, so it needs no more access than reading the catalog: the caller reviews the result and creates the skill or scout through its own product's path. Rendering server-side keeps substitution in one place, so a client can't drift from what install produces for the same template.

Install behavior

install_community_skill (community_skill_services.py) copies the entry into a new LLMSkill named after new_name (defaulting to the slug) and bumps the catalog's install_count. Because catalog content originates outside the app, the install path re-validates it rather than trusting the sync:

  • Bundled file paths and sizes are re-checked with the same guards as normal skill creation.
  • The target name is held to the rule a new store skill is held to, which refuses the name of a skill PostHog bundles (bundled_skill_names() in products/skills/backend/bundled_skills.py). Both sets of skills reach an agent host under one name space, so a store skill under a bundled name leaves the host unable to tell which skill an agent asked for. Install such an entry under a different new_name.
  • Installs into auto-running namespaces are refused: the signals-scout- and review-hog- prefixes, whose skills PostHog registers and runs on its own (Signals scouts run with privileged scopes, ReviewHog skills auto-enable in a team's PR reviews). The whole review-hog- prefix is reserved, not only ReviewHog's canonical names, because products.skills can't import products.review_hog to read that list — review_hog already depends on skills, so the import would cycle. Install a community skill whose slug starts with either prefix under a different new_name.
  • ReviewHog provenance keys (seeded_by, canonical_hash, source) are stripped from copied metadata so a catalog entry can't make an installed skill get pruned by ReviewHog's sync.
  • Entries with an empty body or description are rejected (an empty description would later fail export validation).
  • The catalog row is locked and its deleted flag re-checked before copying, so a skill removed from the catalog mid-install can't be installed.

Errors surface as 400 (invalid payload / duplicate name / the entry is a scout) or 404 (unknown or removed slug). A duplicate-name conflict only blames the new_name field when the caller actually supplied it.

Publishing to the community

Publishing runs the other way: it renders a team's own LLMSkill into the repo's skills/<slug>/SKILL.md layout and opens a pull request for a maintainer to review.

Method Path Purpose
POST llm_skills/name/{skill_name}/publish-community/ Open a PR adding or updating this skill.

Lives on LLMSkillViewSet (products/skills/backend/api/skills.py), not the community viewset, because the subject is a team-owned skill. Rendering and the GitHub calls are in community_publish_services.py.

Callers must first retrieve the latest skill and show its version and file manifest to the publisher. The publish request must include the retrieved row's id as expected_skill_id and its numeric version as expected_version. The API returns 409 if either value differs from the latest row. After a conflict, retrieve the skill again and require new consent before another publish request.

  • Gated by CommunityPublishFeatureFlagPermission, which applies the same llm-analytics-community-skills check as the browse endpoints to this action alone. Skills is GA, so the flag cannot sit on the viewset.
  • Throttled at 6/hour and 20/day, keyed by team rather than by credential. _ensure_web_authenticated also accepts a personal API key, and the inherited throttle key prefers the key hash, so one member with several keys would otherwise get a fresh budget with each of them. The API-shaped BurstRateThrottle would not fire here at all: it only counts personal-API-key traffic.
  • The slug is held to the same rule ingest applies (SKILL_NAME_PATTERN, no reserved name, no name PostHog bundles), and body, file count, and per-file size to the same caps, so a publish that ingest would silently drop is refused before the pull request exists. The manifest is also checked for paths that differ only by case and for a name used as both a file and a folder, neither of which a git tree can hold.
  • Bundled paths are canonicalized and allowed-tool names are held to ingest's no-whitespace rule, both through the shared validators in skill_services.py. create_skill (the path the Max tool takes) stores either field without the REST serializer's checks, so a skill can hold references\guide.md or a tool named Bash Write. Publishing one unchanged merges a pull request whose entry ingest then drops.
  • kind is derived from the skill's own category, never taken from the request: a scout published as a plain skill is exactly the entry the catalog can't tell apart. A scout also publishes its scout_config, so it lands in another project on the same cadence. The scout page supplies it; the Skills page doesn't, and a scout published from there arrives on the create form's defaults. Publishing a scout that has bundled files is refused, matching what sync accepts.
  • display_name is capped at 64 characters to match CommunitySkill.name. A longer name would pass review and then be dropped by ingest, so the skill would never appear in the catalog.
  • author_handle is validated against GitHub's username shape, and is self-reported. Nothing checks it against the publisher's PostHog account, so the PR body presents it as a handle the publisher gave.
  • Bundled files are text only. CommunitySkillFile.content is a TextField and the renderer takes str, so a skill referencing an image or other binary asset cannot round-trip through the catalog.
  • Community publishing also checks the smaller limits in PostHog/community-skills/scripts/build_registry.py: at most 256 KiB (262,144 bytes) per bundled file and 1 MiB (1,048,576 bytes) for the body plus bundled files. The total counts the UTF-8 body after normalizing line endings and trimming surrounding whitespace, plus each bundled file's UTF-8 bytes. YAML frontmatter is excluded, and the per-file limit does not apply to the body. The store's existing body and file-count limits still apply. The separate 5,000,000-byte limit on the encoded GitHub tree request includes frontmatter, file paths, and JSON escaping. An oversized skill returns 400 before acquiring a GitHub publisher or writing a branch.
  • Template skills publish their normalized metadata.variables schema (and no other store metadata). Publishing checks that the template installs with only its defaults: every {{ variable }} in SKILL.md or a bundled file is declared, and the defaults and rendered output fit the install size caps. A failed check stops publishing with 400 before any GitHub write. A skill with no variables is not a template, so its {{ }} text publishes verbatim, as install keeps it.

Settings

Setting Effect
COMMUNITY_SKILLS_GITHUB_APP_CLIENT_ID Client id of the publisher App, and the issuer of the App JWT that mints the token.
COMMUNITY_SKILLS_GITHUB_APP_PRIVATE_KEY PEM the App JWT is signed with. Escaped newlines are restored before signing.
COMMUNITY_SKILLS_GITHUB_INSTALLATION_ID Installation of that App on the publish repo. Empty (the default) returns 503.
COMMUNITY_SKILLS_GITHUB_REPO Bare repo name to publish into. The owner comes from the installation's account.

Publishing runs as its own dedicated GitHub App, installed on the publish repo alone. It does not fall back to the core GITHUB_APP_* App, which is installed across the whole PostHog org: a dedicated App cannot reach another repository whatever the publish path asks it for. One App serves every region, so the client id and the installation id hold the same value everywhere and only the private key is per-region. Any of the three being empty keeps publishing off.

COMMUNITY_SKILLS_GITHUB_REPO is publish-only. The hourly catalog sync reads registry.json from the repo pinned in community_skill_sync.py, so pointing this setting elsewhere sends pull requests to a repo the sync never reads back.

The App and its privileges

Registering and installing the App is manual org-admin work in the GitHub UI. Nothing in posthog-cloud-infra manages App installations, and the env values land through PostHog/charts (shared/posthog-django/common.prod-us.yaml and common.prod-eu.yaml, next to the STAMPHOG_GITHUB_APP_* block, with the private key in secret_env). Least privilege is held at three layers, and only the last one is code:

  1. App registration. The App declares Contents: write, Pull requests: write, and Metadata: read, and nothing else. No webhook, no user-authorization flow, so it has no client secret and no webhook secret. Private, owned by the PostHog org. This is the ceiling on anything the App can ever do.
  2. Installation. Installed with "Only select repositories" and the publish repo as the one selection. This caps the repo scope, and is why the core GITHUB_APP_* App cannot serve here.
  3. Token mint. PUBLISHER_TOKEN_PERMISSIONS in community_publish_services.py requests an installation token holding exactly those three permissions on COMMUNITY_SKILLS_GITHUB_REPO alone. GitHub only lets a token request narrow what the two layers above granted, so a later over-grant in the UI still cannot reach a publish.

Keep the three in step: a permission the App does not declare makes the token mint fail with a 422 rather than a scoped token, which the publish path reports as a gateway error.

Repo writes

The target repo is public, so a failed publish must not leave anything behind:

  • The branch is community-skill/<slug>-<publisher key>, so re-publishing rewrites that branch and returns the PR already open for it instead of opening a second one. The publisher key is a short hash of the team's uuid: a slug is only unique within a team, so a branch keyed on the slug alone would let one team force-update another team's open pull request.
  • Every rendered file lands in a single tree and commit, built before the branch reference exists. A failure part way through leaves no branch, and reviewers see one commit rather than one per file.
  • If opening the PR fails, the branch is deleted again.
  • Content becomes public at the branch write, before the pull request that moderates it. Confirming that with the user is a UI concern, and it gates enabling the flag rather than shipping this code.

Who can publish

Publishing a skill is restricted to that skill's own owners (LLMSkillOwner), on top of the access AccessControlPermission already requires. CommunityPublishOwnerPermission enforces it.

Ownership is an audit claim on top of editor access, not a separate authorization boundary. Any member with edit access to a skill can add themselves as an owner through PATCH name/<slug>, so publishing means an editor took ownership of that skill explicitly, and the LLMSkillOwner row records who did and when. Reach across skills is closed by the object-level check on every name/<slug> action, not by ownership. Owner rows are filtered by current project access rather than deleted when access goes away, so a member who regains access is an owner again; that is equivalent to them adding themselves back, and it keeps a skill whose owners all left readable as "owned, nobody current" rather than as unowned.

A skill with no current owners is publishable by nobody, and answers 403. Owners leave the set when a member loses project access, and a skill can be created with an explicit empty owner list, so the alternative is a fallback to edit access for exactly the skills that have nobody to answer for them. Adding an owner is the remedy. There is no exemption for project or organization admins; an admin who wants to publish adds themselves as an owner first.

Errors surface as 400 (invalid payload), 403 (the requester does not own the skill, or it has no owners), 404 (unknown skill), 409 (the reviewed skill row is no longer latest), 502 (GitHub refused a step), or 503 when the instance has no publisher App configured. The 503 is the fail-safe that keeps publishing off until the GitHub App is installed. A private key that cannot sign is a 503 too: it is a deployment nobody can retry their way out of, so it must not read as GitHub being down.

The three are kept apart on purpose, because each sends the publisher somewhere different. The skill is rendered before GitHub is touched, so a skill that has to be edited answers 400 even while the App is down. 503 is reserved for the settings an operator has to change: an installation GitHub says is absent, one whose App credentials it refuses, and one that doesn't grant the contents and pull_requests write the mint asks for. Any other failed status while minting the publish token is an outage and answers 502, so a transient failure doesn't read as "this instance can't publish".

The 503 is logged as llma_skill_publish_to_community_not_configured, with the team, user and skill. Without it an instance meant to have publishing on is indistinguishable from one that never configured it, until somebody reports the toast.