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.

feat(llma): publish skills to community UI (5/7) (#65014)

Andrew Maguirea7004ff866c2
diff --git a/products/skills/frontend/LLMSkillsScene.tsx b/products/skills/frontend/LLMSkillsScene.tsx
index 72157520e36a..7c2837aa467f 100644
--- a/products/skills/frontend/LLMSkillsScene.tsx
+++ b/products/skills/frontend/LLMSkillsScene.tsx
@@ -56,6 +56,7 @@ function buildSkillColumns(
duplicateSkill: (name: string, newName: string) => void,
deleteSkill: (name: string) => void,
downloadSkillZip: (name: string) => void,
+ publishToCommunity: (skill: LLMSkillListApi) => void,
options?: { showScoutOrigin?: boolean }
): LemonTableColumns<LLMSkillListApi> {
return [
@@ -181,6 +182,19 @@ function buildSkillColumns(
</LemonButton>
</AccessControlAction>
+ <AccessControlAction
+ resourceType={AccessControlResourceType.LlmSkill}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ <LemonButton
+ onClick={() => publishToCommunity(skill)}
+ data-attr="llma-skill-dropdown-publish-community"
+ fullWidth
+ >
+ Publish to community
+ </LemonButton>
+ </AccessControlAction>
+
<AccessControlAction
resourceType={AccessControlResourceType.LlmSkill}
minAccessLevel={AccessControlLevel.Editor}
@@ -421,8 +435,15 @@ function ConnectToClaudeCodeModal(): JSX.Element {
}
export function LLMSkillsScene(): JSX.Element {
- const { setFilters, deleteSkill, duplicateSkill, downloadSkillZip, importSkill, setConnectModalOpen } =
- useActions(llmSkillsLogic)
+ const {
+ setFilters,
+ deleteSkill,
+ duplicateSkill,
+ downloadSkillZip,
+ importSkill,
+ setConnectModalOpen,
+ publishToCommunity,
+ } = useActions(llmSkillsLogic)
const {
skills,
skillsLoading,
@@ -435,6 +456,7 @@ export function LLMSkillsScene(): JSX.Element {
activeTabKey,
activeCategory,
activeTabDescription,
+ githubLogin,
} = useValues(llmSkillsLogic)
const { featureFlags } = useValues(featureFlagLogic)
const { searchParams } = useValues(router)
@@ -446,12 +468,54 @@ export function LLMSkillsScene(): JSX.Element {
// Discovery CTA: when a project has no skills of its own yet, point first-timers at the community catalog.
const showCommunityDiscovery = communitySkillsEnabled && !skillsLoading && skills.count === 0 && !filters.search
+ const openPublishDialog = (skill: LLMSkillListApi): void => {
+ LemonDialog.openForm({
+ title: 'Publish to community',
+ description:
+ "Publishing commits the skill's instructions and every bundled file to a public GitHub repo, then opens a pull request for a maintainer to review. The contents are public from the moment you submit, so don't include credentials or internal details.",
+ initialValues: {
+ display_name: skill.name.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()),
+ tags: '',
+ // Prefill with the user's resolved GitHub handle when we have one; the field stays
+ // editable so users without a linked GitHub identity can still type one (free-text fallback).
+ author_handle: githubLogin ?? '',
+ },
+ content: (
+ <div className="flex flex-col gap-2">
+ <LemonField name="display_name" label="Display name">
+ <LemonInput data-attr="llma-publish-display-name" autoFocus />
+ </LemonField>
+ <LemonField name="tags" label="Tags (comma-separated)">
+ <LemonInput data-attr="llma-publish-tags" placeholder="web-analytics, triage" />
+ </LemonField>
+ <LemonField name="author_handle" label="Your GitHub handle (optional)">
+ <LemonInput data-attr="llma-publish-author-handle" placeholder="octocat" />
+ </LemonField>
+ </div>
+ ),
+ onSubmit: ({ display_name, tags, author_handle }) =>
+ publishToCommunity(skill.name, {
+ display_name: display_name?.trim() || undefined,
+ tags: tags
+ ? tags
+ .split(',')
+ .map((t: string) => t.trim())
+ .filter(Boolean)
+ : undefined,
+ author_handle: author_handle?.trim() || undefined,
+ }),
+ })
+ }
+
// Memoize columns so the array reference doesn't change every render — otherwise every
// nested LemonTable inside the grouped tree reconciles on each parent re-render.
const columns = useMemo(
- () => buildSkillColumns(skillUrl, duplicateSkill, deleteSkill, downloadSkillZip, { showScoutOrigin }),
+ () =>
+ buildSkillColumns(skillUrl, duplicateSkill, deleteSkill, downloadSkillZip, openPublishDialog, {
+ showScoutOrigin,
+ }),
// eslint-disable-next-line react-hooks/exhaustive-deps
- [searchParams, duplicateSkill, deleteSkill, downloadSkillZip, showScoutOrigin]
+ [searchParams, duplicateSkill, deleteSkill, downloadSkillZip, publishToCommunity, githubLogin, showScoutOrigin]
)
const showGroupedView = filters.group_by_prefix && groupedSkills && !skillsLoading
diff --git a/products/skills/frontend/llmSkillsLogic.ts b/products/skills/frontend/llmSkillsLogic.ts
index d1c418270e4e..657b86d1b8f1 100644
--- a/products/skills/frontend/llmSkillsLogic.ts
+++ b/products/skills/frontend/llmSkillsLogic.ts
@@ -4,6 +4,7 @@ import { router, urlToAction } from 'kea-router'
import { objectsEqual } from 'lib/utils/objects'
+import { usersGithubLoginRetrieve } from '~/generated/core/api'
import api, { ApiConfig } from '~/lib/api'
import { downloadBlob } from '~/lib/components/ExportButton/exporter'
import { Sorting } from '~/lib/lemon-ui/LemonTable'
@@ -21,6 +22,7 @@ import {
llmSkillsMarketplaceInstallCommandRetrieve,
llmSkillsNameArchiveCreate,
llmSkillsNameDuplicateCreate,
+ llmSkillsNamePublishCommunityCreate,
} from 'products/skills/frontend/generated/api'
import type {
LLMSkillListApi,
@@ -198,6 +200,8 @@ export interface llmSkillsLogicValues {
connectModalOpen: boolean
count: number
filters: SkillFilters
+ githubLogin: string | null
+ githubLoginLoading: boolean
groupedSkills: SkillGroupTree | null
importing: boolean
issuingCredential: boolean
@@ -205,6 +209,7 @@ export interface llmSkillsLogicValues {
marketplaceLoading: boolean
marketplaceState: LLMSkillMarketplaceCommandApi | null
pagination: PaginationManual | undefined
+ publishingSkills: Record<string, boolean>
rawFilters: Partial<SkillFilters> | null
skillCountLabel: string
skills: PaginatedLLMSkillListListApi
@@ -233,6 +238,21 @@ export interface llmSkillsLogicActions {
issueMarketplaceCommand: (rotate?: boolean) => {
rotate: boolean
}
+ loadGithubLogin: () => any
+ loadGithubLoginFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadGithubLoginSuccess: (
+ githubLogin: string | null,
+ payload?: any
+ ) => {
+ githubLogin: string | null
+ payload?: any
+ }
loadMarketplaceState: () => {
value: true
}
@@ -257,6 +277,27 @@ export interface llmSkillsLogicActions {
debounce: boolean
}
}
+ publishToCommunity: (
+ skillName: string,
+ options: {
+ author_handle?: string
+ display_name?: string
+ tags?: string[]
+ }
+ ) => {
+ options: {
+ author_handle?: string | undefined
+ display_name?: string | undefined
+ tags?: string[] | undefined
+ }
+ skillName: string
+ }
+ publishToCommunityFailure: (skillName: string) => {
+ skillName: string
+ }
+ publishToCommunitySuccess: (skillName: string) => {
+ skillName: string
+ }
setActiveTab: (tabKey: string) => {
tabKey: string
}
@@ -323,6 +364,12 @@ export const llmSkillsLogic = kea<llmSkillsLogicType>([
setActiveTab: (tabKey: string) => ({ tabKey }),
deleteSkill: (skillName: string) => ({ skillName }),
duplicateSkill: (skillName: string, newName: string) => ({ skillName, newName }),
+ publishToCommunity: (
+ skillName: string,
+ options: { display_name?: string; tags?: string[]; author_handle?: string }
+ ) => ({ skillName, options }),
+ publishToCommunitySuccess: (skillName: string) => ({ skillName }),
+ publishToCommunityFailure: (skillName: string) => ({ skillName }),
importSkill: (file: File) => ({ file }),
setImporting: (importing: boolean) => ({ importing }),
downloadSkillZip: (skillName: string) => ({ skillName }),
@@ -353,6 +400,15 @@ export const llmSkillsLogic = kea<llmSkillsLogicType>([
}),
},
],
+ // Per-skill publish-in-flight state so the trigger can guard against double-submission.
+ publishingSkills: [
+ {} as Record<string, boolean>,
+ {
+ publishToCommunity: (state, { skillName }) => ({ ...state, [skillName]: true }),
+ publishToCommunitySuccess: (state, { skillName }) => ({ ...state, [skillName]: false }),
+ publishToCommunityFailure: (state, { skillName }) => ({ ...state, [skillName]: false }),
+ },
+ ],
importing: [
false,
{
@@ -433,6 +489,20 @@ export const llmSkillsLogic = kea<llmSkillsLogicType>([
},
},
],
+ // Resolved GitHub handle for the current user — used to prefill the publish dialog's
+ // author_handle so the common case (GitHub-SSO'd users) is correct by default. Null when
+ // no GitHub identity is linked; the dialog field then falls back to free text.
+ githubLogin: [
+ null as string | null,
+ {
+ loadGithubLogin: async () => {
+ // `@me` resolves to the current user server-side, so this doesn't race userLogic
+ // loading the user object first.
+ const response = await usersGithubLoginRetrieve('@me')
+ return response.github_login ?? null
+ },
+ },
+ ],
})),
selectors({
@@ -563,6 +633,36 @@ export const llmSkillsLogic = kea<llmSkillsLogicType>([
}
},
+ publishToCommunity: async ({ skillName, options }) => {
+ try {
+ const result = await llmSkillsNamePublishCommunityCreate(
+ String(ApiConfig.getCurrentTeamId()),
+ skillName,
+ {
+ display_name: options.display_name,
+ tags: options.tags,
+ author_handle: options.author_handle,
+ }
+ )
+ lemonToast.success(
+ `Opened a community pull request for "${skillName}" — a maintainer will review it.`,
+ {
+ button: { label: 'View PR', action: () => window.open(result.pr_url, '_blank', 'noopener') },
+ }
+ )
+ actions.publishToCommunitySuccess(skillName)
+ } catch (e: any) {
+ console.error('Failed to publish skill to community', e)
+ const detail = e?.data?.detail || e?.detail
+ lemonToast.error(
+ e?.status === 503
+ ? 'Publishing to the community is not available on this instance yet.'
+ : detail || 'Failed to publish skill to the community'
+ )
+ actions.publishToCommunityFailure(skillName)
+ }
+ },
+
importSkill: async ({ file }) => {
actions.setImporting(true)
try {
@@ -679,5 +779,6 @@ export const llmSkillsLogic = kea<llmSkillsLogicType>([
afterMount(({ actions }) => {
actions.loadSkills()
+ actions.loadGithubLogin()
}),
])