: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
fix(skills): move community skills under /skills/community (#85922)
Andrew Maguire0260b8fbbe64
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 4e8b6d68d753..3ee08404c63b 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -225,7 +225,7 @@ export const productRoutes: Record<string, [string, string]> = {'/skills': ['Skills', 'skills'],'/skills/scouts': ['Skills', 'skillsScouts'],'/skills/review-hog': ['Skills', 'skillsReviewHog'],- '/community-skills': ['CommunitySkills', 'communitySkills'],+ '/skills/community': ['CommunitySkills', 'communitySkills'],'/skills/:name': ['Skill', 'skill'],'/stamphog': ['Stamphog', 'stamphog'],'/stamphog/runs': ['StamphogRuns', 'stamphogRuns'],@@ -414,6 +414,8 @@ export const productRedirects: Record<'/mcp-analytics': (_params, searchParams, hashParams) =>combineUrl(urls.mcpAnalyticsDashboard(), { ...searchParams, landing: 'auto' }, hashParams).url,'/replay-vision/templates': '/replay-vision/new/template',+ '/community-skills': (_params, searchParams, hashParams) =>+ combineUrl(urls.communitySkills(), searchParams, hashParams).url,'/prompt-management/skills': (_params, searchParams, hashParams) =>combineUrl(urls.skills(), searchParams, hashParams).url,'/prompt-management/skills/:name': (params, searchParams, hashParams) =>@@ -1438,7 +1440,7 @@ export const productUrls = {version?: number}): string => combineUrl(`/skills/${name}`, params).url,- communitySkills: (): string => '/community-skills',+ communitySkills: (): string => '/skills/community',stamphog: (): string => '/stamphog',stamphogRuns: (): string => '/stamphog/runs',stamphogDigests: (): string => '/stamphog/digests',diff --git a/products/skills/backend/api/skill_serializers.py b/products/skills/backend/api/skill_serializers.pyindex a8884a1aed03..ce37cda845d7 100644--- a/products/skills/backend/api/skill_serializers.py+++ b/products/skills/backend/api/skill_serializers.py@@ -20,9 +20,9 @@ from .skill_services import ()# Skill names that collide with reserved /skills routes and so can't be used: "new" is the create-# form, and the rest mirror the category-tab slugs registered under /skills/<slug> in+# form, and the rest mirror the tab slugs registered under /skills/<slug> in# products/skills/manifest.tsx — a skill with such a name would be shadowed by its tab route.-RESERVED_SKILL_NAMES = {"new", "scouts", "review-hog"}+RESERVED_SKILL_NAMES = {"new", "scouts", "review-hog", "community"}# Bundled-file paths that would collide with generated artifacts in the exported skill# tree / plugin marketplace (the rendered SKILL.md). Compared case-insensitively.RESERVED_SKILL_FILE_PATHS = {"skill.md"}diff --git a/products/skills/backend/api/test/test_skills.py b/products/skills/backend/api/test/test_skills.pyindex dfe80cedd368..5e71fb322ec0 100644--- a/products/skills/backend/api/test/test_skills.py+++ b/products/skills/backend/api/test/test_skills.py@@ -152,6 +152,7 @@ class TestLLMSkillAPI(APIBaseTest):("reserved_new", "new"),("reserved_scouts", "scouts"),("reserved_review_hog", "review-hog"),+ ("reserved_community", "community"),])def test_create_skill_validates_name_format(self, _label, skill_name):diff --git a/products/skills/backend/tools/skills.py b/products/skills/backend/tools/skills.pyindex e4c165c19f80..c473bbb48621 100644--- a/products/skills/backend/tools/skills.py+++ b/products/skills/backend/tools/skills.py@@ -11,6 +11,7 @@ from posthog.rbac.user_access_control import AccessControlLevelfrom posthog.scopes import APIScopeObjectfrom posthog.sync import database_sync_to_async+from products.skills.backend.api.skill_serializers import RESERVED_SKILL_NAMESfrom products.skills.backend.api.skill_services import (LLMSkillDuplicateNameConflictError,LLMSkillEditError,@@ -388,6 +389,11 @@ class CreateLLMSkillTool(MaxTool):metadata: dict[str, Any] | None = None,files: list[dict[str, str]] | None = None,) -> tuple[str, None]:+ # The tool calls create_skill directly, which skips the serializer's name validation, so a+ # reserved name would persist a skill whose /skills/<name> page is taken by a tab route.+ if name.lower() in RESERVED_SKILL_NAMES:+ raise MaxToolFatalError(f"'{name}' is a reserved name and cannot be used for a skill.")+try:skill = await database_sync_to_async(create_skill)(self._team,diff --git a/products/skills/backend/tools/test_skills.py b/products/skills/backend/tools/test_skills.pyindex 03df7a26aaf2..893e7755b85b 100644--- a/products/skills/backend/tools/test_skills.py+++ b/products/skills/backend/tools/test_skills.py@@ -194,6 +194,14 @@ class TestCreateLLMSkillTool(BaseTest):assert first_file is not Noneassert first_file.path == "scripts/mandelbrot.py"+ def test_reserved_name_raises_fatal(self):+ tool = CreateLLMSkillTool(team=self.team, user=self.user)++ with self.assertRaisesRegex(MaxToolFatalError, "reserved name"):+ _run(tool, name="community", description="d", body="b")++ assert not LLMSkill.objects.filter(team=self.team, name="community").exists()+def test_duplicate_name_raises_fatal(self):LLMSkill.objects.create(team=self.team, name="dup", description="d", body="b")diff --git a/products/skills/frontend/SkillsSceneShell.tsx b/products/skills/frontend/SkillsSceneShell.tsxindex 55db22d8e4d8..42c27bd26f50 100644--- a/products/skills/frontend/SkillsSceneShell.tsx+++ b/products/skills/frontend/SkillsSceneShell.tsx@@ -11,7 +11,7 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'import { DEFAULT_SKILLS_TAB_KEY, skillTabUrl, skillTabsLogic, visibleCategoryTabs } from './skillTabsLogic'-/** Tab key for the Community scene, which lives at its own URL rather than under /skills. */+/** Tab key for the Community scene, and its `/skills/<key>` URL segment. */export const COMMUNITY_SKILLS_TAB_KEY = 'community'export const COMMUNITY_SKILLS_TAB_DESCRIPTION = 'Discover and install agent skills shared by the PostHog community.'@@ -21,11 +21,11 @@ export const COMMUNITY_SKILLS_TAB_DESCRIPTION = 'Discover and install agent skil* category tabs (Scouts, Code review), then "Community" — so the category tabs and Community sit* in the same row instead of stacking two bars.*- * Community is a separate scene at its own URL, so each scene renders this with only its own tab's- * content; the other tabs navigate via their `link` and are never mounted here. That keeps the two- * scenes' logics (and URL contracts) independent while presenting them as one tabbed surface. The- * Community tab is gated behind the community-skills flag (but stays visible when it's already the- * active tab, so a direct URL still renders cleanly).+ * Community is a separate scene (at /skills/community), so each scene renders this with only its own+ * tab's content; the other tabs navigate via their `link` and are never mounted here. That keeps the+ * two scenes' logics independent while presenting them as one tabbed surface. The Community tab is+ * gated behind the community-skills flag (but stays visible when it's already the active tab, so a+ * direct URL still renders cleanly).*/export function SkillsSceneShell({activeTabKey,diff --git a/products/skills/frontend/skillConstants.ts b/products/skills/frontend/skillConstants.tsindex ecac06494eca..f3dda089c57b 100644--- a/products/skills/frontend/skillConstants.ts+++ b/products/skills/frontend/skillConstants.ts@@ -4,10 +4,10 @@ export const SKILL_DESCRIPTION_MAX_LENGTH = 4096export const SKILL_FILE_MAX_BYTES = 1_000_000export const SKILL_FILE_MAX_COUNT = 200-// Names that collide with reserved /skills routes: 'new' (the create form) and the category-tab-// slugs registered under /skills/<slug> in manifest.tsx. A skill with one of these names would be+// Names that collide with reserved /skills routes: 'new' (the create form) and the tab slugs+// registered under /skills/<slug> in manifest.tsx. A skill with one of these names would be// shadowed by its route. Kept in sync with RESERVED_SKILL_NAMES in the backend skill_serializers.-const RESERVED_SKILL_NAMES = new Set(['new', 'scouts', 'review-hog'])+const RESERVED_SKILL_NAMES = new Set(['new', 'scouts', 'review-hog', 'community'])export function validateSkillName(name: string): string | undefined {if (!name?.trim()) {diff --git a/products/skills/manifest.tsx b/products/skills/manifest.tsxindex c22c92e2a1d7..8682e0378e6b 100644--- a/products/skills/manifest.tsx+++ b/products/skills/manifest.tsx@@ -35,14 +35,17 @@ export const manifest: ProductManifest = {},routes: {'/skills': ['Skills', 'skills'],- // Category tabs (e.g. /skills/scouts) must precede the `/skills/:name` wildcard so they- // aren't captured as a skill named after the tab. Route order = match precedence.+ // Tab routes (e.g. /skills/scouts) must precede the `/skills/:name` wildcard so they+ // aren't captured as a skill named after the tab. Route order = match precedence. Every+ // slug here is also in RESERVED_SKILL_NAMES so no skill can claim a shadowed name.'/skills/scouts': ['Skills', 'skillsScouts'],'/skills/review-hog': ['Skills', 'skillsReviewHog'],- '/community-skills': ['CommunitySkills', 'communitySkills'],+ '/skills/community': ['CommunitySkills', 'communitySkills'],'/skills/:name': ['Skill', 'skill'],},redirects: {+ '/community-skills': (_params, searchParams, hashParams) =>+ combineUrl(urls.communitySkills(), searchParams, hashParams).url,'/prompt-management/skills': (_params, searchParams, hashParams) =>combineUrl(urls.skills(), searchParams, hashParams).url,'/prompt-management/skills/:name': (params, searchParams, hashParams) =>@@ -58,7 +61,7 @@ export const manifest: ProductManifest = {skillsCategoryTab: (categoryTab: string): string => `/skills/${categoryTab}`,skill: (name: string, params?: { file?: string; version?: number }): string =>combineUrl(`/skills/${name}`, params).url,- communitySkills: (): string => '/community-skills',+ communitySkills: (): string => '/skills/community',},fileSystemTypes: {},treeItemsNew: [],