: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
feat(skills): publish and install scouts through the community store (#94908)
posthog[bot]d306671336c1
diff --git a/docs/internal/skills/community-skills-api.md b/docs/internal/skills/community-skills-api.mdindex 32c9be4965b4..a5eb4f05ae6e 100644--- a/docs/internal/skills/community-skills-api.md+++ b/docs/internal/skills/community-skills-api.md@@ -5,6 +5,8 @@ through the [`PostHog/community-skills`](https://github.com/PostHog/community-skThe catalog is an **instance-global** read-model — it is not team-scoped — synced hourly from therepo'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](#entry-kinds).Viewset: `products/skills/backend/api/community_skills.py` (`CommunitySkillViewSet`).Route: registered in `products/skills/backend/routes.py` as `community_skills` under@@ -22,12 +24,13 @@ Route: registered in `products/skills/backend/routes.py` as `community_skills` u## 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}/vote/` | Toggle the requesting user's upvote. |+| 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@@ -40,8 +43,47 @@ default lookup regex (no `.` or `/`).| `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`@@ -68,7 +110,8 @@ trusting the sync:- The catalog row is locked and its `deleted` flag re-checked before copying, so a skill removed fromthe catalog mid-install can't be installed.-Errors surface as `400` (invalid payload / duplicate name) or `404` (unknown or removed slug).+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@@ -106,6 +149,11 @@ After a conflict, retrieve the skill again and require new consent before anothetakes) 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 pullrequest 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 passreview 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 itdiff --git a/frontend/src/lib/components/openPublishToCommunityDialog.tsx b/frontend/src/lib/components/openPublishToCommunityDialog.tsxnew file mode 100644index 000000000000..cdb5e7e5e59d--- /dev/null+++ b/frontend/src/lib/components/openPublishToCommunityDialog.tsx@@ -0,0 +1,96 @@+import { LemonDialog } from 'lib/lemon-ui/LemonDialog'+import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonInput } from 'lib/lemon-ui/LemonInput'++import { PublishToCommunityContents } from 'products/skills/frontend/PublishToCommunityContents'++export interface PublishToCommunityOptions {+ expected_skill_id: string+ expected_version: number+ expected_category: string+ display_name?: string+ tags?: string[]+ author_handle?: string+}++/** Collect the publish fields, then hand them to `onPublish`. Shared so the list view and the+ * single-skill view open the identical dialog. */+export function openPublishToCommunityDialog({+ skillName,+ githubLogin,+ isScout,+ teamId,+ onPublish,+}: {+ skillName: string+ githubLogin: string | null+ isScout?: boolean+ /**+ * Team the skill belongs to. The preview has to read the same team the publish writes to, or+ * consent describes a skill the request never sends. Unset means the current team.+ */+ teamId?: number+ onPublish: (skillName: string, options: PublishToCommunityOptions) => void+}): void {+ let expectedSkill: { id: string; version: number; category: string } | null = null++ LemonDialog.openForm({+ title: 'Publish to the PostHog community?',+ description: isScout+ ? "Publishing commits the scout's instructions, schedule, inbox setting, and tags to a public GitHub repository. It then opens a pull request. The contents are public when you submit them. Do not include credentials or internal details."+ : 'If approved for the PostHog catalog, all PostHog users can find and use this skill. Its contents will be public on GitHub immediately.',+ initialValues: {+ display_name: skillName.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 ?? '',+ consent: false,+ },+ content: (+ <div className="flex flex-col gap-2">+ <PublishToCommunityContents+ skillName={skillName}+ teamId={teamId}+ onPreviewChange={(preview) => {+ expectedSkill = preview+ ? { id: preview.id, version: preview.version, category: preview.category }+ : null+ }}+ />+ <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>+ ),+ errors: {+ consent: (consent: boolean) =>+ consent ? undefined : 'Review the skill and confirm that you can share it publicly',+ },+ primaryButtonProps: { children: 'Publish to community' },+ onSubmit: ({ display_name, tags, author_handle }) => {+ if (expectedSkill === null) {+ return+ }+ onPublish(skillName, {+ expected_skill_id: expectedSkill.id,+ expected_version: expectedSkill.version,+ expected_category: expectedSkill.category,+ display_name: display_name?.trim() || undefined,+ tags: tags+ ? tags+ .split(',')+ .map((t: string) => t.trim())+ .filter(Boolean)+ : undefined,+ author_handle: author_handle?.trim() || undefined,+ })+ },+ })+}diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsxindex 9f7e006e255d..4a4108a3cfa4 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutDetailHeader.tsx@@ -2,13 +2,19 @@ import { useActions, useValues } from 'kea'import { combineUrl } from 'kea-router'import { useEffect, useRef, useState } from 'react'-import { IconArrowLeft, IconExternal, IconRefresh } from '@posthog/icons'+import { IconArrowLeft, IconExternal, IconRefresh, IconUpload } from '@posthog/icons'import { LemonButton, LemonTag, Link, Tooltip } from '@posthog/lemon-ui'+import { openPublishToCommunityDialog } from 'lib/components/openPublishToCommunityDialog'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'import { pluralize } from 'lib/utils/strings'+import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'+import { userLogic } from 'scenes/userLogic'-import { ActivityScope } from '~/types'+import { AccessControlLevel, AccessControlResourceType, ActivityScope } from '~/types'import type { SignalScoutConfigApi as SignalScoutConfig } from 'products/signals/frontend/generated/api.schemas'@@ -103,11 +109,29 @@ export function ScoutDetailHeader({noteCount: numberlearnedCount: number}): JSX.Element {- const { updatingScoutIds, manualRunScoutIds } = useValues(scoutFleetLogic)- const { updateScoutConfig, runScoutNow } = useActions(scoutFleetLogic)+ const { updatingScoutIds, manualRunScoutIds, publishingScoutIds } = useValues(scoutFleetLogic)+ const { featureFlags } = useValues(featureFlagLogic)+ const { user } = useValues(userLogic)+ const { currentProjectId } = useValues(teamLogic)+ const { updateScoutConfig, runScoutNow, publishScoutToCommunity } = useActions(scoutFleetLogic)const updating = updatingScoutIds.includes(config.id)const running = manualRunScoutIds.includes(config.id)+ const publishing = publishingScoutIds.includes(config.id)+ const communitySkillsEnabled = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_COMMUNITY_SKILLS]+ const isOwner = !!user && (config.owners ?? []).some((owner) => owner.uuid === user.uuid)+ // A scout's skill is seeded on the canonical parent team, so both the consent preview and the+ // publish itself read that team rather than the child environment the page may be scoped to.+ const canonicalProjectId = typeof currentProjectId === 'number' ? currentProjectId : undefined+ // Ownership alone lets any project member through, but the publish endpoint needs skill editor+ // access — without this the owner fills in the whole dialog and the submit returns 403.+ const publishDisabledReason = publishing+ ? 'Opening a pull request'+ : (config.owners ?? []).length === 0+ ? 'Add an owner before publishing to the community'+ : !isOwner+ ? "Only the scout's owners can publish it"+ : getAccessControlDisabledReason(AccessControlResourceType.LlmSkill, AccessControlLevel.Editor)return (<div className="flex flex-col gap-2 border-b border-primary bg-surface-primary px-4 py-3">@@ -147,6 +171,30 @@ export function ScoutDetailHeader({</LemonButton></Tooltip><ScoutSettingsButton config={config} surface="scout_detail" showLabel />+ {communitySkillsEnabled && config.scout_origin !== 'canonical' && (+ <Tooltip title="Share this scout in the community store, so other projects can set it up with the same instructions and schedule.">+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconUpload />}+ loading={publishing}+ disabledReason={publishDisabledReason}+ onClick={() =>+ openPublishToCommunityDialog({+ skillName: config.skill_name,+ // The scout page doesn't load the skills logic that resolves a+ // linked GitHub identity, so the handle field starts empty here.+ githubLogin: null,+ isScout: true,+ teamId: canonicalProjectId,+ onPublish: (_skillName, options) => publishScoutToCommunity(config.id, options),+ })+ }+ >+ Publish+ </LemonButton>+ </Tooltip>+ )}{/* Captured on the way down: Link swallows Cmd/Ctrl-clicks before its onClick runs, andthose opens count too. */}<spandiff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.tsindex 1ad9c0fb4665..4d59c23c2cb1 100644--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.ts@@ -166,8 +166,11 @@ export function scoutCreateModalLogicKey(initialValues: ScoutCreateInitialValues// one. Keying on name alone then returns 'new' for that template, the same key the blank// create form uses, so their persisted drafts share one slot and each overwrites the other.// Key a name-less prefill by a stable hash of its content instead, so every opening context- // keeps its own draft. Hash the two fields apart so a description/body split cannot collide.- return `template-${hashCodeForString(description ?? '')}-${hashCodeForString(body ?? '')}`+ // keeps its own draft. Hash the fields apart so a description/body split cannot collide, and+ // include the config so a cadence the catalog has since changed opens fresh rather than+ // restoring the draft taken from the old one.+ const config = hashCodeForString(JSON.stringify(initialValues?.config ?? {}))+ return `template-${hashCodeForString(description ?? '')}-${hashCodeForString(body ?? '')}-${config}`}return 'new'}diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.tsindex fd7fb57efa55..9004391a5027 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts@@ -22,6 +22,7 @@ import {signalsScoutRunsTokenCosts,} from 'products/signals/frontend/generated/api'import type { ScoutCostsApi, SignalScoutConfigApi, UserBasicApi } from 'products/signals/frontend/generated/api.schemas'+import { llmSkillsNamePublishCommunityCreate } from 'products/skills/frontend/generated/api'import { SignalScoutRunSummary } from '../types'import { ScoutRosterSort, scoutFleetLogic } from './scoutFleetLogic'@@ -39,6 +40,10 @@ jest.mock('products/signals/frontend/generated/api', () => ({signalsScoutRunsRecentPerScout: jest.fn(),signalsScoutRunsTokenCosts: jest.fn(),}))+jest.mock('products/skills/frontend/generated/api', () => ({+ llmSkillsNameArchiveCreate: jest.fn(),+ llmSkillsNamePublishCommunityCreate: jest.fn(),+}))const mockSignalsScoutChatTasksCreate = signalsScoutChatTasksCreate as jest.MockedFunction<typeof signalsScoutChatTasksCreate@@ -53,6 +58,9 @@ const mockSignalsScoutRunsTokenCosts = signalsScoutRunsTokenCosts as jest.Mockedtypeof signalsScoutRunsTokenCosts>const mockSignalsScoutRunsCosts = signalsScoutRunsCosts as jest.MockedFunction<typeof signalsScoutRunsCosts>+const mockPublishCommunity = llmSkillsNamePublishCommunityCreate as jest.MockedFunction<+ typeof llmSkillsNamePublishCommunityCreate+>const BASE_CONFIG: SignalScoutConfigApi = {id: 'config-1',@@ -140,6 +148,11 @@ describe('scoutFleetLogic', () => {mockSignalsScoutRunsRecentPerScout.mockReset().mockResolvedValue([])mockSignalsScoutRunsTokenCosts.mockReset().mockResolvedValue({ costs: [], available: true })mockSignalsScoutRunsCosts.mockReset().mockResolvedValue({ window_days: 7, scouts: [], available: true })+ mockPublishCommunity.mockReset().mockResolvedValue({+ pr_url: 'https://github.com/PostHog/community-skills/pull/1',+ pr_number: 1,+ branch: 'community-skill/signals-scout-errors',+ })logic = scoutFleetLogic()logic.mount()await expectLogic(logic).toFinishAllListeners()@@ -188,6 +201,25 @@ describe('scoutFleetLogic', () => {expect(logic.values.updatingScoutIds).toEqual([])})+ it('publishes a scout against its canonical project and preserves its tags', async () => {+ const config = { ...BASE_CONFIG, scout_origin: 'custom' as const, tags: ['errors'] }+ logic.actions.loadScoutConfigsSuccess([config])++ const reviewedSkill = { expected_skill_id: 'skill-1', expected_version: 3, expected_category: 'scout' }+ logic.actions.publishScoutToCommunity(config.id, reviewedSkill)+ await expectLogic(logic).toDispatchActions(['publishScoutToCommunityFinished'])++ expect(mockPublishCommunity).toHaveBeenCalledWith(+ String(teamLogic.values.currentProjectId),+ config.skill_name,+ expect.objectContaining({+ ...reviewedSkill,+ tags: ['errors'],+ scout_config: expect.objectContaining({ tags: ['errors'] }),+ })+ )+ })+// The roster is the only consumer of the tag filter, so assert through the rows it renders.const rosterConfigIds = (): string[] => logic.values.rosterScouts.map((row) => row.config.id)diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.tsindex 1e1c7c0c02e8..d52cbdea2095 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.ts@@ -46,7 +46,8 @@ import type {ScoutMetadataApi,SignalScoutConfigApi,} from 'products/signals/frontend/generated/api.schemas'-import { llmSkillsNameArchiveCreate } from 'products/skills/frontend/generated/api'+import { llmSkillsNameArchiveCreate, llmSkillsNamePublishCommunityCreate } from 'products/skills/frontend/generated/api'+import type { CommunitySkillScoutConfigApi } from 'products/skills/frontend/generated/api.schemas'import {captureScoutAction,@@ -288,6 +289,32 @@ function reuseScoutCostsIfUnchanged(previous: ScoutCostsApi | null, next: ScoutCreturn unchanged ? previous : next}+/** What the publisher fills in. The scout's own settings are read from its config, not typed. */+export interface PublishScoutOptions {+ expected_skill_id: string+ expected_version: number+ expected_category: string+ display_name?: string+ tags?: string[]+ author_handle?: string+}++/**+ * The settings a published scout travels with, so it lands in another project on the same cadence+ * rather than as instructions somebody has to reschedule by hand. Deliberately not the whole config:+ * `network_access`, `model` and `mcp_gateway_server_ids` reach into this project's data and+ * services, and the catalog refuses them.+ */+function shareableScoutConfig(config: SignalScoutConfig): CommunitySkillScoutConfigApi {+ return {+ ...(config.run_cron_schedule+ ? { run_cron_schedule: config.run_cron_schedule }+ : { run_interval_minutes: config.run_interval_minutes }),+ emit: config.emit,+ ...(config.tags?.length ? { tags: config.tags } : {}),+ }+}+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface scoutFleetLogicValues {dataProcessingAccepted: boolean // aiConsentLogic@@ -318,6 +345,7 @@ export interface scoutFleetLogicValues {pausingSoon: numberrecentlyPaused: number}+ publishingScoutIds: string[]rollups: Map<string, ScoutRollup>rosterEvaluatedAt: numberrosterGroupCounts: Record<ScoutGroupKey, number>@@ -504,6 +532,16 @@ export interface scoutFleetLogicActions {configId: stringupdates: Partial<SignalScoutConfigApi> | PatchedSignalScoutConfigUpdateApi}+ publishScoutToCommunity: (+ configId: string,+ options: PublishScoutOptions+ ) => {+ configId: string+ options: PublishScoutOptions+ }+ publishScoutToCommunityFinished: (configId: string) => {+ configId: string+ }removeScoutConfigLocally: (configId: string) => {configId: string}@@ -705,6 +743,8 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([}),runScoutNow: (configId: string) => ({ configId }),runScoutNowFinished: (configId: string) => ({ configId }),+ publishScoutToCommunity: (configId: string, options: PublishScoutOptions) => ({ configId, options }),+ publishScoutToCommunityFinished: (configId: string) => ({ configId }),// Started/stopped by the fleet-list component so the always-mounted setup widget// (which only reads configs) doesn't trigger the paginated runs-window polling.startRunsPolling: true,@@ -1142,6 +1182,14 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([runScoutNowFinished: (state, { configId }) => state.filter((id) => id !== configId),},],+ publishingScoutIds: [+ [] as string[],+ {+ publishScoutToCommunity: (state, { configId }) =>+ state.includes(configId) ? state : [...state, configId],+ publishScoutToCommunityFinished: (state, { configId }) => state.filter((id) => id !== configId),+ },+ ],// Flips true the first time the runs window loads *successfully* and stays true across the// 60s polls. Consumers (e.g. the scout detail Signals section) use it to tell "not loaded// yet" from "loaded, genuinely empty" without flickering a skeleton on polls. Deliberately@@ -1526,6 +1574,35 @@ export const scoutFleetLogic = kea<scoutFleetLogicType>([actions.runScoutNowFinished(configId)}},+ // Publishing goes through the skills endpoint because that owns the community repo. It reads+ // the scout's cadence, emit posture and tags off its config, so the published scout carries+ // the settings the person publishing it can already see here.+ publishScoutToCommunity: async ({ configId, options }) => {+ const teamId = teamLogic.values.currentProjectId+ const config = values.scoutConfigs?.find((candidate) => candidate.id === configId)+ if (!teamId || !config) {+ actions.publishScoutToCommunityFinished(configId)+ return+ }+ try {+ const result = await llmSkillsNamePublishCommunityCreate(String(teamId), config.skill_name, {+ ...options,+ tags: options.tags ?? config.tags,+ scout_config: shareableScoutConfig(config),+ })+ lemonToast.success('Opened a community pull request. A maintainer will review it.', {+ button: { label: 'View PR', action: () => window.open(result.pr_url, '_blank', 'noopener') },+ })+ } catch (error: any) {+ lemonToast.error(+ error?.status === 503+ ? 'Publishing to the community is not available on this instance yet.'+ : error?.detail || error?.message || 'Could not publish this scout'+ )+ } finally {+ actions.publishScoutToCommunityFinished(configId)+ }+ },updateScoutConfig: async ({ configId, updates }) => {const inFlight: Set<string> = (cache.updatingScoutIds ??= new Set())const pendingUpdates: Map<string, SignalScoutConfigUpdate> = (cache.pendingScoutConfigUpdates ??= new Map())diff --git a/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.test.ts b/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.test.tsindex 211f75651a94..df0d5910e756 100644--- a/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.test.ts+++ b/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.test.ts@@ -1,8 +1,25 @@import { SKILL_DESCRIPTION_MAX_LENGTH } from 'products/skills/frontend/skillConstants'-import { decodeScoutCreateTemplate, encodeScoutCreateTemplate } from './scoutTemplateDeepLink'+import {+ decodeScoutCreateTemplate,+ encodeScoutCreateTemplate,+ storeCommunityScoutCreateTemplate,+} from './scoutTemplateDeepLink'describe('scoutTemplateDeepLink', () => {+ it('moves a large community draft outside the URL and disconnects MCP servers', () => {+ const body = 'x'.repeat(50_000)+ const key = storeCommunityScoutCreateTemplate({ description: 'Large scout', body })++ expect(key.length).toBeLessThan(100)+ expect(decodeScoutCreateTemplate(key)).toEqual({+ description: 'Large scout',+ body,+ config: { mcp_gateway_server_ids: [] },+ })+ expect(decodeScoutCreateTemplate(key)).toBeNull()+ })+it('round-trips a full template', () => {const encoded = encodeScoutCreateTemplate({name: 'signals-scout-silent-failure',@@ -38,13 +55,46 @@ describe('scoutTemplateDeepLink', () => {expect(decodeScoutCreateTemplate(encoded)?.description).toHaveLength(SKILL_DESCRIPTION_MAX_LENGTH)})- it('ignores config and unknown fields — scheduling is never URL-controlled', () => {+ it('carries the settings the modal shows', () => {const encoded = encodeScoutCreateTemplate({description: 'd',- // @ts-expect-error deliberately smuggling extra fields- config: { enabled: true, emit: true, run_interval_minutes: 30 },- extra: 'nope',+ config: { run_interval_minutes: 720, emit: false, tags: ['Web Analytics', 'web analytics'] },})+ expect(decodeScoutCreateTemplate(encoded)).toEqual({+ description: 'd',+ config: { run_interval_minutes: 720, emit: false, tags: ['web-analytics'] },+ })+ })++ it.each([+ ['a setting the modal never shows', { network_access: 'full', model: 'claude', enabled: false }],+ ['an out-of-range interval', { run_interval_minutes: 5 }],+ ['an interval past the 30-day cap', { run_interval_minutes: 43201 }],+ ['a cron expression with the wrong field count', { run_cron_schedule: '0 9 * *' }],+ // Five fields alone is not enough: the create endpoint refuses both of these on submit.+ ['a cron that runs more often than the cadence floor', { run_cron_schedule: '* * * * *' }],+ ['a cron that never matches a real date', { run_cron_schedule: '0 0 31 2 *' }],+ ['a non-boolean emit', { emit: 'yes' }],+ ['a non-array tags value', { tags: 'web-analytics' }],+ ])('drops %s', (_label, config) => {+ // @ts-expect-error deliberately smuggling values the payload type doesn't allow+ const encoded = encodeScoutCreateTemplate({ description: 'd', config })+ expect(decodeScoutCreateTemplate(encoded)).toEqual({ description: 'd' })+ })++ it('keeps a valid cron expression', () => {+ const encoded = encodeScoutCreateTemplate({ description: 'd', config: { run_cron_schedule: '0 9 * * 1' } })+ expect(decodeScoutCreateTemplate(encoded)?.config).toEqual({ run_cron_schedule: '0 9 * * 1' })+ })++ it('carries a display name so the created scout keeps the name the store showed', () => {+ const encoded = encodeScoutCreateTemplate({ display_name: 'Feed scout', description: 'd' })+ expect(decodeScoutCreateTemplate(encoded)).toEqual({ display_name: 'Feed scout', description: 'd' })+ })++ it('ignores unknown top-level fields', () => {+ // @ts-expect-error deliberately smuggling an extra field+ const encoded = encodeScoutCreateTemplate({ description: 'd', extra: 'nope' })expect(decodeScoutCreateTemplate(encoded)).toEqual({ description: 'd' })})diff --git a/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.ts b/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.tsindex b6ba42366e2f..cd1c769232cf 100644--- a/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.ts+++ b/products/signals/frontend/inbox/utils/scoutTemplateDeepLink.ts@@ -1,67 +1,173 @@+import { v4 as uuidv4 } from 'uuid'+import { base64Decode, base64Encode } from 'lib/utils/base64'import { SKILL_DESCRIPTION_MAX_LENGTH, validateSkillName } from 'products/skills/frontend/skillConstants'import type { ScoutCreateInitialValues } from '../logics/scoutCreateModalLogic'+import { MAX_SCOUT_DISPLAY_NAME_LENGTH, scoutCronScheduleError } from './scoutRunsWindow'+import { MAX_SCOUT_TAGS, normalizeScoutTags } from './scoutTags'/**- * `/inbox/config#createScout=<url-safe base64 JSON>`, e.g. from a posthog.com template page.- * In the fragment so it never reaches server logs, and prefill-only: no schedule, no emit posture.+ * `/inbox/config#createScout=<url-safe base64 JSON>`, e.g. from a posthog.com template page or the+ * community skills store. In the fragment so it never reaches server logs, and prefill-only: the+ * modal opens with these values and a person still submits it.*/export interface ScoutTemplatePayload {name?: string+ display_name?: stringdescription?: stringbody?: string+ config?: ScoutTemplateConfig+}++/**+ * The settings a template may prefill: exactly the ones the create modal shows, so nothing a link+ * sets is hidden from the person submitting it. `network_access`, `model` and+ * `mcp_gateway_server_ids` reach into a project's data and services and never come from a link.+ */+export interface ScoutTemplateConfig {+ run_interval_minutes?: number+ run_cron_schedule?: string | null+ emit?: boolean+ tags?: string[]}/** Whole-payload cap, before decoding. Far above any real template, far below abuse territory. */const MAX_ENCODED_LENGTH = 16384const MAX_BODY_LENGTH = 20000+const STORED_TEMPLATE_PREFIX = 'stored:'+// Pinned storage key: a rename can strand a draft during navigation.+const STORED_TEMPLATE_KEY_PREFIX = 'posthog.scout-create-template.'+/** Matches the bounds the create form and the API hold a scout's cadence to. */+const MIN_RUN_INTERVAL_MINUTES = 30+const MAX_RUN_INTERVAL_MINUTES = 43200/** Encode a template as a URL-safe base64 fragment value (used by tests and by link authors). */export function encodeScoutCreateTemplate(template: ScoutTemplatePayload): string {return base64Encode(JSON.stringify(template)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')}-/** Decodes a `#createScout=` value into modal initial values. Null means ignore the fragment. */-export function decodeScoutCreateTemplate(raw: unknown): ScoutCreateInitialValues | null {- if (typeof raw !== 'string' || raw.length === 0 || raw.length > MAX_ENCODED_LENGTH) {+/** Store a rendered community scout for one navigation. The URL carries only the random key. */+export function storeCommunityScoutCreateTemplate(template: ScoutTemplatePayload): string {+ const id = uuidv4()+ sessionStorage.setItem(`${STORED_TEMPLATE_KEY_PREFIX}${id}`, JSON.stringify(template))+ return `${STORED_TEMPLATE_PREFIX}${id}`+}++/** `{ key: value }` when the cleaner kept the value, and nothing when it dropped it. */+function defined<K extends string, V>(key: K, value: V | undefined): Partial<Record<K, V>> {+ return value === undefined ? {} : ({ [key]: value } as Record<K, V>)+}++/** The cadence, or undefined when the link gave none the create form would accept. */+function cleanInterval(value: unknown): number | undefined {+ if (typeof value !== 'number' || !Number.isInteger(value)) {+ return undefined+ }+ return value >= MIN_RUN_INTERVAL_MINUTES && value <= MAX_RUN_INTERVAL_MINUTES ? value : undefined+}++function cleanCron(value: unknown): string | undefined {+ if (typeof value !== 'string') {+ return undefined+ }+ const schedule = value.trim()+ // The field count alone lets through expressions the create endpoint refuses, such as one that+ // never matches a real date or runs more often than every 30 minutes. Dropping those here opens+ // the form on its own default instead of one that fails the moment it is submitted.+ return scoutCronScheduleError(schedule) === null ? schedule : undefined+}++function cleanTags(value: unknown): string[] | undefined {+ if (!Array.isArray(value) || !value.every((tag) => typeof tag === 'string')) {+ return undefined+ }+ // Normalized here rather than trusted: the tag editor writes normalized tags, so an+ // unnormalized one from a link would be an entry the user cannot reproduce by typing it.+ const tags = normalizeScoutTags(value as string[]).slice(0, MAX_SCOUT_TAGS)+ return tags.length > 0 ? tags : undefined+}++/** Keep the prefillable settings, dropping any field that isn't one or isn't in range. */+function cleanConfig(raw: unknown): ScoutTemplateConfig | null {+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {return null}+ const { run_interval_minutes, run_cron_schedule, emit, tags } = raw as Record<string, unknown>+ const config: ScoutTemplateConfig = {+ ...defined('run_interval_minutes', cleanInterval(run_interval_minutes)),+ ...defined('run_cron_schedule', cleanCron(run_cron_schedule)),+ ...defined('emit', typeof emit === 'boolean' ? emit : undefined),+ ...defined('tags', cleanTags(tags)),+ }+ return Object.keys(config).length > 0 ? config : null+}++/** The skill name a link asked for, prefixed if it needs it, or empty when it isn't usable. */+function cleanScoutName(value: unknown): string {+ const name = typeof value === 'string' ? value.trim() : ''+ if (!name) {+ return ''+ }+ return validateSkillName(name) ? '' : name+}+/** The decoded payload object, or null when the value isn't one. */+function parsePayload(raw: unknown): { payload: Record<string, unknown>; stored: boolean } | null {+ if (typeof raw !== 'string' || raw.length === 0 || raw.length > MAX_ENCODED_LENGTH) {+ return null+ }let parsed: unknowntry {- // Accept both base64 alphabets and missing padding, like the desktop deep-link decoder.- const normalized = raw.replace(/-/g, '+').replace(/_/g, '/')- const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4)- parsed = JSON.parse(base64Decode(padded))+ if (raw.startsWith(STORED_TEMPLATE_PREFIX)) {+ const id = raw.slice(STORED_TEMPLATE_PREFIX.length)+ const key = `${STORED_TEMPLATE_KEY_PREFIX}${id}`+ const value = sessionStorage.getItem(key)+ sessionStorage.removeItem(key)+ parsed = value ? JSON.parse(value) : null+ } else {+ // Accept both base64 alphabets and missing padding, like the desktop deep-link decoder.+ const normalized = raw.replace(/-/g, '+').replace(/_/g, '/')+ const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4)+ parsed = JSON.parse(base64Decode(padded))+ }} catch {return null}-if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {return null}+ return { payload: parsed as Record<string, unknown>, stored: raw.startsWith(STORED_TEMPLATE_PREFIX) }+}- const { name, description, body } = parsed as Record<string, unknown>+/** Decodes a `#createScout=` value into modal initial values. Null means ignore the fragment. */+export function decodeScoutCreateTemplate(raw: unknown): ScoutCreateInitialValues | null {+ const parsedResult = parsePayload(raw)+ if (!parsedResult) {+ return null+ }++ const { payload: parsed, stored } = parsedResult+ const { name, display_name: displayName, description, body, config } = parsed+ const cleanDisplayName =+ typeof displayName === 'string' ? displayName.trim().slice(0, MAX_SCOUT_DISPLAY_NAME_LENGTH) : ''const cleanDescription =typeof description === 'string' ? description.trim().slice(0, SKILL_DESCRIPTION_MAX_LENGTH) : ''- const cleanBody = typeof body === 'string' ? body.trim().slice(0, MAX_BODY_LENGTH) : ''+ const cleanBody = typeof body === 'string' ? (stored ? body : body.trim().slice(0, MAX_BODY_LENGTH)) : ''+ const templateConfig = cleanConfig(config)+ const initialConfig = stored ? { ...templateConfig, mcp_gateway_server_ids: [] } : templateConfig// A link that prefills nothing but a name is indistinguishable from noise — require substance.- if (!cleanDescription && !cleanBody) {+ if (!cleanDescription && !cleanBody.trim()) {return null}- let cleanName = typeof name === 'string' ? name.trim() : ''- if (cleanName && validateSkillName(cleanName)) {- // Invalid name: drop it so the form opens with an empty name rather than the link failing.- cleanName = ''- }-return {- ...(cleanName ? { name: cleanName } : {}),- ...(cleanDescription ? { description: cleanDescription } : {}),- ...(cleanBody ? { body: cleanBody } : {}),+ ...defined('name', cleanScoutName(name) || undefined),+ ...defined('display_name', cleanDisplayName || undefined),+ ...defined('description', cleanDescription || undefined),+ ...defined('body', cleanBody || undefined),+ ...defined('config', initialConfig ?? undefined),}}diff --git a/products/skills/backend/api/community_publish_services.py b/products/skills/backend/api/community_publish_services.pyindex 1c430e75717a..93653038103b 100644--- a/products/skills/backend/api/community_publish_services.py+++ b/products/skills/backend/api/community_publish_services.py@@ -26,6 +26,8 @@ from posthog.models.github_integration_base import GitHubIntegrationErrorfrom posthog.models.integration import GitHubIntegration, Integrationfrom ..marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTH+from ..models.community_skills import CommunitySkillKind+from .community_scout_config import validate_shareable_scout_configfrom .skill_services import (MAX_SKILL_BODY_BYTES,MAX_SKILL_FILE_BYTES,@@ -172,6 +174,24 @@ def _validate_allowed_tool(tool: object) -> None:raise CommunitySkillPublishValidationError(f"'{tool}' can't be published as a tool name. {err}") from err+def _publishable_scout_config(*, kind: str, scout_config: dict[str, Any] | None) -> dict[str, Any]:+ """Hold a publish to the same kind/scout_config rules ingest applies to a registry entry.++ Publishing something ingest then rejects is the worst outcome available here: the pull request+ merges, and the skill silently never appears in the catalog.+ """+ if kind not in set(CommunitySkillKind.values):+ raise CommunitySkillPublishValidationError(f"'{kind}' is not a publishable kind.")+ if kind != CommunitySkillKind.SCOUT.value:+ if scout_config:+ raise CommunitySkillPublishValidationError("Only a scout can be published with scout settings.")+ return {}+ try:+ return validate_shareable_scout_config(scout_config)+ except ValueError as err:+ raise CommunitySkillPublishValidationError(str(err)) from err++def _validate_skill_markdown(*, name: str, description: str, body: str, author_handle: str, allowed_tools: list[str] | None) -> None:@@ -252,6 +272,8 @@ def render_skill_md(compatibility: str = "",author_handle: str = "",metadata: dict[str, Any] | None = None,+ kind: str = CommunitySkillKind.SKILL.value,+ scout_config: dict[str, Any] | None = None,) -> str:"""Render an LLMSkill's fields into community-skills `SKILL.md` content (frontmatter + body).@@ -272,6 +294,10 @@ def render_skill_md("description": description.strip(),"trust_tier": "community",}+ published_scout_config = _publishable_scout_config(kind=kind, scout_config=scout_config)+ if kind != CommunitySkillKind.SKILL.value:+ frontmatter["kind"] = kind+ frontmatter["scout_config"] = published_scout_configfrontmatter.update(_optional_skill_frontmatter(tags=tags,@@ -305,6 +331,8 @@ def render_community_skill_files(compatibility: str = "",author_handle: str = "",metadata: dict[str, Any] | None = None,+ kind: str = CommunitySkillKind.SKILL.value,+ scout_config: dict[str, Any] | None = None,) -> list[RenderedFile]:"""Render the full set of files to commit for a skill: SKILL.md plus any bundled files.@@ -312,6 +340,13 @@ def render_community_skill_files(`references/playbook.md` becomes `skills/<slug>/references/playbook.md`)."""_validate_slug(slug)+ # The store hands a scout to the scout-create form, which takes instructions but no bundled+ # files, so ingest refuses a scout that ships them. Say so before opening a pull request that+ # would merge and then leave the scout missing from the catalog.+ if kind == CommunitySkillKind.SCOUT.value and files:+ raise CommunitySkillPublishValidationError(+ "A scout can't be published with bundled files. Move what they hold into its instructions."+ )_validate_entry_caps(body=body, files=files or [])# Only a template reads `{{ }}` as placeholders. A plain skill keeps that text verbatim, the way# install does, so a skill quoting GitHub Actions or Go template syntax still publishes.@@ -336,6 +371,8 @@ def render_community_skill_files(compatibility=compatibility,author_handle=author_handle,metadata=metadata,+ kind=kind,+ scout_config=scout_config,),)]@@ -617,6 +654,8 @@ def publish_skill_to_community(compatibility: str = "",author_handle: str = "",metadata: dict[str, Any] | None = None,+ kind: str = CommunitySkillKind.SKILL.value,+ scout_config: dict[str, Any] | None = None,) -> dict[str, Any]:"""Open a PR in PostHog/community-skills adding (or updating) this skill. Returns the PR url/number.@@ -649,6 +688,8 @@ def publish_skill_to_community(compatibility=compatibility,author_handle=author_handle,metadata=metadata,+ kind=kind,+ scout_config=scout_config,)publisher = get_community_skills_publisher()diff --git a/products/skills/backend/api/community_scout_config.py b/products/skills/backend/api/community_scout_config.pynew file mode 100644index 000000000000..24cc6e681e46--- /dev/null+++ b/products/skills/backend/api/community_scout_config.py@@ -0,0 +1,152 @@+"""The scout settings a published scout is allowed to travel with.++A catalog entry never creates a `SignalScoutConfig`: the store hands a scout to the Signals+scout-create form, which is where a person reviews the settings and submits them. So this holds the+payload to the few fields that form actually shows — cadence, emit posture and tags — and drops+everything else. `network_access`, `model` and `mcp_gateway_server_ids` grant a scout reach into a+team's data and services, and nothing a contributor publishes should be able to preselect them.++The bounds below are local copies of the ones Signals enforces on its own config, the way+`skills.models` keeps a local copy of the scout name prefix: `products.signals` already depends on+`products.skills`, so the reverse import would be a cycle. They are a shape check for a prefill,+not the authority — Signals validates the settings again when the form is submitted.+"""++import re+from collections.abc import Callable+from datetime import UTC, datetime+from typing import Any++from croniter import CroniterError, croniter++# Signals holds a scout's cadence between 30 minutes and 30 days.+MIN_RUN_INTERVAL_MINUTES = 30+MAX_RUN_INTERVAL_MINUTES = 43200+MAX_CRON_SCHEDULE_LENGTH = 100+CRON_FIELD_COUNT = 5+CRON_MIN_GAP_SECONDS = MIN_RUN_INTERVAL_MINUTES * 60+CRON_SAMPLE_OCCURRENCES = 100+MAX_TAGS = 10+MAX_TAG_LENGTH = 50++# Local copies of the slug rules in `signals.scout_harness.tags`, for the same reason the bounds+# above are local. A tag is stored as a lowercase kebab-case slug, so the catalog has to accept only+# what survives that normalization — otherwise a published `"!!!"` syncs, and the setup form then+# drops it without saying so while the Signals create path would have refused it outright.+_TAG_SEPARATORS = re.compile(r"[\s_]+")+_TAG_INVALID_CHARS = re.compile(r"[^a-z0-9-]+")+_TAG_HYPHEN_RUNS = re.compile(r"-{2,}")+++def _slugify_tag(raw: str) -> str:+ slug = _TAG_SEPARATORS.sub("-", raw.strip().lower())+ slug = _TAG_INVALID_CHARS.sub("", slug)+ return _TAG_HYPHEN_RUNS.sub("-", slug).strip("-")+++def _validate_run_interval_minutes(value: Any) -> int | None:+ # bool is an int subclass, and `True` would otherwise pass as a 1-minute cadence.+ if isinstance(value, bool) or not isinstance(value, int):+ raise ValueError("scout_config.run_interval_minutes must be an integer")+ if not MIN_RUN_INTERVAL_MINUTES <= value <= MAX_RUN_INTERVAL_MINUTES:+ raise ValueError(+ f"scout_config.run_interval_minutes must be between {MIN_RUN_INTERVAL_MINUTES} "+ f"and {MAX_RUN_INTERVAL_MINUTES}"+ )+ return value+++def _validate_run_cron_schedule(value: Any) -> str | None:+ if value is None:+ return None+ if not isinstance(value, str):+ raise ValueError("scout_config.run_cron_schedule must be a string or null")+ schedule = value.strip()+ if not schedule:+ return None+ if len(schedule) > MAX_CRON_SCHEDULE_LENGTH:+ raise ValueError(f"scout_config.run_cron_schedule must be {MAX_CRON_SCHEDULE_LENGTH} characters or fewer")+ if len(schedule.split()) != CRON_FIELD_COUNT or not croniter.is_valid(schedule):+ raise ValueError("scout_config.run_cron_schedule must be a valid five-field cron expression")+ iterator = croniter(schedule, datetime(2026, 1, 1, tzinfo=UTC))+ try:+ occurrences = [iterator.get_next(datetime) for _ in range(CRON_SAMPLE_OCCURRENCES)]+ except CroniterError as error:+ raise ValueError("scout_config.run_cron_schedule must match a real date") from error+ min_gap = min((later - earlier).total_seconds() for earlier, later in zip(occurrences, occurrences[1:]))+ if min_gap < CRON_MIN_GAP_SECONDS:+ raise ValueError(+ f"scout_config.run_cron_schedule must schedule runs at least {MIN_RUN_INTERVAL_MINUTES} minutes apart"+ )+ return schedule+++def _validate_emit(value: Any) -> bool | None:+ if not isinstance(value, bool):+ raise ValueError("scout_config.emit must be a boolean")+ return value+++def _validate_tags(value: Any) -> list[str] | None:+ """Return the tags in the stored slug form, so every accepted tag round-trips into the scout.++ Measured on the slug rather than the raw string: what lands on the config is what the caps are+ about, and a tag that normalizes to nothing is an error rather than a silent drop.+ """+ if not isinstance(value, list) or not all(isinstance(tag, str) for tag in value):+ raise ValueError("scout_config.tags must be a list of strings")+ normalized: set[str] = set()+ for raw in value:+ tag = _slugify_tag(raw)+ if not tag:+ raise ValueError(f"scout_config tag {raw!r} is empty once normalized to a lowercase slug")+ if len(tag) > MAX_TAG_LENGTH:+ raise ValueError(f"each scout_config tag must be {MAX_TAG_LENGTH} characters or fewer")+ normalized.add(tag)+ if not normalized:+ return None+ if len(normalized) > MAX_TAGS:+ raise ValueError(f"scout_config.tags must have {MAX_TAGS} tags or fewer")+ return sorted(normalized)+++# Each validator returns the value to keep, or None to leave the field out so the scout-create form+# falls back to its own default.+_VALIDATORS: dict[str, Callable[[Any], Any]] = {+ "run_interval_minutes": _validate_run_interval_minutes,+ "run_cron_schedule": _validate_run_cron_schedule,+ "emit": _validate_emit,+ "tags": _validate_tags,+}++SHAREABLE_SCOUT_CONFIG_KEYS = frozenset(_VALIDATORS)+++def validate_shareable_scout_config(raw: Any) -> dict[str, Any]:+ """Return the shareable subset of a published scout's settings, or raise ValueError.++ Absent and null both mean "no settings", which is a scout that arrives on the create form's+ defaults. An unknown key is rejected rather than dropped: a contributor who wrote+ `network_access: full` should be told the store will not carry it, not have it silently ignored+ and believe their scout ships with it.+ """+ if raw is None:+ return {}+ if not isinstance(raw, dict):+ raise ValueError("scout_config must be an object")++ unknown = sorted(set(raw) - SHAREABLE_SCOUT_CONFIG_KEYS)+ if unknown:+ raise ValueError(+ f"scout_config cannot carry {', '.join(unknown)} — only "+ f"{', '.join(sorted(SHAREABLE_SCOUT_CONFIG_KEYS))} travel with a published scout"+ )++ config: dict[str, Any] = {}+ for key, validate in _VALIDATORS.items():+ if key not in raw:+ continue+ value = validate(raw[key])+ if value is not None:+ config[key] = value+ return configdiff --git a/products/skills/backend/api/community_skill_serializers.py b/products/skills/backend/api/community_skill_serializers.pyindex 194d45339e7e..a3e7ddf714f5 100644--- a/products/skills/backend/api/community_skill_serializers.py+++ b/products/skills/backend/api/community_skill_serializers.py@@ -3,7 +3,14 @@ from typing import Anyfrom drf_spectacular.utils import extend_schema_fieldfrom rest_framework import serializers-from ..models.community_skills import CommunitySkill, CommunitySkillFile, CommunitySkillTrustTier+from ..models.community_skills import CommunitySkill, CommunitySkillFile, CommunitySkillKind, CommunitySkillTrustTier+from .community_scout_config import (+ MAX_CRON_SCHEDULE_LENGTH,+ MAX_RUN_INTERVAL_MINUTES,+ MAX_TAG_LENGTH,+ MAX_TAGS,+ MIN_RUN_INTERVAL_MINUTES,+)from .skill_template_services import parse_template_variablesALLOWED_LIST_ORDERINGS = frozenset(@@ -22,6 +29,40 @@ ALLOWED_LIST_ORDERINGS = frozenset()+class CommunitySkillScoutConfigSerializer(serializers.Serializer):+ """The scout settings a published scout travels with. Every field is optional. An omitted field+ means the scout-create form's own default applies."""++ run_interval_minutes = serializers.IntegerField(+ required=False,+ min_value=MIN_RUN_INTERVAL_MINUTES,+ max_value=MAX_RUN_INTERVAL_MINUTES,+ help_text="How often the scout runs, in minutes. Ignored when run_cron_schedule is set.",+ )+ run_cron_schedule = serializers.CharField(+ required=False,+ max_length=MAX_CRON_SCHEDULE_LENGTH,+ help_text="Five-field cron expression for the scout's schedule, which takes precedence over the interval.",+ )+ emit = serializers.BooleanField(+ required=False,+ help_text="Whether the scout writes its reports to the inbox. False means it runs as a dry run.",+ )+ tags = serializers.ListField(+ child=serializers.CharField(max_length=MAX_TAG_LENGTH),+ required=False,+ max_length=MAX_TAGS,+ help_text="Tags used to group the scout in the fleet.",+ )++ def to_internal_value(self, data: Any) -> dict[str, Any]:+ if isinstance(data, dict):+ unknown = sorted(set(data) - set(self.fields))+ if unknown:+ raise serializers.ValidationError(dict.fromkeys(unknown, "This scout setting is not supported."))+ return super().to_internal_value(data)++class CommunitySkillTemplateVariableSerializer(serializers.Serializer):"""One declared variable of a templated skill — the schema a client renders a form from."""@@ -74,6 +115,16 @@ class CommunitySkillSerializer(serializers.ModelSerializer):choices=CommunitySkillTrustTier.choices,help_text="Moderation tier: 'official' (PostHog-authored), 'verified' (reviewed), or 'community'.",)+ kind = serializers.ChoiceField(+ choices=CommunitySkillKind.choices,+ help_text=(+ "'skill' installs into the project as a regular skill. 'scout' runs on a schedule, so it is set up "+ "through the scout form instead of being installed."+ ),+ )+ scout_config = CommunitySkillScoutConfigSerializer(+ help_text="Schedule, emit posture and tags a scout travels with. Empty object for a skill.",+ )files = serializers.SerializerMethodField(help_text="Bundled files manifest — path and content_type only. File contents are copied in on install.",)@@ -104,6 +155,8 @@ class CommunitySkillSerializer(serializers.ModelSerializer):"metadata","tags","trust_tier",+ "kind",+ "scout_config","author_handle","github_url","files",@@ -175,6 +228,11 @@ class CommunitySkillListQuerySerializer(serializers.Serializer):required=False,help_text="Filter to a single moderation tier.",)+ kind = serializers.ChoiceField(+ choices=CommunitySkillKind.choices,+ required=False,+ help_text="Filter to skills or to scouts. Omit to return both.",+ )order_by = serializers.ChoiceField(choices=sorted(ALLOWED_LIST_ORDERINGS),required=False,@@ -205,3 +263,37 @@ class CommunitySkillInstallSerializer(serializers.Serializer):class CommunitySkillVoteResponseSerializer(serializers.Serializer):vote_count = serializers.IntegerField(help_text="Total upvotes after applying the toggle.")has_voted = serializers.BooleanField(help_text="Whether the requesting user is now an upvoter.")+++class CommunitySkillRenderSerializer(serializers.Serializer):+ variables = serializers.DictField(+ # trim_whitespace=False so a value's exact text (multiline snippets, leading/trailing+ # whitespace meant for the rendered output) survives into the rendered body.+ child=serializers.CharField(allow_blank=True, trim_whitespace=False),+ required=False,+ help_text=(+ "Values for a template skill's declared variables, as a {name: value} map. Required only when "+ "rendering a template (see the skill's `template_variables`); ignored for non-template skills."+ ),+ )+++class CommunitySkillRenderResponseSerializer(serializers.Serializer):+ """A catalog entry with its template variables bound, for prefilling a create form. Nothing is+ persisted by rendering — the caller submits the result through the product's own create path."""++ slug = serializers.CharField(help_text="Slug of the rendered community skill.")+ kind = serializers.ChoiceField(+ choices=CommunitySkillKind.choices,+ help_text="Whether the rendered entry is a 'skill' or a 'scout'.",+ )+ name = serializers.CharField(help_text="Display name of the community skill.")+ description = serializers.CharField(help_text="What the skill does and when to use it.")+ body = serializers.CharField(help_text="The SKILL.md instruction content, with template variables bound.")+ scout_config = CommunitySkillScoutConfigSerializer(+ help_text="Schedule, emit posture and tags to prefill a scout with. Empty object for a skill."+ )+ variable_bindings = serializers.DictField(+ child=serializers.CharField(allow_blank=True),+ help_text="The {name: value} map the body was rendered with. Empty for a non-template skill.",+ )diff --git a/products/skills/backend/api/community_skill_services.py b/products/skills/backend/api/community_skill_services.pyindex ba7c023a2c0c..692a932a5485 100644--- a/products/skills/backend/api/community_skill_services.py+++ b/products/skills/backend/api/community_skill_services.py@@ -5,10 +5,11 @@ from django.db.models import Ffrom rest_framework.serializers import ValidationError as DRFValidationError+from posthog.dataclasses import frozenfrom posthog.models import Team, Userfrom ..marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTH-from ..models.community_skills import CommunitySkill, CommunitySkillVote+from ..models.community_skills import CommunitySkill, CommunitySkillKind, CommunitySkillVotefrom ..models.skills import LLMSkillfrom .skill_serializers import validate_allowed_tool, validate_new_skill_name_value, validate_skill_file_pathfrom .skill_services import HARNESS_OWNED_METADATA_KEYS, MAX_SKILL_FILE_BYTES, create_skill@@ -33,6 +34,18 @@ class CommunitySkillNotFoundError(Exception):pass+class CommunitySkillNotInstallableError(Exception):+ """The entry is not something the install path can copy into a team as a plain skill.++ A scout is the only case today: it runs on a schedule under privileged scopes, so it goes to the+ Signals scout-create form instead of becoming an inert LLMSkill under some unreserved name.+ """++ def __init__(self, detail: str) -> None:+ self.detail = detail+ super().__init__(detail)++class CommunitySkillInvalidPayloadError(Exception):"""The synced catalog entry can't be safely copied into a team — a traversal/reserved file path,oversized content, a whitespace-bearing tool name, an empty body, or a reserved privileged namespace.@@ -88,7 +101,8 @@ def install_community_skill(When the community skill is a template (its metadata declares `variables`), the user-supplied`variables` are bound into the body and bundled files before the LLMSkill is created.- Raises CommunitySkillNotFoundError if the slug is unknown, LLMSkillDuplicateNameConflictError+ Raises CommunitySkillNotFoundError if the slug is unknown, CommunitySkillNotInstallableError if+ the entry is a scout rather than a skill, LLMSkillDuplicateNameConflictErrorif the target name already exists in the team, CommunitySkillInvalidPayloadError if the catalogentry can't be safely installed, and MissingTemplateVariableError /UnknownTemplatePlaceholderError on template render failures.@@ -97,6 +111,12 @@ def install_community_skill(if community_skill is None:raise CommunitySkillNotFoundError()+ if community_skill.kind == CommunitySkillKind.SCOUT:+ raise CommunitySkillNotInstallableError(+ "This is a scout, so it isn't installed as a skill. Set it up from the store and it opens "+ "the scout form with its instructions and schedule filled in."+ )+try:target_name = validate_new_skill_name_value(new_name or community_skill.slug)except DRFValidationError as err:@@ -123,6 +143,10 @@ def install_community_skill(# a PK query still returns it, so recheck under the lock rather than installing a removed skill.if locked.deleted:raise CommunitySkillNotFoundError()+ if locked.kind == CommunitySkillKind.SCOUT:+ raise CommunitySkillNotInstallableError(+ "This is a scout, so it isn't installed as a skill. Set it up from the store."+ )if not (locked.body or "").strip():raise CommunitySkillInvalidPayloadError("This community skill has no instructions and can't be installed.")# A blank description passes the sync's length-only check but later makes the installed skill@@ -180,6 +204,61 @@ def install_community_skill(return installed+@frozen+class RenderedCommunitySkill:+ """A catalog entry with its template variables bound, ready to prefill a create form."""++ slug: str+ kind: str+ name: str+ description: str+ body: str+ scout_config: dict[str, Any]+ variable_bindings: dict[str, str]+++def render_community_skill(*, slug: str, variables: dict[str, str] | None = None) -> RenderedCommunitySkill:+ """Bind a catalog entry's template variables and return the text a create form starts from.++ Rendering server-side keeps the substitution rules in one place — a client that spliced values+ into the body itself would drift from what install produces for the same template. This creates+ nothing: the caller reviews the result and submits it through the product's own create path.++ Raises CommunitySkillNotFoundError if the slug is unknown, CommunitySkillInvalidPayloadError if+ the entry has no instructions, and the TemplateRenderError subclasses on render failures.+ """+ community_skill = get_community_skill_by_slug(slug)+ if community_skill is None:+ raise CommunitySkillNotFoundError()+ if not (community_skill.body or "").strip():+ raise CommunitySkillInvalidPayloadError("This community skill has no instructions.")++ body = community_skill.body+ bindings: dict[str, str] = {}+ template_variables = parse_template_variables(community_skill.metadata)+ if template_variables:+ rendered = render_template_skill(+ variables=template_variables,+ body=body,+ # A scout carries no bundled files (sync refuses them), and a skill's files are copied in+ # by install rather than shown on a create form, so only the body is rendered here.+ files=[],+ supplied=variables,+ )+ body = rendered.body+ bindings = rendered.bindings++ return RenderedCommunitySkill(+ slug=community_skill.slug,+ kind=community_skill.kind,+ name=community_skill.name,+ description=community_skill.description,+ body=body,+ scout_config=community_skill.scout_config or {},+ variable_bindings=bindings,+ )++def toggle_community_skill_vote(*, slug: str, user: User) -> tuple[int, bool]:"""Add or remove the user's upvote. Returns (vote_count, has_voted) after the toggle."""community_skill = get_community_skill_by_slug(slug)diff --git a/products/skills/backend/api/community_skill_sync.py b/products/skills/backend/api/community_skill_sync.pyindex 6db56afdb759..a6f4e5d9511e 100644--- a/products/skills/backend/api/community_skill_sync.py+++ b/products/skills/backend/api/community_skill_sync.py@@ -11,7 +11,8 @@ from rest_framework.serializers import ValidationError as DRFValidationErrorfrom posthog.egress.github.transport import github_requestfrom ..marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTH-from ..models.community_skills import CommunitySkill, CommunitySkillFile, CommunitySkillTrustTier+from ..models.community_skills import CommunitySkill, CommunitySkillFile, CommunitySkillKind, CommunitySkillTrustTier+from .community_scout_config import validate_shareable_scout_configfrom .skill_serializers import validate_skill_file_pathfrom .skill_services import (MAX_SKILL_BODY_BYTES,@@ -25,6 +26,7 @@ from .skill_services import (logger = structlog.get_logger(__name__)_VALID_TRUST_TIERS = set(CommunitySkillTrustTier.values)+_VALID_KINDS = set(CommunitySkillKind.values)DEFAULT_FILE_CONTENT_TYPE = "text/plain"# CharField columns that raise DataError past their max_length — checked before persisting._CHECKED_CHAR_FIELDS = (@@ -129,6 +131,26 @@ def _validate_entry_shape(entry: dict[str, Any]) -> None:if any(any(ch.isspace() for ch in t) for t in allowed_tools):raise ValueError("allowed_tools names cannot contain whitespace")+ kind = entry.get("kind")+ if kind is None:+ kind = CommunitySkillKind.SKILL.value+ if not isinstance(kind, str) or kind not in _VALID_KINDS:+ raise ValueError(f"kind '{kind}' is not one of {sorted(_VALID_KINDS)}")++ scout_config = entry.get("scout_config")+ if kind != CommunitySkillKind.SCOUT.value:+ # A plain skill carrying scout settings is a mis-typed entry, and the store would show it as+ # a skill while its author expected a scout. Reject it rather than dropping the settings.+ if scout_config:+ raise ValueError("scout_config is only valid on a 'scout' entry")+ else:+ validate_shareable_scout_config(scout_config)+ # The store hands a scout to the scout-create form, which takes instructions but no bundled+ # files. A scout that shipped them would arrive missing the references its body cites, so it+ # is refused here rather than travelling half-complete.+ if entry.get("files"):+ raise ValueError("a 'scout' entry cannot bundle files")+def _validate_entry_within_caps(entry: dict[str, Any]) -> None:"""Reject entries that would violate a DB constraint before persisting.@@ -189,8 +211,20 @@ def _upsert_community_skill(entry: dict[str, Any]) -> bool:# value persisted below) is the same coerced string the caps check approved.source_sha = _text(entry, "source_sha", "'source_sha'")+ kind = entry.get("kind")+ if kind is None:+ kind = CommunitySkillKind.SKILL.value+ scout_config = validate_shareable_scout_config(entry.get("scout_config"))+existing = CommunitySkill.objects.filter(slug=slug).first()- if existing is not None and existing.source_sha and existing.source_sha == source_sha and not existing.deleted:+ if (+ existing is not None+ and existing.source_sha+ and existing.source_sha == source_sha+ and not existing.deleted+ and existing.kind == kind+ and existing.scout_config == scout_config+ ):return False# Model choices aren't DB-enforced, so an unknown tier would persist raw and break consumers@@ -216,6 +250,8 @@ def _upsert_community_skill(entry: dict[str, Any]) -> bool:# capitalized them in frontmatter (_validate_entry_shape guarantees a list of strings)."tags": [t.lower() for t in (entry.get("tags") or [])],"trust_tier": trust_tier,+ "kind": kind,+ "scout_config": scout_config,"author_handle": _text(entry, "author_handle", "'author_handle'"),"github_url": _text(entry, "github_url", "'github_url'"),"source_sha": source_sha,diff --git a/products/skills/backend/api/community_skills.py b/products/skills/backend/api/community_skills.pyindex 387ea2d36716..8d3310339327 100644--- a/products/skills/backend/api/community_skills.py+++ b/products/skills/backend/api/community_skills.py@@ -23,13 +23,17 @@ from .community_skill_serializers import (CommunitySkillInstallSerializer,CommunitySkillListQuerySerializer,CommunitySkillListSerializer,+ CommunitySkillRenderResponseSerializer,+ CommunitySkillRenderSerializer,CommunitySkillSerializer,CommunitySkillVoteResponseSerializer,)from .community_skill_services import (CommunitySkillInvalidPayloadError,CommunitySkillNotFoundError,+ CommunitySkillNotInstallableError,install_community_skill,+ render_community_skill,toggle_community_skill_vote,)from .skill_serializers import LLMSkillSerializer@@ -110,7 +114,7 @@ class CommunitySkillViewSet(lookup_field = "slug"def get_throttles(self):- if self.action in ("install", "vote"):+ if self.action in ("install", "vote", "render"):return [CommunitySkillBurstThrottle(), CommunitySkillSustainedThrottle()]return super().get_throttles()@@ -159,6 +163,9 @@ class CommunitySkillViewSet(trust_tier = params.validated_data.get("trust_tier")if trust_tier:queryset = queryset.filter(trust_tier=trust_tier)+ kind = params.validated_data.get("kind")+ if kind:+ queryset = queryset.filter(kind=kind)# order_by is a ChoiceField over ALLOWED_LIST_ORDERINGS, so is_valid() already guarantees a# valid key. Secondary "-id" keeps pagination stable when the primary key ties.@@ -212,6 +219,11 @@ class CommunitySkillViewSet({"detail": f"Community skill '{slug}' not found."},status=status.HTTP_404_NOT_FOUND,)+ except CommunitySkillNotInstallableError as err:+ # Its own reason code rather than "invalid_payload": the entry is fine, the caller just+ # took the wrong route in, and the two want different follow-ups on the dashboard.+ self._report_install_failed(request, slug, "wrong_kind")+ return Response({"detail": err.detail}, status=status.HTTP_400_BAD_REQUEST)except (MissingTemplateVariableError,TemplateRenderTooLargeError,@@ -280,6 +292,47 @@ class CommunitySkillViewSet(status=status.HTTP_201_CREATED,)+ @extend_schema(request=CommunitySkillRenderSerializer, responses={200: CommunitySkillRenderResponseSerializer})+ @action(methods=["POST"], detail=True)+ def render(self, request: Request, slug: str = "", **kwargs) -> Response:+ """Bind a catalog entry's template variables and return the text a create form starts from.++ Persists nothing, so it needs no more access than reading the catalog already does — the+ result is prefill, and the caller creates the skill or scout through its own product's path.+ """+ payload = CommunitySkillRenderSerializer(data=request.data)+ payload.is_valid(raise_exception=True)++ try:+ rendered = render_community_skill(slug=slug, variables=payload.validated_data.get("variables"))+ except CommunitySkillNotFoundError:+ return Response(+ {"detail": f"Community skill '{slug}' not found."},+ status=status.HTTP_404_NOT_FOUND,+ )+ except (+ MissingTemplateVariableError,+ TemplateRenderTooLargeError,+ TemplateVariableTooLargeError,+ UnknownSuppliedVariableError,+ ) as err:+ raise ValidationError({"variables": str(err)}) from err+ except UnknownTemplatePlaceholderError as err:+ # A content-repo bug the caller can't fix, so it is a server-side fault. The hand-built+ # 500 skips DRF's exception handler, so log it here or a broken entry fails silently.+ logger.exception(+ "Community skill template references an undeclared placeholder",+ slug=slug,+ placeholder=err.placeholder,+ )+ return Response({"detail": str(err)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)+ except CommunitySkillInvalidPayloadError as err:+ return Response({"detail": err.detail}, status=status.HTTP_400_BAD_REQUEST)++ # Serialized rather than hand-assembled so the wire shape can't drift from the schema the+ # generated frontend types and MCP tools are built from.+ return Response(cast(dict[str, Any], CommunitySkillRenderResponseSerializer(rendered).data))+@extend_schema(request=None, responses={200: CommunitySkillVoteResponseSerializer})@action(methods=["POST"], detail=True)def vote(self, request: Request, slug: str = "", **kwargs) -> Response:diff --git a/products/skills/backend/api/skill_serializers.py b/products/skills/backend/api/skill_serializers.pyindex ddfdd7b8e6f3..db3f447bbbd7 100644--- a/products/skills/backend/api/skill_serializers.py+++ b/products/skills/backend/api/skill_serializers.py@@ -13,7 +13,7 @@ from posthog.api.shared import UserBasicSerializerfrom products.ai_observability.backend.markdown_outline import get_markdown_outlinefrom ..marketplace.packaging import DEFAULT_BUNDLE_SKILLS, MAX_BUNDLE_SKILLS, SPEC_DESCRIPTION_MAX_LENGTH-from ..models.skills import LLMSkill, LLMSkillFile, category_for_skill_name+from ..models.skills import MAX_SKILL_CATEGORY_LENGTH, LLMSkill, LLMSkillFile, category_for_skill_namefrom .community_publish_services import (DISPLAY_NAME_PATTERN,MAX_DISPLAY_NAME_LENGTH,@@ -21,6 +21,7 @@ from .community_publish_services import (MAX_TAG_LENGTH,OPTIONAL_GITHUB_HANDLE_PATTERN,)+from .community_skill_serializers import CommunitySkillScoutConfigSerializerfrom .skill_services import (MAX_SKILL_NAME_LENGTH,RESERVED_SKILL_NAMES,@@ -1068,6 +1069,24 @@ class LLMSkillPublishToCommunitySerializer(serializers.Serializer):min_value=1,help_text="Skill version that the publisher reviewed. The request returns 409 if the latest version changed.",)+ expected_category = serializers.CharField(+ required=False,+ allow_blank=True,+ max_length=MAX_SKILL_CATEGORY_LENGTH,+ help_text=(+ "Category of the skill the publisher reviewed. Registering a skill as a scout changes its "+ "category without raising its version, so the version alone would let a skill reviewed as "+ "an ordinary one publish as a scout. The request returns 409 if the category changed. "+ "Omit it to skip that check."+ ),+ )+ scout_config = CommunitySkillScoutConfigSerializer(+ required=False,+ help_text=(+ "Schedule, emit posture and tags to publish alongside a scout, so it arrives in another project "+ "with its cadence intact. Rejected for a skill that is not a scout."+ ),+ )display_name = serializers.RegexField(DISPLAY_NAME_PATTERN,required=False,diff --git a/products/skills/backend/api/skills.py b/products/skills/backend/api/skills.pyindex d79f09369cec..f2fbf1b881e5 100644--- a/products/skills/backend/api/skills.py+++ b/products/skills/backend/api/skills.py@@ -72,7 +72,8 @@ from ..marketplace.packaging import (parse_skill_zip,render_skill_md,)-from ..models.skills import LLMSkill, LLMSkillFile+from ..models.community_skills import CommunitySkillKind+from ..models.skills import SCOUT_SKILL_CATEGORY, LLMSkill, LLMSkillFilefrom .community_publish_services import (CommunitySkillPublishError,CommunitySkillPublishNotConfiguredError,@@ -1774,9 +1775,14 @@ class LLMSkillViewSet(payload = LLMSkillPublishToCommunitySerializer(data=request.data)payload.is_valid(raise_exception=True)+ # Category rides along with id and version because registering a skill as a scout stamps+ # `category` without raising the version: on version alone, a skill reviewed as an ordinary+ # one could publish as a scout, carrying a schedule its publisher never consented to.+ expected_category = payload.validated_data.get("expected_category")if (skill.id != payload.validated_data["expected_skill_id"]or skill.version != payload.validated_data["expected_version"]+ or (expected_category is not None and skill.category != expected_category)):return Response({@@ -1795,6 +1801,12 @@ class LLMSkillViewSet(# The LLMSkill name is the kebab slug; default the community display name to a title-cased form.display_name = payload.validated_data.get("display_name") or skill.name.replace("-", " ").title()+ # Derived, not caller-supplied: a scout published as a plain skill is exactly the entry the+ # catalog can't tell apart, and it lands in another project inert.+ kind = (+ CommunitySkillKind.SCOUT.value if skill.category == SCOUT_SKILL_CATEGORY else CommunitySkillKind.SKILL.value+ )+try:result = publish_skill_to_community(slug=skill.name,@@ -1811,6 +1823,8 @@ class LLMSkillViewSet(compatibility=skill.compatibility or "",author_handle=payload.validated_data.get("author_handle", ""),metadata=skill.metadata,+ kind=kind,+ scout_config=payload.validated_data.get("scout_config"),)except CommunitySkillPublishNotConfiguredError:# The fail-safe is otherwise silent, so an instance that meant to have publishing ondiff --git a/products/skills/backend/api/test/test_community_publish_services.py b/products/skills/backend/api/test/test_community_publish_services.pyindex ce7f8c979c4b..d3d5714e7632 100644--- a/products/skills/backend/api/test/test_community_publish_services.py+++ b/products/skills/backend/api/test/test_community_publish_services.py@@ -52,9 +52,49 @@ class TestRenderSkillMd:def test_optional_fields_omitted_when_empty(self) -> None:frontmatter, _ = _parse(render_skill_md(name="X", description="Y", body="Z"))- for omitted in ("tags", "author_handle", "license", "compatibility", "allowed_tools"):+ for omitted in ("tags", "author_handle", "license", "compatibility", "allowed_tools", "kind", "scout_config"):assert omitted not in frontmatter+ def test_marks_a_scout_and_carries_its_settings(self) -> None:+ # Without the marker the catalog can't tell a scout from a skill, and it lands inert.+ frontmatter, _ = _parse(+ render_skill_md(+ name="Feed scout",+ description="Watch a feed.",+ body="b",+ kind="scout",+ scout_config={"run_interval_minutes": 720, "emit": False},+ )+ )+ assert frontmatter["kind"] == "scout"+ assert frontmatter["scout_config"] == {"run_interval_minutes": 720, "emit": False}++ @pytest.mark.parametrize(+ "kind,scout_config",+ [+ ("scout", {"network_access": "full"}),+ ("scout", {"model": "claude"}),+ ("scout", {"mcp_gateway_server_ids": ["abc"]}),+ ("scout", {"run_interval_minutes": 5}),+ ("skill", {"emit": False}),+ ],+ )+ def test_rejects_scout_settings_ingest_would_drop(self, kind: str, scout_config: dict[str, Any]) -> None:+ with pytest.raises(CommunitySkillPublishError):+ render_skill_md(name="n", description="d", body="b", kind=kind, scout_config=scout_config)++ def test_rejects_a_scout_with_bundled_files(self) -> None:+ # Ingest refuses one, so publishing it opens a PR that merges and never reaches the catalog.+ with pytest.raises(CommunitySkillPublishError):+ render_community_skill_files(+ slug="signals-scout-feed",+ name="Feed scout",+ description="Watch a feed.",+ body="b",+ kind="scout",+ files=[{"path": "references/playbook.md", "content": "hints", "content_type": "text/markdown"}],+ )+def test_optional_fields_included_when_set(self) -> None:content = render_skill_md(name="Make PR",diff --git a/products/skills/backend/api/test/test_community_skill_sync.py b/products/skills/backend/api/test/test_community_skill_sync.pyindex b2af65a35c98..695b8c7e39ea 100644--- a/products/skills/backend/api/test/test_community_skill_sync.py+++ b/products/skills/backend/api/test/test_community_skill_sync.py@@ -8,7 +8,8 @@ from parameterized import parameterizedfrom ...marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTHfrom ...models.community_skills import CommunitySkill-from ..community_skill_sync import _validate_entry_within_caps, sync_community_skills_from_github+from ..community_scout_config import validate_shareable_scout_config+from ..community_skill_sync import _validate_entry_shape, _validate_entry_within_caps, sync_community_skills_from_githubfrom ..skill_services import MAX_SKILL_BODY_BYTES@@ -48,6 +49,81 @@ class TestCommunitySkillSyncValidation(SimpleTestCase):_validate_entry_within_caps(entry)+class TestCommunitySkillScoutEntryValidation(SimpleTestCase):+ def _entry(self, **overrides) -> dict:+ return {+ "slug": "signals-scout-feed",+ "name": "Feed scout",+ "description": "Watch a feed for problems.",+ "body": "# Scout",+ **overrides,+ }++ def test_scout_entry_keeps_its_shareable_settings(self) -> None:+ _validate_entry_shape(+ self._entry(kind="scout", scout_config={"run_interval_minutes": 720, "emit": False, "tags": ["feeds"]})+ )++ def test_scout_tags_are_stored_in_the_slug_form_the_setup_flow_keeps(self) -> None:+ # The setup form normalizes a tag to a lowercase slug, so a catalog entry that stored the+ # raw spelling would arrive as a tag nobody can filter the fleet by.+ entry = self._entry(kind="scout", scout_config={"tags": ["Web Analytics", "web_analytics", "Revenue"]})+ _validate_entry_shape(entry)+ self.assertEqual(validate_shareable_scout_config(entry["scout_config"])["tags"], ["revenue", "web-analytics"])++ @parameterized.expand(+ [+ ("an unknown kind", {"kind": "agent"}, "is not one of"),+ ("a false kind", {"kind": False}, "is not one of"),+ ("a zero kind", {"kind": 0}, "is not one of"),+ ("settings on a plain skill", {"scout_config": {"emit": False}}, "only valid on a 'scout'"),+ # The three that grant a scout reach into a project — never carried by a published one.+ ("network access", {"kind": "scout", "scout_config": {"network_access": "full"}}, "cannot carry"),+ ("a pinned model", {"kind": "scout", "scout_config": {"model": "claude"}}, "cannot carry"),+ (+ "gateway servers",+ {"kind": "scout", "scout_config": {"mcp_gateway_server_ids": ["abc"]}},+ "cannot carry",+ ),+ (+ "a cadence under the floor",+ {"kind": "scout", "scout_config": {"run_interval_minutes": 5}},+ "must be between",+ ),+ (+ "an invalid cron",+ {"kind": "scout", "scout_config": {"run_cron_schedule": "61 9 * * *"}},+ "valid five-field",+ ),+ (+ "a cron under the cadence floor",+ {"kind": "scout", "scout_config": {"run_cron_schedule": "* * * * *"}},+ "at least 30 minutes",+ ),+ (+ "a cron that never occurs",+ {"kind": "scout", "scout_config": {"run_cron_schedule": "0 0 31 2 *"}},+ "real date",+ ),+ (+ # Signals refuses one outright, so accepting it here would sync a tag the setup form+ # silently drops rather than one the created scout carries.+ "a tag that normalizes to nothing",+ {"kind": "scout", "scout_config": {"tags": ["!!!"]}},+ "empty once normalized",+ ),+ (+ "bundled files",+ {"kind": "scout", "files": [{"path": "references/g.md", "content": "x"}]},+ "cannot bundle files",+ ),+ ]+ )+ def test_rejects(self, _name, overrides, message) -> None:+ with self.assertRaisesRegex(ValueError, message):+ _validate_entry_shape(self._entry(**overrides))++class TestCommunitySkillSync(APIBaseTest):@patch("products.skills.backend.api.community_skill_sync.github_request")def test_sync_upserts_and_soft_deletes_missing(self, mock_get) -> None:@@ -99,6 +175,32 @@ class TestCommunitySkillSync(APIBaseTest):result = sync_community_skills_from_github()self.assertEqual(result, {"synced": 0, "skipped": 1, "removed": 0})+ @patch("products.skills.backend.api.community_skill_sync.github_request")+ def test_sync_reconciles_new_fields_for_an_unchanged_sha(self, mock_get) -> None:+ existing = _create_community_skill(slug="signals-scout-feed")+ CommunitySkill.objects.filter(pk=existing.pk).update(source_sha="same-sha", kind="skill", scout_config={})+ mock_get.return_value.raise_for_status.return_value = None+ mock_get.return_value.json.return_value = {+ "skills": [+ {+ "slug": "signals-scout-feed",+ "name": "Feed scout",+ "description": "Watch the feed.",+ "body": "# Scout",+ "source_sha": "same-sha",+ "kind": "scout",+ "scout_config": {"run_interval_minutes": 720},+ }+ ]+ }++ result = sync_community_skills_from_github()++ existing.refresh_from_db()+ self.assertEqual(result, {"synced": 1, "skipped": 0, "removed": 0})+ self.assertEqual(existing.kind, "scout")+ self.assertEqual(existing.scout_config, {"run_interval_minutes": 720})+@patch("products.skills.backend.api.community_skill_sync.github_request")def test_sync_empty_registry_does_not_wipe_catalog(self, mock_get) -> None:_create_community_skill(slug="keep-me")@@ -335,6 +437,37 @@ class TestCommunitySkillSync(APIBaseTest):with self.assertRaises(OperationalError):sync_community_skills_from_github()+ @patch("products.skills.backend.api.community_skill_sync.github_request")+ def test_sync_persists_kind_and_scout_config(self, mock_get) -> None:+ mock_get.return_value.raise_for_status.return_value = None+ mock_get.return_value.json.return_value = {+ "skills": [+ {+ "slug": "signals-scout-feed",+ "name": "Feed scout",+ "description": "Watch a feed for problems.",+ "body": "# Scout",+ "kind": "scout",+ "scout_config": {"run_interval_minutes": 720, "emit": False},+ },+ {+ "slug": "plain-skill",+ "name": "Plain skill",+ "description": "Do a thing.",+ "body": "# Plain",+ },+ ]+ }++ sync_community_skills_from_github()++ scout = CommunitySkill.objects.get(slug="signals-scout-feed")+ self.assertEqual(scout.kind, "scout")+ self.assertEqual(scout.scout_config, {"run_interval_minutes": 720, "emit": False})+ plain = CommunitySkill.objects.get(slug="plain-skill")+ self.assertEqual(plain.kind, "skill")+ self.assertEqual(plain.scout_config, {})+@patch("products.skills.backend.api.community_skill_sync.github_request")def test_sync_lowercases_tags(self, mock_get) -> None:mock_get.return_value.raise_for_status.return_value = Nonediff --git a/products/skills/backend/api/test/test_community_skills.py b/products/skills/backend/api/test/test_community_skills.pyindex b071fd9257fe..2caf4e961648 100644--- a/products/skills/backend/api/test/test_community_skills.py+++ b/products/skills/backend/api/test/test_community_skills.py@@ -14,7 +14,7 @@ from posthog.models.user import Userfrom products.access_control.backend.models.access_control import AccessControlfrom ...marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTH-from ...models.community_skills import CommunitySkill, CommunitySkillFile, CommunitySkillVote+from ...models.community_skills import CommunitySkill, CommunitySkillFile, CommunitySkillKind, CommunitySkillVotefrom ...models.skills import LLMSkillfrom ..skill_template_services import (MAX_RENDERED_SKILL_BYTES,@@ -72,6 +72,18 @@ def _create_template_skill(*, slug: str = "feed-scout") -> CommunitySkill:)+def _create_scout_skill(*, slug: str = "signals-scout-feed", scout_config: dict | None = None) -> CommunitySkill:+ return CommunitySkill.objects.create(+ slug=slug,+ name="Feed scout",+ description="Watch a feed for problems.",+ body="# Scout\nWatch the feed.",+ trust_tier="official",+ kind=CommunitySkillKind.SCOUT,+ scout_config=scout_config if scout_config is not None else {"run_interval_minutes": 720, "emit": False},+ )++@patch("products.skills.backend.api.community_skills.posthoganalytics.feature_enabled",return_value=True,@@ -340,12 +352,81 @@ class TestCommunitySkillAPI(APIBaseTest):[("web-analytics-triage", True, 1), ("web-analytics-triage", False, 0)],)+ def test_filter_by_kind(self, _mock_flag) -> None:+ _create_community_skill(slug="a-skill")+ _create_scout_skill(slug="signals-scout-feed")++ scouts = self.client.get(self._url(), {"kind": "scout"}).json()["results"]+ self.assertEqual([s["slug"] for s in scouts], ["signals-scout-feed"])+ # The store card reads these to say how often the scout runs, and the nested serializer+ # drops an absent field rather than emitting a null the card would render as a cadence.+ self.assertEqual(scouts[0]["scout_config"], {"run_interval_minutes": 720, "emit": False})+ skills = self.client.get(self._url(), {"kind": "skill"}).json()["results"]+ self.assertEqual([s["slug"] for s in skills], ["a-skill"])++ def test_install_refuses_a_scout(self, _mock_flag) -> None:+ # The whole point of the scout route: a scout must never land as an inert plain skill.+ _create_scout_skill(slug="signals-scout-feed")++ response = self.client.post(self._url("signals-scout-feed/install/"), {})+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertIn("scout", response.json()["detail"])+ self.assertFalse(LLMSkill.objects.filter(team=self.team).exists())++ def test_install_rechecks_the_kind_after_locking(self, _mock_flag) -> None:+ skill = _create_community_skill(slug="changes-to-scout")+ skill.kind = CommunitySkillKind.SCOUT++ with patch(+ "products.skills.backend.api.community_skill_services.CommunitySkill.objects.select_for_update"+ ) as lock:+ lock.return_value.get.return_value = skill+ response = self.client.post(self._url("changes-to-scout/install/"), {})++ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertIn("scout", response.json()["detail"])+ self.assertFalse(LLMSkill.objects.filter(team=self.team).exists())++ def test_render_returns_a_scouts_body_and_settings(self, _mock_flag) -> None:+ _create_scout_skill(slug="signals-scout-feed")++ response = self.client.post(self._url("signals-scout-feed/render/"), {}, format="json")+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ payload = response.json()+ self.assertEqual(payload["kind"], "scout")+ self.assertEqual(payload["body"], "# Scout\nWatch the feed.")+ self.assertEqual(payload["scout_config"], {"run_interval_minutes": 720, "emit": False})++ def test_render_binds_template_variables_without_persisting(self, _mock_flag) -> None:+ _create_template_skill(slug="feed-scout")++ response = self.client.post(+ self._url("feed-scout/render/"), {"variables": {"feed_table": "events"}}, format="json"+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ payload = response.json()+ self.assertEqual(payload["body"], "# Scout\nWatch table events on main.")+ self.assertEqual(payload["variable_bindings"], {"feed_table": "events", "default_branch": "main"})+ self.assertFalse(LLMSkill.objects.filter(team=self.team).exists())++ def test_render_missing_required_variable_returns_400(self, _mock_flag) -> None:+ _create_template_skill(slug="feed-scout")++ response = self.client.post(self._url("feed-scout/render/"), {}, format="json")+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)+ self.assertEqual(response.json()["attr"], "variables")++ def test_render_unknown_slug_returns_404(self, _mock_flag) -> None:+ response = self.client.post(self._url("missing/render/"), {}, format="json")+ self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)+@parameterized.expand([("not_found",),("missing_variable",),("name_conflict",),("undeclared_placeholder",),+ ("wrong_kind",),])@patch("posthog.event_usage.posthoganalytics.capture")@@ -366,6 +447,9 @@ class TestCommunitySkillAPI(APIBaseTest):skill.body = "Watch {{ feed_table }} and {{ undeclared }}."skill.save(update_fields=["body"])self.client.post(self._url("feed-scout/install/"), {"variables": {"feed_table": "x"}}, format="json")+ elif reason == "wrong_kind":+ _create_scout_skill(slug="signals-scout-feed")+ self.client.post(self._url("signals-scout-feed/install/"), {})failures = _captured_events(mock_capture, "community skill install failed")self.assertEqual([p["reason"] for p in failures], [reason])diff --git a/products/skills/backend/api/test/test_skills.py b/products/skills/backend/api/test/test_skills.pyindex 6e0142ac3f49..9b6e77d10765 100644--- a/products/skills/backend/api/test/test_skills.py+++ b/products/skills/backend/api/test/test_skills.py@@ -47,7 +47,7 @@ from ...api.skill_services import ()from ...api.skills import SKILL_SEARCH_RESULT_LIMITfrom ...marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTH, parse_skill_md-from ...models.skills import LLMSkill, LLMSkillFile+from ...models.skills import SCOUT_SKILL_CATEGORY, LLMSkill, LLMSkillFileCOMMUNITY_FLAG = "products.skills.backend.api.community_skills.posthoganalytics.feature_enabled"@@ -2154,6 +2154,26 @@ class TestLLMSkillAPI(APIBaseTest):assert response.status_code == status.HTTP_201_CREATEDassert mock_publish.call_args.kwargs["tags"] == expected+ @parameterized.expand(+ [+ ("unsupported setting", {"network_access": "full"}),+ ("too many tags", {"tags": [f"tag-{index}" for index in range(11)]}),+ ]+ )+ @patch(COMMUNITY_FLAG, return_value=True)+ @patch("products.skills.backend.api.skills.publish_skill_to_community")+ def test_publish_scout_rejects_an_invalid_config(self, _label: str, scout_config: dict, mock_publish, _mock_flag):+ skill = self.create_skill(name="signals-scout-feed", category="scout")++ response = self.client.post(+ self._url("name/signals-scout-feed/publish-community"),+ data={"expected_skill_id": str(skill.id), "expected_version": skill.version, "scout_config": scout_config},+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST+ mock_publish.assert_not_called()+@patch(COMMUNITY_FLAG, return_value=True)@patch("products.skills.backend.api.skills.publish_skill_to_community")def test_publish_to_community_unknown_skill_returns_404(self, mock_publish, _mock_flag):@@ -2179,6 +2199,46 @@ class TestLLMSkillAPI(APIBaseTest):)mock_publish.assert_not_called()+ @patch(COMMUNITY_FLAG, return_value=True)+ @patch("products.skills.backend.api.skills.publish_skill_to_community")+ def test_publish_to_community_rejects_a_skill_registered_as_a_scout_after_review(self, mock_publish, _mock_flag):+ # Registering a skill as a scout stamps `category` without raising the version, so version+ # alone would let a skill reviewed as an ordinary one publish as a scout on a schedule.+ skill = self.create_skill(name="make-pr")+ LLMSkill.objects.filter(pk=skill.pk).update(category=SCOUT_SKILL_CATEGORY)++ response = self.client.post(+ self._url("name/make-pr/publish-community"),+ data={+ "expected_skill_id": str(skill.id),+ "expected_version": skill.version,+ "expected_category": "",+ },+ format="json",+ )++ assert response.status_code == status.HTTP_409_CONFLICT+ mock_publish.assert_not_called()++ @patch(COMMUNITY_FLAG, return_value=True)+ @patch("products.skills.backend.api.skills.publish_skill_to_community")+ def test_publish_to_community_accepts_the_category_the_publisher_reviewed(self, mock_publish, _mock_flag):+ mock_publish.return_value = {"pr_url": "https://github.com/PostHog/community-skills/pull/1", "pr_number": 1}+ skill = self.create_skill(name="make-pr")++ response = self.client.post(+ self._url("name/make-pr/publish-community"),+ data={+ "expected_skill_id": str(skill.id),+ "expected_version": skill.version,+ "expected_category": skill.category,+ },+ format="json",+ )++ assert response.status_code == status.HTTP_201_CREATED, response.json()+ mock_publish.assert_called_once()+@patch(COMMUNITY_FLAG, return_value=True)@patch("products.skills.backend.api.skills.publish_skill_to_community")def test_publish_to_community_rejects_a_recreated_skill_with_the_same_version(self, mock_publish, _mock_flag):diff --git a/products/skills/backend/migrations/0010_communityskill_kind_communityskill_scout_config.py b/products/skills/backend/migrations/0010_communityskill_kind_communityskill_scout_config.pynew file mode 100644index 000000000000..edbee52f4ead--- /dev/null+++ b/products/skills/backend/migrations/0010_communityskill_kind_communityskill_scout_config.py@@ -0,0 +1,24 @@+# Generated by Django 5.2.17 on 2026-09-04 07:22++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("skills", "0009_llmskill_skill_md_sha256_llmskill_skill_md_size_and_more"),+ ]++ operations = [+ migrations.AddField(+ model_name="communityskill",+ name="kind",+ field=models.CharField(+ choices=[("skill", "Skill"), ("scout", "Scout")], db_default="skill", default="skill", max_length=20+ ),+ ),+ migrations.AddField(+ model_name="communityskill",+ name="scout_config",+ field=models.JSONField(blank=True, db_default={}, default=dict),+ ),+ ]diff --git a/products/skills/backend/migrations/max_migration.txt b/products/skills/backend/migrations/max_migration.txtindex 6451863f7b93..f24d4c71a7c3 100644--- a/products/skills/backend/migrations/max_migration.txt+++ b/products/skills/backend/migrations/max_migration.txt@@ -1 +1 @@-0009_llmskill_skill_md_sha256_llmskill_skill_md_size_and_more+0010_communityskill_kind_communityskill_scout_configdiff --git a/products/skills/backend/models/community_skills.py b/products/skills/backend/models/community_skills.pyindex de6373778338..a74f39f0e6e5 100644--- a/products/skills/backend/models/community_skills.py+++ b/products/skills/backend/models/community_skills.py@@ -4,6 +4,18 @@ from django.utils import timezonefrom posthog.models.utils import UUIDModel+class CommunitySkillKind(models.TextChoices):+ """What a catalog entry becomes in a team.++ A `skill` is copied in as a plain LLMSkill by the install path. A `scout` runs on a schedule+ under privileged scopes, so it can never arrive that way — the store hands it to the Signals+ scout-create form instead, where a person reviews the cadence and submits it.+ """++ SKILL = "skill", "Skill"+ SCOUT = "scout", "Scout"++class CommunitySkillTrustTier(models.TextChoices):OFFICIAL = "official", "Official"VERIFIED = "verified", "Verified"@@ -26,6 +38,14 @@ class CommunitySkill(UUIDModel):# The repo directory name — the stable, human-readable identifier used in URLs.slug = models.CharField(max_length=64, unique=True)+ # What the entry becomes in a team. A scout takes a different route in (see CommunitySkillKind).+ kind = models.CharField(+ max_length=20,+ choices=CommunitySkillKind.choices,+ default=CommunitySkillKind.SKILL,+ db_default=CommunitySkillKind.SKILL,+ )+# Mirrors the Agent Skills spec fields carried by LLMSkill.name = models.CharField(max_length=64)description = models.CharField(max_length=4096)@@ -34,6 +54,9 @@ class CommunitySkill(UUIDModel):compatibility = models.CharField(max_length=500, blank=True, default="")allowed_tools = models.JSONField(blank=True, default=list)metadata = models.JSONField(blank=True, default=dict)+ # Cadence, emit posture and tags a published scout travels with, held to the shareable subset in+ # `community_scout_config`. Empty for a `skill` entry, and for a scout that declared none.+ scout_config = models.JSONField(blank=True, default=dict, db_default={})# Marketplace fields.tags = models.JSONField(blank=True, default=list)diff --git a/products/skills/backend/models/skills.py b/products/skills/backend/models/skills.pyindex 13c11785ea5f..208c4dae23b1 100644--- a/products/skills/backend/models/skills.py+++ b/products/skills/backend/models/skills.py@@ -15,8 +15,10 @@ from ..marketplace.packaging import SkillExport, SkillFileExport, render_skill_m# they'd never surface beside their canonical siblings. Values mirror SCOUT_SKILL_CATEGORY /# REVIEW_HOG_SKILL_CATEGORY (products can't import each other, so they're duplicated here exactly# like the frontend tab map duplicates them).+MAX_SKILL_CATEGORY_LENGTH = 64+SCOUT_SKILL_CATEGORY = "scout"CATEGORY_BY_NAME_PREFIX: tuple[tuple[str, str], ...] = (- ("signals-scout-", "scout"),+ ("signals-scout-", SCOUT_SKILL_CATEGORY),("review-hog-", "review_hog"),)@@ -80,7 +82,7 @@ class LLMSkill(UUIDModel):# Generic classification, decoupled from the skill name. Empty for an ordinary skill; a known# value (e.g. "scout") groups the skill into its own surface in the UI. Producers own the value# (the Signals harness stamps "scout"); the skills product treats it as an opaque string.- category = models.CharField(max_length=64, blank=True, default="", db_default="")+ category = models.CharField(max_length=MAX_SKILL_CATEGORY_LENGTH, blank=True, default="", db_default="")# Versioning (same pattern as LLMPrompt)version = models.PositiveIntegerField(default=1)diff --git a/products/skills/frontend/CommunitySkillsScene.tsx b/products/skills/frontend/CommunitySkillsScene.tsxindex 9a12aa04b40b..50b34e1056b4 100644--- a/products/skills/frontend/CommunitySkillsScene.tsx+++ b/products/skills/frontend/CommunitySkillsScene.tsx@@ -12,12 +12,15 @@ import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'import { LemonTag, LemonTagType } from 'lib/lemon-ui/LemonTag'import { PaginationControl } from 'lib/lemon-ui/PaginationControl'import { usePagination } from 'lib/lemon-ui/PaginationControl/usePagination'+import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'import { SceneExport } from 'scenes/sceneTypes'import { ProductKey } from '~/queries/schema/schema-general'+import { AccessControlLevel, AccessControlResourceType } from '~/types'import { communitySkillsLogic } from './communitySkillsLogic'-import { CommunitySkillTrustTierEnumApi } from './generated/api.schemas'+import { communityScoutCadenceLabel } from './communitySkillUtils'+import { CommunitySkillKindEnumApi, CommunitySkillTrustTierEnumApi } from './generated/api.schemas'import type { CommunitySkillListApi, CommunitySkillTemplateVariableApi } from './generated/api.schemas'import { COMMUNITY_SKILLS_TAB_DESCRIPTION, COMMUNITY_SKILLS_TAB_KEY, SkillsSceneShell } from './SkillsSceneShell'@@ -66,16 +69,19 @@ function AuthorHandle({ handle }: { handle: string }): JSX.Element {)}-// A template declares variables that must be bound before install. Collect a value per variable,-// then install with them. Defaults prefill; required variables are guarded.-function openTemplateInstallDialog(+// A template declares variables that must be bound before it can be used. Collect a value per+// variable, then hand them on. Defaults prefill; required variables are guarded.+function openTemplateDialog(skill: CommunitySkillListApi,variables: readonly CommunitySkillTemplateVariableApi[],- install: (slug: string, newName?: string, values?: Record<string, string>) => void+ submit: (slug: string, values: Record<string, string>) => void): void {+ const isScout = skill.kind === CommunitySkillKindEnumApi.ScoutLemonDialog.openForm({- title: `Install "${skill.name}"`,- description: 'This is a template. Provide a value for each variable to customize the installed skill.',+ title: isScout ? `Set up "${skill.name}"` : `Install "${skill.name}"`,+ description: isScout+ ? 'This is a template. Provide a value for each variable, then review the scout before you create it.'+ : 'This is a template. Provide a value for each variable to customize the installed skill.',initialValues: Object.fromEntries(variables.map((v) => [v.name, v.default ?? ''])),content: (<div className="flex flex-col gap-2">@@ -91,24 +97,73 @@ function openTemplateInstallDialog(.filter((v) => v.is_required).map((v) => [v.name, (value: string) => (!value?.trim() ? 'This variable is required' : undefined)])),- onSubmit: (values) => install(skill.slug, undefined, values as Record<string, string>),+ onSubmit: (values) => submit(skill.slug, values as Record<string, string>),})}-function CommunitySkillCard({ skill }: { skill: CommunitySkillListApi }): JSX.Element {- const { installingSlugs, votingSlugs } = useValues(communitySkillsLogic)- const { installSkill, toggleVote } = useActions(communitySkillsLogic)- const installing = !!installingSlugs[skill.slug]- const voting = !!votingSlugs[skill.slug]- const sourceUrl = skill.github_url ? githubSourceUrl(skill.github_url) : null+/**+ * Install for a skill, and the scout form for a scout. A scout runs on a schedule under privileged+ * scopes, so it is never copied into the project as a plain skill.+ */+function CommunitySkillAction({ skill }: { skill: CommunitySkillListApi }): JSX.Element {+ const { installingSlugs, settingUpSlugs } = useValues(communitySkillsLogic)+ const { installSkill, setUpScout } = useActions(communitySkillsLogic)+ const isScout = skill.kind === CommunitySkillKindEnumApi.Scout+ const busy = isScout ? !!settingUpSlugs[skill.slug] : !!installingSlugs[skill.slug]+ const scoutCreateDisabledReason = isScout+ ? getAccessControlDisabledReason(AccessControlResourceType.LlmSkill, AccessControlLevel.Editor)+ : nullconst templateVariables = skill.template_variables ?? []const isTemplate = templateVariables.length > 0+ const start = (slug: string, values?: Record<string, string>): void =>+ isScout ? setUpScout(slug, values) : installSkill(slug, undefined, values)++ return (+ <LemonButton+ size="small"+ type="primary"+ loading={busy}+ disabledReason={busy ? (isScout ? 'Opening the scout form…' : 'Installing…') : scoutCreateDisabledReason}+ onClick={() => (isTemplate ? openTemplateDialog(skill, templateVariables, start) : start(skill.slug))}+ >+ {`${isScout ? 'Set up scout' : 'Install'}${isTemplate ? '…' : ''}`}+ </LemonButton>+ )+}++function CommunitySkillVoteButton({ skill }: { skill: CommunitySkillListApi }): JSX.Element {+ const { votingSlugs } = useValues(communitySkillsLogic)+ const { toggleVote } = useActions(communitySkillsLogic)+ const voting = !!votingSlugs[skill.slug]++ return (+ <LemonButton+ size="small"+ type="tertiary"+ icon={<IconThumbsUp />}+ active={skill.has_voted}+ loading={voting}+ disabledReason={voting ? 'Saving your vote…' : undefined}+ onClick={() => toggleVote(skill.slug)}+ tooltip={skill.has_voted ? 'Remove your vote' : 'Upvote this skill'}+ >+ {skill.vote_count}+ </LemonButton>+ )+}++function CommunitySkillCard({ skill }: { skill: CommunitySkillListApi }): JSX.Element {+ const isScout = skill.kind === CommunitySkillKindEnumApi.Scout+ const sourceUrl = skill.github_url ? githubSourceUrl(skill.github_url) : null+ const isTemplate = (skill.template_variables ?? []).length > 0+return (<div className="flex flex-col gap-2 border rounded p-4 bg-bg-light h-full"><div className="flex items-start justify-between gap-2"><h3 className="font-semibold m-0">{skill.name}</h3><div className="flex items-center gap-1 shrink-0">+ {isScout ? <LemonTag type="completion">Scout</LemonTag> : null}{isTemplate ? <LemonTag type="highlight">Template</LemonTag> : null}<TrustTierBadge tier={skill.trust_tier} /></div>@@ -123,7 +178,9 @@ function CommunitySkillCard({ skill }: { skill: CommunitySkillListApi }): JSX.El</div><div className="flex items-center justify-between gap-2 pt-2 border-t"><div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-muted text-xs">- <span>{skill.install_count} installs</span>+ <span>+ {isScout ? communityScoutCadenceLabel(skill.scout_config) : `${skill.install_count} installs`}+ </span>{skill.author_handle ? <AuthorHandle handle={skill.author_handle} /> : null}{sourceUrl ? (<Link to={sourceUrl} target="_blank" className="flex items-center gap-1">@@ -132,31 +189,8 @@ function CommunitySkillCard({ skill }: { skill: CommunitySkillListApi }): JSX.El) : null}</div><div className="flex items-center gap-2 shrink-0">- <LemonButton- size="small"- type="tertiary"- icon={<IconThumbsUp />}- active={skill.has_voted}- loading={voting}- disabledReason={voting ? 'Saving your vote…' : undefined}- onClick={() => toggleVote(skill.slug)}- tooltip={skill.has_voted ? 'Remove your vote' : 'Upvote this skill'}- >- {skill.vote_count}- </LemonButton>- <LemonButton- size="small"- type="primary"- loading={installing}- disabledReason={installing ? 'Installing…' : undefined}- onClick={() =>- isTemplate- ? openTemplateInstallDialog(skill, templateVariables, installSkill)- : installSkill(skill.slug)- }- >- {isTemplate ? 'Install…' : 'Install'}- </LemonButton>+ <CommunitySkillVoteButton skill={skill} />+ <CommunitySkillAction skill={skill} /></div></div></div>@@ -175,7 +209,7 @@ function CommunitySkillsGrid({ skills, loading }: { skills: CommunitySkillListAp}if (skills.length === 0) {- return <div className="text-muted text-center p-8">No community skills match your filters yet.</div>+ return <div className="text-muted text-center p-8">Nothing in the store matches your filters yet.</div>}return (@@ -213,6 +247,22 @@ function CommunitySkillsContent(): JSX.Element {onChange={(search) => setFilters({ search })}className="grow max-w-100"/>+ <LemonSelect<CommunitySkillKindEnumApi | ''>+ value={filters.kind}+ onChange={(kind) =>+ setFilters({+ kind,+ ...(kind === CommunitySkillKindEnumApi.Scout && filters.order_by === '-install_count'+ ? { order_by: '-vote_count' }+ : {}),+ })+ }+ options={[+ { value: '', label: 'Skills and scouts' },+ { value: 'skill', label: 'Skills' },+ { value: 'scout', label: 'Scouts' },+ ]}+ /><LemonSelect<CommunitySkillTrustTierEnumApi | ''>value={filters.trust_tier}onChange={(trust_tier) => setFilters({ trust_tier })}diff --git a/products/skills/frontend/LLMSkillScene.tsx b/products/skills/frontend/LLMSkillScene.tsxindex 7edbde856430..e35f2707f3af 100644--- a/products/skills/frontend/LLMSkillScene.tsx+++ b/products/skills/frontend/LLMSkillScene.tsx@@ -19,6 +19,7 @@ import { AccessControlAction } from 'lib/components/AccessControlAction'import { AccessDenied } from 'lib/components/AccessDenied'import { CodeSnippet, Language } from 'lib/components/CodeSnippet/CodeSnippet'import { NotFound } from 'lib/components/NotFound'+import { openPublishToCommunityDialog } from 'lib/components/openPublishToCommunityDialog'import { FEATURE_FLAGS } from 'lib/constants'import { dayjs } from 'lib/dayjs'import { IconLink } from 'lib/lemon-ui/icons'@@ -59,7 +60,6 @@ import { SkillOwners } from './SkillOwners'import {SkillPublishReviewModal,openArchiveSkillDialog,- openPublishToCommunityDialog,openRenameSkillDialog,publishToCommunityDisabledReason,} from './skillSceneComponents'diff --git a/products/skills/frontend/LLMSkillsScene.tsx b/products/skills/frontend/LLMSkillsScene.tsxindex e1ba50290352..141dde10b667 100644--- a/products/skills/frontend/LLMSkillsScene.tsx+++ b/products/skills/frontend/LLMSkillsScene.tsx@@ -8,6 +8,7 @@ import { LemonDivider, LemonModal, LemonSwitch, LemonTag, Link } from '@posthog/import { AccessControlAction } from 'lib/components/AccessControlAction'import { CodeSnippet, Language } from 'lib/components/CodeSnippet/CodeSnippet'import { MemberSelect } from 'lib/components/MemberSelect'+import { openPublishToCommunityDialog } from 'lib/components/openPublishToCommunityDialog'import { FEATURE_FLAGS } from 'lib/constants'import { dayjs } from 'lib/dayjs'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'@@ -35,7 +36,7 @@ import { llmSkillsEmptyState } from './emptyState/llmSkillsEmptyState'import { SKILLS_GROUP_LIMIT, SKILLS_PER_PAGE, SkillGroupNode, SkillGroupTree, llmSkillsLogic } from './llmSkillsLogic'import { ShareSkillMenuItem } from './ShareSkillMenuItem'import { SKILL_NAME_MAX_LENGTH, validateSkillName } from './skillConstants'-import { openArchiveSkillDialog, openPublishToCommunityDialog } from './skillSceneComponents'+import { openArchiveSkillDialog } from './skillSceneComponents'import { SkillsSceneShell } from './SkillsSceneShell'export const scene: SceneExport = {diff --git a/products/skills/frontend/PublishToCommunityContents.tsx b/products/skills/frontend/PublishToCommunityContents.tsxindex aeab093c38bd..c4c0b5f6d39b 100644--- a/products/skills/frontend/PublishToCommunityContents.tsx+++ b/products/skills/frontend/PublishToCommunityContents.tsx@@ -12,13 +12,15 @@ import { skillPublishPreviewLogic } from './skillPublishPreviewLogic'export function PublishToCommunityContents({skillName,+ teamId,onPreviewChange,}: {skillName: string+ teamId?: numberonPreviewChange: (preview: LLMSkillApi | null) => void}): JSX.Element {- const { publishPreview, publishPreviewLoading } = useValues(skillPublishPreviewLogic({ skillName }))- const { loadPublishPreview } = useActions(skillPublishPreviewLogic({ skillName }))+ const { publishPreview, publishPreviewLoading } = useValues(skillPublishPreviewLogic({ skillName, teamId }))+ const { loadPublishPreview } = useActions(skillPublishPreviewLogic({ skillName, teamId }))useEffect(() => {onPreviewChange(publishPreview)diff --git a/products/skills/frontend/communitySkillUtils.test.ts b/products/skills/frontend/communitySkillUtils.test.tsnew file mode 100644index 000000000000..9e0291edab98--- /dev/null+++ b/products/skills/frontend/communitySkillUtils.test.ts@@ -0,0 +1,12 @@+import { communityScoutCadenceLabel } from './communitySkillUtils'++describe('communityScoutCadenceLabel', () => {+ it.each([+ [90, 'Runs every 90 minutes'],+ [1439, 'Runs every 1439 minutes'],+ [2160, 'Runs every 36 hours'],+ [2880, 'Runs every 2 days'],+ ])('keeps the exact cadence for %i minutes', (run_interval_minutes, expected) => {+ expect(communityScoutCadenceLabel({ run_interval_minutes })).toBe(expected)+ })+})diff --git a/products/skills/frontend/communitySkillUtils.ts b/products/skills/frontend/communitySkillUtils.tsnew file mode 100644index 000000000000..4cee3f2a35d3--- /dev/null+++ b/products/skills/frontend/communitySkillUtils.ts@@ -0,0 +1,16 @@+import type { CommunitySkillScoutConfigApi } from './generated/api.schemas'++export function communityScoutCadenceLabel(config: CommunitySkillScoutConfigApi | undefined): string {+ if (config?.run_cron_schedule) {+ return 'Runs on a set schedule'+ }+ const minutes = config?.run_interval_minutes ?? 1440+ if (minutes < 60 || minutes % 60 !== 0) {+ return `Runs every ${minutes} minutes`+ }+ if (minutes < 1440 || minutes % 1440 !== 0) {+ return `Runs every ${minutes / 60} hours`+ }+ const days = minutes / 1440+ return days === 1 ? 'Runs daily' : `Runs every ${days} days`+}diff --git a/products/skills/frontend/communitySkillsLogic.test.ts b/products/skills/frontend/communitySkillsLogic.test.tsindex 633181423248..436a9da71907 100644--- a/products/skills/frontend/communitySkillsLogic.test.ts+++ b/products/skills/frontend/communitySkillsLogic.test.ts@@ -7,8 +7,10 @@ import { ApiError } from '~/lib/api-error'import { urls } from '~/scenes/urls'import { initKeaTests } from '~/test/init'+import { decodeScoutCreateTemplate } from 'products/signals/frontend/inbox/utils/scoutTemplateDeepLink'+import { communitySkillsLogic } from './communitySkillsLogic'-import { communitySkillsInstallCreate, communitySkillsList } from './generated/api'+import { communitySkillsInstallCreate, communitySkillsList, communitySkillsRenderCreate } from './generated/api'jest.mock('lib/lemon-ui/LemonToast/LemonToast', () => ({lemonToast: { error: jest.fn(), success: jest.fn(), info: jest.fn() },@@ -17,11 +19,13 @@ jest.mock('lib/lemon-ui/LemonToast/LemonToast', () => ({jest.mock('./generated/api', () => ({communitySkillsInstallCreate: jest.fn(),communitySkillsList: jest.fn(),+ communitySkillsRenderCreate: jest.fn(),communitySkillsVoteCreate: jest.fn(),}))const mockList = communitySkillsList as jest.MockedFunction<typeof communitySkillsList>const mockInstall = communitySkillsInstallCreate as jest.MockedFunction<typeof communitySkillsInstallCreate>+const mockRender = communitySkillsRenderCreate as jest.MockedFunction<typeof communitySkillsRenderCreate>describe('communitySkillsLogic', () => {let logic: ReturnType<typeof communitySkillsLogic.build>@@ -68,4 +72,103 @@ describe('communitySkillsLogic', () => {expect(lemonToast.error).toHaveBeenCalledWith(expectedMessage)})++ it('hands a scout to the create form prefilled, without creating anything', async () => {+ mockRender.mockResolvedValue({+ slug: 'signals-scout-feed',+ kind: 'scout',+ name: 'Feed scout',+ description: 'Watch a feed for problems.',+ body: `# Scout\n${'x'.repeat(20_000)}`,+ scout_config: { run_interval_minutes: 720, emit: false },+ variable_bindings: {},+ })+ logic = communitySkillsLogic()+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadSkillsSuccess'])++ logic.actions.setUpScout('signals-scout-feed')+ await expectLogic(logic).toDispatchActions(['setUpScoutSuccess'])++ expect(mockInstall).not.toHaveBeenCalled()+ expect(router.values.location.pathname).toContain('/inbox/config')+ expect(decodeScoutCreateTemplate(router.values.hashParams.createScout)).toEqual({+ display_name: 'Feed scout',+ description: 'Watch a feed for problems.',+ body: `# Scout\n${'x'.repeat(20_000)}`,+ config: { run_interval_minutes: 720, emit: false, mcp_gateway_server_ids: [] },+ })+ expect(String(router.values.hashParams.createScout)).toHaveLength(43)+ })++ it('refuses an entry the catalog no longer calls a scout', async () => {+ // The catalog syncs hourly, so an open card can outlive the kind it was rendered from.+ mockRender.mockResolvedValue({+ slug: 'signals-scout-feed',+ kind: 'skill',+ name: 'Feed scout',+ description: 'Watch a feed for problems.',+ body: '# Scout',+ scout_config: {},+ variable_bindings: {},+ })+ logic = communitySkillsLogic()+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadSkillsSuccess'])++ logic.actions.setUpScout('signals-scout-feed')+ await expectLogic(logic).toDispatchActions(['setUpScoutFailure'])++ expect(router.values.location.pathname).not.toContain('/inbox/config')+ expect(lemonToast.error).toHaveBeenCalledWith(+ 'This entry is no longer a scout. Refresh the store and try again.'+ )+ })++ it('lets the scout asked for last win when an earlier render finishes after it', async () => {+ const scout = (slug: string, name: string): any => ({+ slug,+ kind: 'scout',+ name,+ description: `${name} description`,+ body: `# ${name}`,+ scout_config: {},+ variable_bindings: {},+ })+ let finishFirst: (value: any) => void = () => {}+ mockRender+ .mockImplementationOnce(() => new Promise((resolve) => (finishFirst = resolve)))+ .mockImplementationOnce(() => Promise.resolve(scout('signals-scout-second', 'Second scout')))+ logic = communitySkillsLogic()+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadSkillsSuccess'])++ logic.actions.setUpScout('signals-scout-first')+ logic.actions.setUpScout('signals-scout-second')+ await expectLogic(logic).toDispatchActions(['setUpScoutSuccess'])++ finishFirst(scout('signals-scout-first', 'First scout'))+ await expectLogic(logic).toFinishAllListeners()++ // The slower first render must not replace the form the person asked for last.+ expect(decodeScoutCreateTemplate(router.values.hashParams.createScout)).toMatchObject({+ display_name: 'Second scout',+ })+ expect(logic.values.settingUpSlugs['signals-scout-first']).toBe(false)+ })++ it('uses top rated as the default scout order', async () => {+ logic = communitySkillsLogic()+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadSkillsSuccess'])++ router.actions.push(urls.communitySkills(), { kind: 'scout' })+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.filters.order_by).toBe('-vote_count')+ expect(mockList).toHaveBeenLastCalledWith(+ expect.anything(),+ expect.objectContaining({ order_by: '-vote_count' })+ )+ })})diff --git a/products/skills/frontend/communitySkillsLogic.ts b/products/skills/frontend/communitySkillsLogic.tsindex b736ee43f919..5ae8880bfaa7 100644--- a/products/skills/frontend/communitySkillsLogic.ts+++ b/products/skills/frontend/communitySkillsLogic.ts@@ -1,4 +1,4 @@-import { MakeLogicType, actions, afterMount, kea, listeners, path, props, reducers, selectors } from 'kea'+import { MakeLogicType, actions, afterMount, isBreakpoint, kea, listeners, path, props, reducers, selectors } from 'kea'import { loaders } from 'kea-loaders'import { router, urlToAction } from 'kea-router'@@ -10,13 +10,22 @@ import { PaginationManual } from '~/lib/lemon-ui/PaginationControl'import { trackedActionToUrl } from '~/lib/logic/scenes/trackedActionToUrl'import { urls } from '~/scenes/urls'-import { communitySkillsInstallCreate, communitySkillsList, communitySkillsVoteCreate } from './generated/api'-import { CommunitySkillTrustTierEnumApi } from './generated/api.schemas'+import { INBOX_CONFIG_TAB_KEY } from 'products/signals/frontend/inbox/types'+import { storeCommunityScoutCreateTemplate } from 'products/signals/frontend/inbox/utils/scoutTemplateDeepLink'++import {+ communitySkillsInstallCreate,+ communitySkillsList,+ communitySkillsRenderCreate,+ communitySkillsVoteCreate,+} from './generated/api'+import { CommunitySkillKindEnumApi, CommunitySkillTrustTierEnumApi } from './generated/api.schemas'import type { CommunitySkillListApi, PaginatedCommunitySkillListListApi } from './generated/api.schemas'export const COMMUNITY_SKILLS_PER_PAGE = 30const TRUST_TIERS = Object.values(CommunitySkillTrustTierEnumApi)+const KINDS = Object.values(CommunitySkillKindEnumApi)export interface CommunitySkillFilters {page: number@@ -24,6 +33,7 @@ export interface CommunitySkillFilters {order_by: stringtag: stringtrust_tier: CommunitySkillTrustTierEnumApi | ''+ kind: CommunitySkillKindEnumApi | ''}// Filters can arrive from the URL, so anything that isn't a known tier falls back to "all tiers".@@ -31,13 +41,20 @@ function cleanTrustTier(value: unknown): CommunitySkillTrustTierEnumApi | '' {return TRUST_TIERS.find((tier) => tier === value) ?? ''}+// Filters can arrive from the URL, so anything that isn't a known kind falls back to "everything".+function cleanKind(value: unknown): CommunitySkillKindEnumApi | '' {+ return KINDS.find((kind) => kind === value) ?? ''+}+function cleanFilters(values: Partial<CommunitySkillFilters>): CommunitySkillFilters {+ const kind = cleanKind(values.kind)return {page: parseInt(String(values.page)) || 1,search: String(values.search || ''),- order_by: values.order_by || '-install_count',+ order_by: values.order_by || (kind === CommunitySkillKindEnumApi.Scout ? '-vote_count' : '-install_count'),tag: String(values.tag || ''),trust_tier: cleanTrustTier(values.trust_tier),+ kind,}}@@ -45,9 +62,13 @@ function cleanFilterUrlParams(filters: CommunitySkillFilters): Record<string, unreturn {page: filters.page === 1 ? undefined : filters.page,search: filters.search || undefined,- order_by: filters.order_by === '-install_count' ? undefined : filters.order_by,+ order_by:+ filters.order_by === (filters.kind === CommunitySkillKindEnumApi.Scout ? '-vote_count' : '-install_count')+ ? undefined+ : filters.order_by,tag: filters.tag || undefined,trust_tier: filters.trust_tier || undefined,+ kind: filters.kind || undefined,}}@@ -61,6 +82,7 @@ export interface communitySkillsLogicValues {installingSlugs: Record<string, boolean>pagination: PaginationManualrawFilters: Partial<CommunitySkillFilters> | null+ settingUpSlugs: Record<string, boolean>skills: PaginatedCommunitySkillListListApiskillsLoading: booleanvoteOverrides: Record<@@ -120,6 +142,19 @@ export interface communitySkillsLogicActions {filters: Partial<CommunitySkillFilters>merge: boolean}+ setUpScout: (+ slug: string,+ variables?: Record<string, string>+ ) => {+ slug: string+ variables: Record<string, string> | undefined+ }+ setUpScoutFailure: (slug: string) => {+ slug: string+ }+ setUpScoutSuccess: (slug: string) => {+ slug: string+ }toggleVote: (slug: string) => {slug: string}@@ -185,6 +220,9 @@ export const communitySkillsLogic = kea<communitySkillsLogicType>([}),installSkillSuccess: (slug: string) => ({ slug }),installSkillFailure: (slug: string) => ({ slug }),+ setUpScout: (slug: string, variables?: Record<string, string>) => ({ slug, variables }),+ setUpScoutSuccess: (slug: string) => ({ slug }),+ setUpScoutFailure: (slug: string) => ({ slug }),toggleVote: (slug: string) => ({ slug }),toggleVoteSuccess: (slug: string, voteResult: { has_voted: boolean; vote_count: number }) => ({slug,@@ -220,6 +258,14 @@ export const communitySkillsLogic = kea<communitySkillsLogicType>([installSkillFailure: (state, { slug }) => ({ ...state, [slug]: false }),},],+ settingUpSlugs: [+ {} as Record<string, boolean>,+ {+ setUpScout: (state, { slug }) => ({ ...state, [slug]: true }),+ setUpScoutSuccess: (state, { slug }) => ({ ...state, [slug]: false }),+ setUpScoutFailure: (state, { slug }) => ({ ...state, [slug]: false }),+ },+ ],votingSlugs: [{} as Record<string, boolean>,{@@ -244,6 +290,7 @@ export const communitySkillsLogic = kea<communitySkillsLogicType>([order_by: filters.order_by,tag: filters.tag,trust_tier: filters.trust_tier || undefined,+ kind: filters.kind || undefined,offset: Math.max(0, (filters.page - 1) * COMMUNITY_SKILLS_PER_PAGE),limit: COMMUNITY_SKILLS_PER_PAGE,})@@ -310,6 +357,50 @@ export const communitySkillsLogic = kea<communitySkillsLogicType>([}},+ // A scout can't be installed as a skill — it runs on a schedule under privileged scopes. So+ // render it server-side, then hand the result to the scout form, where a person reviews the+ // schedule and submits it.+ setUpScout: async ({ slug, variables }, breakpoint) => {+ try {+ const rendered = await communitySkillsRenderCreate(String(ApiConfig.getCurrentTeamId()), slug, {+ variables,+ })+ // A newer setup supersedes this one, so a slow render cannot replace the form the+ // person asked for last, or pull them back after they moved on.+ breakpoint()+ // The catalog syncs hourly, so an open card can name an entry that is no longer a+ // scout. The render response is the authority: without this the store would hand+ // ordinary skill instructions to the form that creates an auto-running scout.+ if (rendered.kind !== CommunitySkillKindEnumApi.Scout) {+ lemonToast.error('This entry is no longer a scout. Refresh the store and try again.')+ actions.setUpScoutFailure(slug)+ return+ }+ const template = storeCommunityScoutCreateTemplate({+ // The display name travels, the skill name does not: the create endpoint derives+ // an identifier from the display name and adds a suffix when the project already+ // holds that slug, so a local name clash resolves itself instead of returning+ // 409 against a field the form never shows.+ display_name: rendered.name,+ description: rendered.description,+ body: rendered.body,+ config: rendered.scout_config,+ })+ actions.setUpScoutSuccess(slug)+ router.actions.push(urls.inbox(INBOX_CONFIG_TAB_KEY), {}, { createScout: template })+ } catch (e) {+ if (e instanceof Error && isBreakpoint(e)) {+ // Superseded: clear this card so it stops spinning, and let the newer setup navigate.+ actions.setUpScoutFailure(slug)+ throw e+ }+ console.error('Failed to set up community scout', e)+ const detail = e instanceof ApiError ? e.detail : null+ lemonToast.error(detail || 'Could not open this scout. Try again in a moment.')+ actions.setUpScoutFailure(slug)+ }+ },+toggleVote: async ({ slug }) => {try {const result = await communitySkillsVoteCreate(String(ApiConfig.getCurrentTeamId()), slug)diff --git a/products/skills/frontend/generated/api.schemas.ts b/products/skills/frontend/generated/api.schemas.tsindex 6dedaecbe8a6..d215dee42271 100644--- a/products/skills/frontend/generated/api.schemas.ts+++ b/products/skills/frontend/generated/api.schemas.ts@@ -21,6 +21,43 @@ export const CommunitySkillTrustTierEnumApi = {Community: 'community',} as const+/**+ * * `skill` - Skill+ * * `scout` - Scout+ */+export type CommunitySkillKindEnumApi = (typeof CommunitySkillKindEnumApi)[keyof typeof CommunitySkillKindEnumApi]++export const CommunitySkillKindEnumApi = {+ Skill: 'skill',+ Scout: 'scout',+} as const++/**+ * The scout settings a published scout travels with. Every field is optional. An omitted field+ * means the scout-create form's own default applies.+ */+export interface CommunitySkillScoutConfigApi {+ /**+ * How often the scout runs, in minutes. Ignored when run_cron_schedule is set.+ * @minimum 30+ * @maximum 43200+ */+ run_interval_minutes?: number+ /**+ * Five-field cron expression for the scout's schedule, which takes precedence over the interval.+ * @maxLength 100+ */+ run_cron_schedule?: string+ /** Whether the scout writes its reports to the inbox. False means it runs as a dry run. */+ emit?: boolean+ /**+ * Tags used to group the scout in the fleet.+ * @maxItems 10+ * @items.maxLength 50+ */+ tags?: string[]+}+/*** One declared variable of a templated skill — the schema a client renders a form from.*/@@ -67,6 +104,13 @@ export interface CommunitySkillListApi {* * `verified` - Verified* * `community` - Community */trust_tier: CommunitySkillTrustTierEnumApi+ /** 'skill' installs into the project as a regular skill. 'scout' runs on a schedule, so it is set up through the scout form instead of being installed.+ *+ * * `skill` - Skill+ * * `scout` - Scout */+ kind: CommunitySkillKindEnumApi+ /** Schedule, emit posture and tags a scout travels with. Empty object for a skill. */+ scout_config: CommunitySkillScoutConfigApi/** GitHub handle (or name) of the contributor who published the skill. */readonly author_handle: string/** Link to the skill's source directory on GitHub. */@@ -135,6 +179,13 @@ export interface CommunitySkillApi {* * `verified` - Verified* * `community` - Community */trust_tier: CommunitySkillTrustTierEnumApi+ /** 'skill' installs into the project as a regular skill. 'scout' runs on a schedule, so it is set up through the scout form instead of being installed.+ *+ * * `skill` - Skill+ * * `scout` - Scout */+ kind: CommunitySkillKindEnumApi+ /** Schedule, emit posture and tags a scout travels with. Empty object for a skill. */+ scout_config: CommunitySkillScoutConfigApi/** GitHub handle (or name) of the contributor who published the skill. */readonly author_handle: string/** Link to the skill's source directory on GitHub. */@@ -340,6 +391,45 @@ export interface LLMSkillApi {readonly first_version_created_at: string}+/**+ * Values for a template skill's declared variables, as a {name: value} map. Required only when rendering a template (see the skill's `template_variables`); ignored for non-template skills.+ */+export type CommunitySkillRenderApiVariables = { [key: string]: string }++export interface CommunitySkillRenderApi {+ /** Values for a template skill's declared variables, as a {name: value} map. Required only when rendering a template (see the skill's `template_variables`); ignored for non-template skills. */+ variables?: CommunitySkillRenderApiVariables+}++/**+ * The {name: value} map the body was rendered with. Empty for a non-template skill.+ */+export type CommunitySkillRenderResponseApiVariableBindings = { [key: string]: string }++/**+ * A catalog entry with its template variables bound, for prefilling a create form. Nothing is+ * persisted by rendering — the caller submits the result through the product's own create path.+ */+export interface CommunitySkillRenderResponseApi {+ /** Slug of the rendered community skill. */+ slug: string+ /** Whether the rendered entry is a 'skill' or a 'scout'.+ *+ * * `skill` - Skill+ * * `scout` - Scout */+ kind: CommunitySkillKindEnumApi+ /** Display name of the community skill. */+ name: string+ /** What the skill does and when to use it. */+ description: string+ /** The SKILL.md instruction content, with template variables bound. */+ body: string+ /** Schedule, emit posture and tags to prefill a scout with. Empty object for a skill. */+ scout_config: CommunitySkillScoutConfigApi+ /** The {name: value} map the body was rendered with. Empty for a non-template skill. */+ variable_bindings: CommunitySkillRenderResponseApiVariableBindings+}+export interface CommunitySkillVoteResponseApi {/** Total upvotes after applying the toggle. */vote_count: number@@ -710,6 +800,13 @@ export interface LLMSkillPublishToCommunityApi {* @minimum 1*/expected_version: number+ /**+ * Category of the skill the publisher reviewed. Registering a skill as a scout changes its category without raising its version, so the version alone would let a skill reviewed as an ordinary one publish as a scout. The request returns 409 if the category changed. Omit it to skip that check.+ * @maxLength 64+ */+ expected_category?: string+ /** Schedule, emit posture and tags to publish alongside a scout, so it arrives in another project with its cadence intact. Rejected for a skill that is not a scout. */+ scout_config?: CommunitySkillScoutConfigApi/** Human-friendly display name for the community listing. Defaults to a title-cased skill slug. Must be a single line: it is used as the pull request title and commit message. */display_name?: string/**@@ -848,6 +945,14 @@ export interface LLMSkillSearchErrorApi {}export type CommunitySkillsListParams = {+ /**+ * Filter to skills or to scouts. Omit to return both.+ *+ * * `skill` - Skill+ * * `scout` - Scout+ * @minLength 1+ */+ kind?: CommunitySkillsListKind/*** Number of results to return per page.*/@@ -891,6 +996,13 @@ export type CommunitySkillsListParams = {trust_tier?: CommunitySkillsListTrustTier}+export type CommunitySkillsListKind = (typeof CommunitySkillsListKind)[keyof typeof CommunitySkillsListKind]++export const CommunitySkillsListKind = {+ Skill: 'skill',+ Scout: 'scout',+} as const+export type CommunitySkillsListTrustTier =(typeof CommunitySkillsListTrustTier)[keyof typeof CommunitySkillsListTrustTier]diff --git a/products/skills/frontend/generated/api.ts b/products/skills/frontend/generated/api.tsindex 5e761da31285..71ba53d0d1f7 100644--- a/products/skills/frontend/generated/api.ts+++ b/products/skills/frontend/generated/api.ts@@ -12,6 +12,8 @@ import type {CommunitySkillApi,CommunitySkillInstallApi,CommunitySkillPublishResultApi,+ CommunitySkillRenderApi,+ CommunitySkillRenderResponseApi,CommunitySkillVoteResponseApi,CommunitySkillsListParams,LLMSkillApi,@@ -119,6 +121,30 @@ export const communitySkillsInstallCreate = async (})}+export const getCommunitySkillsRenderCreateUrl = (projectId: string, slug: string) => {+ return `/api/projects/${projectId}/community_skills/${slug}/render/`+}++/**+ * Bind a catalog entry's template variables and return the text a create form starts from.+ *+ * Persists nothing, so it needs no more access than reading the catalog already does — the+ * result is prefill, and the caller creates the skill or scout through its own product's path.+ */+export const communitySkillsRenderCreate = async (+ projectId: string,+ slug: string,+ communitySkillRenderApi?: CommunitySkillRenderApi,+ options?: RequestInit+): Promise<CommunitySkillRenderResponseApi> => {+ return apiMutator<CommunitySkillRenderResponseApi>(getCommunitySkillsRenderCreateUrl(projectId, slug), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(communitySkillRenderApi),+ })+}+export const getCommunitySkillsVoteCreateUrl = (projectId: string, slug: string) => {return `/api/projects/${projectId}/community_skills/${slug}/vote/`}diff --git a/products/skills/frontend/generated/api.zod.ts b/products/skills/frontend/generated/api.zod.tsindex 3c2842f052ea..6967c2de69d0 100644--- a/products/skills/frontend/generated/api.zod.ts+++ b/products/skills/frontend/generated/api.zod.ts@@ -25,6 +25,21 @@ export const CommunitySkillsInstallCreateBody = /* @__PURE__ */ zod.object({),})+/**+ * Bind a catalog entry's template variables and return the text a create form starts from.+ *+ * Persists nothing, so it needs no more access than reading the catalog already does — the+ * result is prefill, and the caller creates the skill or scout through its own product's path.+ */+export const CommunitySkillsRenderCreateBody = /* @__PURE__ */ zod.object({+ variables: zod+ .record(zod.string(), zod.string())+ .optional()+ .describe(+ "Values for a template skill's declared variables, as a {name: value} map. Required only when rendering a template (see the skill's `template_variables`); ignored for non-template skills."+ ),+})+export const llmSkillsCreateBodyNameMax = 64export const llmSkillsCreateBodyDescriptionMax = 1024@@ -296,6 +311,17 @@ export const LlmSkillsNameFilesRenameCreateBody = /* @__PURE__ */ zod.object({),})+export const llmSkillsNamePublishCommunityCreateBodyExpectedCategoryMax = 64++export const llmSkillsNamePublishCommunityCreateBodyScoutConfigOneRunIntervalMinutesMin = 30+export const llmSkillsNamePublishCommunityCreateBodyScoutConfigOneRunIntervalMinutesMax = 43200++export const llmSkillsNamePublishCommunityCreateBodyScoutConfigOneRunCronScheduleMax = 100++export const llmSkillsNamePublishCommunityCreateBodyScoutConfigOneTagsItemMax = 50++export const llmSkillsNamePublishCommunityCreateBodyScoutConfigOneTagsMax = 10+export const llmSkillsNamePublishCommunityCreateBodyDisplayNameOneMax = 64export const llmSkillsNamePublishCommunityCreateBodyDisplayNameOneRegExp = new RegExp('^[^\\u0000-\\u001f\\u007f]\*$')@@ -316,6 +342,45 @@ export const LlmSkillsNamePublishCommunityCreateBody = /* @__PURE__ */ zod.objec.number().min(1).describe('Skill version that the publisher reviewed. The request returns 409 if the latest version changed.'),+ expected_category: zod+ .string()+ .max(llmSkillsNamePublishCommunityCreateBodyExpectedCategoryMax)+ .optional()+ .describe(+ 'Category of the skill the publisher reviewed. Registering a skill as a scout changes its category without raising its version, so the version alone would let a skill reviewed as an ordinary one publish as a scout. The request returns 409 if the category changed. Omit it to skip that check.'+ ),+ scout_config: zod+ .object({+ run_interval_minutes: zod+ .number()+ .min(llmSkillsNamePublishCommunityCreateBodyScoutConfigOneRunIntervalMinutesMin)+ .max(llmSkillsNamePublishCommunityCreateBodyScoutConfigOneRunIntervalMinutesMax)+ .optional()+ .describe('How often the scout runs, in minutes. Ignored when run_cron_schedule is set.'),+ run_cron_schedule: zod+ .string()+ .max(llmSkillsNamePublishCommunityCreateBodyScoutConfigOneRunCronScheduleMax)+ .optional()+ .describe(+ "Five-field cron expression for the scout's schedule, which takes precedence over the interval."+ ),+ emit: zod+ .boolean()+ .optional()+ .describe('Whether the scout writes its reports to the inbox. False means it runs as a dry run.'),+ tags: zod+ .array(zod.string().max(llmSkillsNamePublishCommunityCreateBodyScoutConfigOneTagsItemMax))+ .max(llmSkillsNamePublishCommunityCreateBodyScoutConfigOneTagsMax)+ .optional()+ .describe('Tags used to group the scout in the fleet.'),+ })+ .describe(+ "The scout settings a published scout travels with. Every field is optional. An omitted field\nmeans the scout-create form's own default applies."+ )+ .optional()+ .describe(+ 'Schedule, emit posture and tags to publish alongside a scout, so it arrives in another project with its cadence intact. Rejected for a skill that is not a scout.'+ ),display_name: zod.union([zoddiff --git a/products/skills/frontend/skillPublishPreviewLogic.ts b/products/skills/frontend/skillPublishPreviewLogic.tsindex c34e495206be..9026f0cca993 100644--- a/products/skills/frontend/skillPublishPreviewLogic.ts+++ b/products/skills/frontend/skillPublishPreviewLogic.ts@@ -8,6 +8,11 @@ import type { LLMSkillApi } from 'products/skills/frontend/generated/api.schemasexport interface SkillPublishPreviewLogicProps {skillName: string+ /**+ * Team the skill belongs to. A scout's skill is seeded on the canonical parent team, so the+ * scout page passes that; everything else leaves it unset and reads the current team.+ */+ teamId?: number}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -53,7 +58,7 @@ export type skillPublishPreviewLogicType = MakeLogicType<export const skillPublishPreviewLogic = kea<skillPublishPreviewLogicType>([path(['scenes', 'skills', 'skillPublishPreviewLogic']),props({} as SkillPublishPreviewLogicProps),- key((props) => props.skillName),+ key((props) => `${props.teamId ?? 'current'}:${props.skillName}`),loaders(({ props }) => ({publishPreview: [@@ -62,9 +67,11 @@ export const skillPublishPreviewLogic = kea<skillPublishPreviewLogicType>([loadPublishPreview: async () => {// body_length sits at its minimum: the dialog needs the manifest and the// version, never the body.- return await llmSkillsNameRetrieve(String(ApiConfig.getCurrentTeamId()), props.skillName, {- body_length: 1,- })+ return await llmSkillsNameRetrieve(+ String(props.teamId ?? ApiConfig.getCurrentTeamId()),+ props.skillName,+ { body_length: 1 }+ )},},],diff --git a/products/skills/frontend/skillSceneComponents.test.tsx b/products/skills/frontend/skillSceneComponents.test.tsxindex 92e9c2017a71..4fe456f81f90 100644--- a/products/skills/frontend/skillSceneComponents.test.tsx+++ b/products/skills/frontend/skillSceneComponents.test.tsx@@ -4,6 +4,7 @@ import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/reimport { Provider } from 'kea'import { Form } from 'kea-forms'+import { openPublishToCommunityDialog } from 'lib/components/openPublishToCommunityDialog'import { LemonDialog } from 'lib/lemon-ui/LemonDialog'import { LemonFormDialog } from 'lib/lemon-ui/LemonDialog/LemonDialog'import { lemonDialogLogic } from 'lib/lemon-ui/LemonDialog/lemonDialogLogic'@@ -13,7 +14,7 @@ import { initKeaTests } from '~/test/init'import { llmSkillsNameRetrieve } from 'products/skills/frontend/generated/api'import type { LLMSkillApi } from 'products/skills/frontend/generated/api.schemas'-import { openPublishToCommunityDialog, publishToCommunityDisabledReason } from './skillSceneComponents'+import { publishToCommunityDisabledReason } from './skillSceneComponents'jest.mock('products/skills/frontend/generated/api', () => ({llmSkillsNameRetrieve: jest.fn(),diff --git a/products/skills/frontend/skillSceneComponents.tsx b/products/skills/frontend/skillSceneComponents.tsxindex 9527df2e87cb..2d9f4d652650 100644--- a/products/skills/frontend/skillSceneComponents.tsx+++ b/products/skills/frontend/skillSceneComponents.tsx@@ -12,7 +12,6 @@ import { LemonDialog } from '~/lib/lemon-ui/LemonDialog'import type { SkillFormFileValues } from './llmSkillLogic'import { isSkill, llmSkillLogic } from './llmSkillLogic'-import { PublishToCommunityContents } from './PublishToCommunityContents'import { SKILL_NAME_MAX_LENGTH, validateSkillName } from './skillConstants'export { LLMSkillsScene } from './LLMSkillsScene'@@ -53,14 +52,6 @@ export function openRenameSkillDialog(skillName: string, onRename: (newName: str})}-interface PublishToCommunityOptions {- expected_skill_id: string- expected_version: number- display_name?: string- tags?: string[]- author_handle?: string-}-/** Owner-only on the backend, so mirror that here instead of letting a click come back a 403.* Shared so the list view and the single-skill view guard the trigger identically. */export function publishToCommunityDisabledReason({@@ -91,75 +82,6 @@ export function publishToCommunityDisabledReason({return undefined}-/** Collect the publish fields, then hand them to `onPublish`. Shared so the list view and the- * single-skill view open the identical dialog. */-export function openPublishToCommunityDialog({- skillName,- githubLogin,- onPublish,-}: {- skillName: string- githubLogin: string | null- onPublish: (skillName: string, options: PublishToCommunityOptions) => void-}): void {- let expectedSkill: { id: string; version: number } | null = null-- LemonDialog.openForm({- title: 'Publish to the PostHog community?',- description:- 'If approved for the PostHog catalog, all PostHog users can find and use this skill. Its contents will be public on GitHub immediately.',- initialValues: {- display_name: skillName.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 ?? '',- consent: false,- },- content: (- <div className="flex flex-col gap-2">- <PublishToCommunityContents- skillName={skillName}- onPreviewChange={(preview) => {- expectedSkill = preview ? { id: preview.id, version: preview.version } : null- }}- />- <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>- ),- errors: {- consent: (consent: boolean) =>- consent ? undefined : 'Review the skill and confirm that you can share it publicly',- },- primaryButtonProps: { children: 'Publish to community' },- onSubmit: ({ display_name, tags, author_handle }) => {- if (expectedSkill === null) {- return- }- onPublish(skillName, {- expected_skill_id: expectedSkill.id,- expected_version: expectedSkill.version,- display_name: display_name?.trim() || undefined,- tags: tags- ? tags- .split(',')- .map((t: string) => t.trim())- .filter(Boolean)- : undefined,- author_handle: author_handle?.trim() || undefined,- })- },- })-}-interface FileChanges {added: string[]removed: string[]diff --git a/products/skills/mcp/tools.yaml b/products/skills/mcp/tools.yamlindex 44f6cfc75015..cffebf1dc93e 100644--- a/products/skills/mcp/tools.yaml+++ b/products/skills/mcp/tools.yaml@@ -15,6 +15,9 @@ tools:community-skills-list:operation: community_skills_listenabled: false+ community-skills-render-create:+ operation: community_skills_render_create+ enabled: falsecommunity-skills-retrieve:operation: community_skills_retrieveenabled: falsediff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 9972e0255636..4f0c82a0c38c 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -21697,6 +21697,44 @@ export namespace Schemas {Community: 'community',} as const;+ /**+ * * `skill` - Skill+ * * `scout` - Scout+ */+ export type CommunitySkillKindEnum = typeof CommunitySkillKindEnum[keyof typeof CommunitySkillKindEnum];+++ export const CommunitySkillKindEnum = {+ Skill: 'skill',+ Scout: 'scout',+ } as const;++ /**+ * The scout settings a published scout travels with. Every field is optional. An omitted field+ * means the scout-create form's own default applies.+ */+ export interface CommunitySkillScoutConfig {+ /**+ * How often the scout runs, in minutes. Ignored when run_cron_schedule is set.+ * @minimum 30+ * @maximum 43200+ */+ run_interval_minutes?: number;+ /**+ * Five-field cron expression for the scout's schedule, which takes precedence over the interval.+ * @maxLength 100+ */+ run_cron_schedule?: string;+ /** Whether the scout writes its reports to the inbox. False means it runs as a dry run. */+ emit?: boolean;+ /**+ * Tags used to group the scout in the fleet.+ * @maxItems 10+ * @items.maxLength 50+ */+ tags?: string[];+ }+export interface CommunitySkillFileManifest {/** @maxLength 500 */path: string;@@ -21744,6 +21782,13 @@ export namespace Schemas {* * `verified` - Verified* * `community` - Community */trust_tier: CommunitySkillTrustTierEnum;+ /** 'skill' installs into the project as a regular skill. 'scout' runs on a schedule, so it is set up through the scout form instead of being installed.+ *+ * * `skill` - Skill+ * * `scout` - Scout */+ kind: CommunitySkillKindEnum;+ /** Schedule, emit posture and tags a scout travels with. Empty object for a skill. */+ scout_config: CommunitySkillScoutConfig;/** GitHub handle (or name) of the contributor who published the skill. */readonly author_handle: string;/** Link to the skill's source directory on GitHub. */@@ -21814,6 +21859,13 @@ export namespace Schemas {* * `verified` - Verified* * `community` - Community */trust_tier: CommunitySkillTrustTierEnum;+ /** 'skill' installs into the project as a regular skill. 'scout' runs on a schedule, so it is set up through the scout form instead of being installed.+ *+ * * `skill` - Skill+ * * `scout` - Scout */+ kind: CommunitySkillKindEnum;+ /** Schedule, emit posture and tags a scout travels with. Empty object for a skill. */+ scout_config: CommunitySkillScoutConfig;/** GitHub handle (or name) of the contributor who published the skill. */readonly author_handle: string;/** Link to the skill's source directory on GitHub. */@@ -21844,6 +21896,45 @@ export namespace Schemas {branch: string;}+ /**+ * Values for a template skill's declared variables, as a {name: value} map. Required only when rendering a template (see the skill's `template_variables`); ignored for non-template skills.+ */+ export type CommunitySkillRenderVariables = {[key: string]: string};++ export interface CommunitySkillRender {+ /** Values for a template skill's declared variables, as a {name: value} map. Required only when rendering a template (see the skill's `template_variables`); ignored for non-template skills. */+ variables?: CommunitySkillRenderVariables;+ }++ /**+ * The {name: value} map the body was rendered with. Empty for a non-template skill.+ */+ export type CommunitySkillRenderResponseVariableBindings = {[key: string]: string};++ /**+ * A catalog entry with its template variables bound, for prefilling a create form. Nothing is+ * persisted by rendering — the caller submits the result through the product's own create path.+ */+ export interface CommunitySkillRenderResponse {+ /** Slug of the rendered community skill. */+ slug: string;+ /** Whether the rendered entry is a 'skill' or a 'scout'.+ *+ * * `skill` - Skill+ * * `scout` - Scout */+ kind: CommunitySkillKindEnum;+ /** Display name of the community skill. */+ name: string;+ /** What the skill does and when to use it. */+ description: string;+ /** The SKILL.md instruction content, with template variables bound. */+ body: string;+ /** Schedule, emit posture and tags to prefill a scout with. Empty object for a skill. */+ scout_config: CommunitySkillScoutConfig;+ /** The {name: value} map the body was rendered with. Empty for a non-template skill. */+ variable_bindings: CommunitySkillRenderResponseVariableBindings;+ }+export interface CommunitySkillVoteResponse {/** Total upvotes after applying the toggle. */vote_count: number;@@ -55828,6 +55919,13 @@ export namespace Schemas {* @minimum 1*/expected_version: number;+ /**+ * Category of the skill the publisher reviewed. Registering a skill as a scout changes its category without raising its version, so the version alone would let a skill reviewed as an ordinary one publish as a scout. The request returns 409 if the category changed. Omit it to skip that check.+ * @maxLength 64+ */+ expected_category?: string;+ /** Schedule, emit posture and tags to publish alongside a scout, so it arrives in another project with its cadence intact. Rejected for a skill that is not a scout. */+ scout_config?: CommunitySkillScoutConfig;/** Human-friendly display name for the community listing. Defaults to a title-cased skill slug. Must be a single line: it is used as the pull request title and commit message. */display_name?: string;/**@@ -107553,6 +107651,14 @@ export namespace Schemas {} as const;export type CommunitySkillsListParams = {+ /**+ * Filter to skills or to scouts. Omit to return both.+ *+ * * `skill` - Skill+ * * `scout` - Scout+ * @minLength 1+ */+ kind?: CommunitySkillsListKind;/*** Number of results to return per page.*/@@ -107596,6 +107702,14 @@ export namespace Schemas {trust_tier?: CommunitySkillsListTrustTier;};+ export type CommunitySkillsListKind = typeof CommunitySkillsListKind[keyof typeof CommunitySkillsListKind];+++ export const CommunitySkillsListKind = {+ Skill: 'skill',+ Scout: 'scout',+ } as const;+export type CommunitySkillsListTrustTier = typeof CommunitySkillsListTrustTier[keyof typeof CommunitySkillsListTrustTier];