: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): Align skill versioning flow with prompts (#79558)
Juraj Majerik7e35cc4cf86f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 01ca0c6e0da9..63d10d8d7efc 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5367,17 +5367,17 @@ snapshots:scenes-app-ai-observability-sentiment--tag-positive--light:hash: v1.k794b7964.a89a05ca65812c28ec1b01e35aa4fc271a56c5d0ffd8fa3a9b9f479fd0f5cc3b.6ntaO7dlEBGxsnHCdx2Y7bfB28RtBznX3XNjcHdplZ8scenes-app-ai-observability-skills--skill-detail-side-by-side-above-2-xl-breakpoint--superwide--dark:- hash: v1.k794b7964.0b71e427447e98893f1de5f4bac45c8811ceb7aad657c4d69dc169401ce6d396.OMnjkU4gzH_Yn2xek7DWkbaGRi4rs9is5M2fdBfmEKs+ hash: v1.k794b7964.ad9d0b984ec3c4a23a2f1a3b863801892848d81684d99f1254b1104423028e41.cGKF-pISAWqt_Hz39QTszv-h1UihkgYmmTo8cig15Twscenes-app-ai-observability-skills--skill-detail-side-by-side-above-2-xl-breakpoint--superwide--light:- hash: v1.k794b7964.b7c43bc7433939b5c6c71d73f485b2235b8a35fb65e36337f3e000d4354e9920.RaNFDa-TakqKTWE3zBLfmQSb5u76pFm0iHa9TwcwGgE+ hash: v1.k794b7964.6e5e67c9285b77d544d4a771f361ee9bff7786412332d2a5b6cdff8520b39d60.jXK61KTlte4lIUEI716-eYZNCaDGwpnsBCAWmbsxev0scenes-app-ai-observability-skills--skill-detail-stacked-below-2-xl-breakpoint--medium--dark:- hash: v1.k794b7964.e1d1f0dd30420e1ac1175ef68348cbd2cff22e135026792e89ebc6350a7d7e63.8UNt9gPOfZYaBO8omhrIH7o2OVrGz_vqgrQlOk9brnc+ hash: v1.k794b7964.3382740befef136d1848a657a5af241d9ad9fa28c39bb7f02228d356263ce0d9.YDS-u2Dx3QPhq6edOhA2TATy1orZTELu1DoTJ3GwYs0scenes-app-ai-observability-skills--skill-detail-stacked-below-2-xl-breakpoint--medium--light:- hash: v1.k794b7964.313632f59abd630325767d3c0115cb09747e212f69e9a43915963cb16db1798f.sroetBczj_0c3HDeuAyctIscnkIFyvPuXRv6Tc8ZMG0+ hash: v1.k794b7964.b243b3fc389755a5586c6c49c52ce62cca5b1e558e72e98ccd3134b4721c16d8.2tekzbtC5vpPtN6mTvYWrrC5ynHek4O5FZyojwuCit0scenes-app-ai-observability-skills--skill-detail-stacked-below-2-xl-breakpoint--wide--dark:- hash: v1.k794b7964.a9fa6ce6aea13d5afa0501c5eac74556761609cbfcfb1b5f034e26482e249b60.ccYjYA-pQxq2Q6jPLESvwIQBTr7ApzGIPN7K0O6Kf6c+ hash: v1.k794b7964.d59b23ff7ea79d090453024be82f23d944c42ff4a001906865a888ef02c8eb37.TxhPOL7p3GoWUJTPtpZFIJTHhZg80I3ZFA6Tw9E2c8Uscenes-app-ai-observability-skills--skill-detail-stacked-below-2-xl-breakpoint--wide--light:- hash: v1.k794b7964.c11f045bc7ed6084b7f7f19bd99149c5111512aeb77416ef125fb1a41aeb77e8.98xhehD94Y0U5Psv6_cm1LcBdamkWuJOZUCT_LcPTls+ hash: v1.k794b7964.ca0464610a91d6c4c2d50c179ada7bb691d8fafc5c12f9a51905be5bb065d61b._OCu1SykTC84XfMECDhEOOcOsO8UWsp0zh8JTKoRYq0scenes-app-ai-observability-trace--full--dark:hash: v1.k794b7964.3ea0677df8e51f08cfd46ad1957c78cb0e0c14dff003b15959f9dc9434a239ca.GUZTGarCld-XKdmLqsfKRE1ZIWdWvfojoa2vHPGVVOAscenes-app-ai-observability-trace--full--light:diff --git a/products/skills/backend/api/skill_serializers.py b/products/skills/backend/api/skill_serializers.pyindex 0f71471f3664..a8884a1aed03 100644--- a/products/skills/backend/api/skill_serializers.py+++ b/products/skills/backend/api/skill_serializers.py@@ -291,6 +291,7 @@ PUBLISH_CONTENT_FIELDS = ("metadata","files","file_edits",+ "version_description",)@@ -367,10 +368,19 @@ class LLMSkillPublishSerializer(serializers.Serializer):"Required when publishing content changes; optional for an owner-only update (when omitted, ""owners are replaced without a concurrency check).",)+ version_description = serializers.CharField(+ max_length=400,+ required=False,+ allow_blank=True,+ help_text="Optional note describing what changed in this version. Shown in the version history.",+ )def validate_body(self, value: str) -> str:return validate_skill_body_size(value)+ def validate_version_description(self, value: str) -> str | None:+ return value.strip() or None+def validate_edits(self, value: list[dict[str, str]]) -> list[dict[str, str]]:if len(value) == 0:raise serializers.ValidationError("At least one edit operation is required.")@@ -468,6 +478,7 @@ class LLMSkillSerializer(serializers.ModelSerializer):"files","outline","version",+ "version_description","created_by","created_at","updated_at",@@ -485,6 +496,7 @@ class LLMSkillSerializer(serializers.ModelSerializer):"body_total_length","body_next_offset","version",+ "version_description","created_by","created_at","updated_at",@@ -505,6 +517,9 @@ class LLMSkillSerializer(serializers.ModelSerializer):"help_text": "Environment requirements (intended product, system packages, network access, etc.)."},"metadata": {"help_text": "Arbitrary key-value metadata."},+ "version_description": {+ "help_text": "Optional note describing what changed in this version. Set when the version is published."+ },}def get_is_latest(self, instance: LLMSkill) -> bool:@@ -688,6 +703,7 @@ class LLMSkillVersionSummarySerializer(serializers.ModelSerializer):fields = ["id","version",+ "version_description","created_by","created_at","is_latest",diff --git a/products/skills/backend/api/skill_services.py b/products/skills/backend/api/skill_services.pyindex 4997f9bddc09..d3fcea603d6e 100644--- a/products/skills/backend/api/skill_services.py+++ b/products/skills/backend/api/skill_services.py@@ -223,6 +223,7 @@ def publish_skill_version(files: list[dict[str, str]] | None = None,file_edits: list[dict[str, Any]] | None = None,base_version: int,+ version_description: str | None = None,) -> LLMSkill:with transaction.atomic():current_latest = (@@ -263,6 +264,7 @@ def publish_skill_version(category=current_latest.category,version=current_latest.version + 1,is_latest=True,+ version_description=version_description,created_by=user,)diff --git a/products/skills/backend/api/skills.py b/products/skills/backend/api/skills.pyindex 5154d7968808..64ff60aff68c 100644--- a/products/skills/backend/api/skills.py+++ b/products/skills/backend/api/skills.py@@ -467,6 +467,7 @@ class LLMSkillViewSet(files=payload.validated_data.get("files"),file_edits=payload.validated_data.get("file_edits"),base_version=payload.validated_data["base_version"],+ version_description=payload.validated_data.get("version_description"),)# Owners are keyed on the logical skill, so this runs only when the caller passed# `owners` — a plain body edit never touches ownership.@@ -523,6 +524,7 @@ class LLMSkillViewSet("allowed_tools_changed": payload.validated_data.get("allowed_tools") is not None,"metadata_changed": payload.validated_data.get("metadata") is not None,"owners_changed": owner_uuids is not None,+ "version_description_set": payload.validated_data.get("version_description") is not None,}logger.info("llma_skill_version_published",diff --git a/products/skills/backend/api/test/test_skills.py b/products/skills/backend/api/test/test_skills.pyindex 46196f02cf32..2bf662694e57 100644--- a/products/skills/backend/api/test/test_skills.py+++ b/products/skills/backend/api/test/test_skills.py@@ -479,6 +479,23 @@ class TestLLMSkillAPI(APIBaseTest):assert data["body"] == "# V2 - improved"assert data["is_latest"] is True+ def test_publish_stores_version_description(self):+ self.create_skill(name="described-skill", body="# V1")++ response = self.client.patch(+ self._url("name/described-skill"),+ data={"body": "# V2", "base_version": 1, "version_description": " Tightened the steps. "},+ format="json",+ )++ assert response.status_code == status.HTTP_200_OK+ assert response.json()["version_description"] == "Tightened the steps."++ resolve = self.client.get(self._url("resolve/name/described-skill"))+ versions = resolve.json()["versions"]+ assert versions[0]["version_description"] == "Tightened the steps."+ assert versions[1]["version_description"] is None+def test_publish_carries_forward_unchanged_fields(self):self.create_skill(name="carry-forward",diff --git a/products/skills/backend/migrations/0006_llmskill_version_description.py b/products/skills/backend/migrations/0006_llmskill_version_description.pynew file mode 100644index 000000000000..f2fc8985610b--- /dev/null+++ b/products/skills/backend/migrations/0006_llmskill_version_description.py@@ -0,0 +1,17 @@+# Generated by Django 5.2.17 on 2026-08-07 11:55++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("skills", "0005_communityskill"),+ ]++ operations = [+ migrations.AddField(+ model_name="llmskill",+ name="version_description",+ field=models.CharField(blank=True, max_length=400, null=True),+ ),+ ]diff --git a/products/skills/backend/migrations/max_migration.txt b/products/skills/backend/migrations/max_migration.txtindex 6d0a868709d6..6f8be68db3e8 100644--- a/products/skills/backend/migrations/max_migration.txt+++ b/products/skills/backend/migrations/max_migration.txt@@ -1 +1 @@-0005_communityskill+0006_llmskill_version_descriptiondiff --git a/products/skills/backend/models/skills.py b/products/skills/backend/models/skills.pyindex 332847305233..3bc629aa4487 100644--- a/products/skills/backend/models/skills.py+++ b/products/skills/backend/models/skills.py@@ -58,6 +58,7 @@ class LLMSkill(UUIDModel):# Versioning (same pattern as LLMPrompt)version = models.PositiveIntegerField(default=1)is_latest = models.BooleanField(default=True)+ version_description = models.CharField(max_length=400, null=True, blank=True)team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE)created_by = models.ForeignKey(diff --git a/products/skills/backend/tools/skills.py b/products/skills/backend/tools/skills.pyindex fcafb70a7a8a..e4c165c19f80 100644--- a/products/skills/backend/tools/skills.py+++ b/products/skills/backend/tools/skills.py@@ -110,7 +110,8 @@ UPDATE_SKILL_DESCRIPTION = """Publish a new version of an existing skill. Any fi# Other writable fields- `description`, `license`, `compatibility`, `allowed_tools`, `metadata`.- `file_edits`: per-file find/replace patches. Each entry targets one existing file by `path` with its own `edits`- list. Files not mentioned are carried forward unchanged. Cannot add, remove, or rename files."""+ list. Files not mentioned are carried forward unchanged. Cannot add, remove, or rename files.+- `version_description`: a short note on what changed and why — it is shown in the skill's version history."""ARCHIVE_SKILL_DESCRIPTION = """Archive every active version of a skill by name. This hides the skill from default lists and cannot be@@ -194,6 +195,10 @@ class UpdateSkillArgs(BaseModel):"Files not mentioned are carried forward unchanged. Cannot add, remove, or rename files."),)+ version_description: str | None = Field(+ default=None,+ description="Optional note (max 400 chars) on what changed and why. Shown in the skill's version history.",+ )class ArchiveSkillArgs(BaseModel):@@ -429,6 +434,7 @@ class UpdateLLMSkillTool(MaxTool):allowed_tools: list[str] | None = None,metadata: dict[str, Any] | None = None,file_edits: list[dict[str, Any]] | None = None,+ version_description: str | None = None,) -> tuple[str, None]:if body is not None and edits is not None:raise MaxToolFatalError("Pass either `body` or `edits`, not both.")@@ -448,6 +454,7 @@ class UpdateLLMSkillTool(MaxTool):files=None,file_edits=file_edits,base_version=base_version,+ version_description=(version_description or "").strip() or None,)except (LLMSkillNotFoundError,diff --git a/products/skills/frontend/LLMSkillScene.stories.tsx b/products/skills/frontend/LLMSkillScene.stories.tsxindex fc287da84d22..0f449881885d 100644--- a/products/skills/frontend/LLMSkillScene.stories.tsx+++ b/products/skills/frontend/LLMSkillScene.stories.tsx@@ -44,6 +44,7 @@ function makeVersion(version: number, isLatest: boolean): LLMSkillVersionSummaryreturn {id: `skill-version-${version}`,version,+ version_description: version === 4 ? 'Added OCR guidance for scanned PDFs' : null,is_latest: isLatest,created_at: `2025-01-${String(10 + version).padStart(2, '0')}T10:00:00Z`,created_by: MOCK_AUTHOR,@@ -80,6 +81,7 @@ const SKILL: LLMSkillApi = {{ level: 2, text: 'Notes' },],version: 4,+ version_description: 'Added OCR guidance for scanned PDFs',created_by: MOCK_AUTHOR,owners: [MOCK_AUTHOR],created_at: '2025-01-14T10:00:00Z',@@ -108,6 +110,7 @@ const SKILL_LIST_ENTRY: LLMSkillListApi = {category: SKILL.category,outline: SKILL.outline,version: SKILL.version,+ version_description: SKILL.version_description,created_by: SKILL.created_by,owners: SKILL.owners,created_at: SKILL.created_at,diff --git a/products/skills/frontend/LLMSkillScene.tsx b/products/skills/frontend/LLMSkillScene.tsxindex 6426d187c1fd..dc1927e6dc13 100644--- a/products/skills/frontend/LLMSkillScene.tsx+++ b/products/skills/frontend/LLMSkillScene.tsx@@ -10,7 +10,6 @@ import {IconDownload,IconPencil,IconPlus,- IconTrash,IconUpload,IconX,} from '@posthog/icons'@@ -21,6 +20,7 @@ import { CodeSnippet, Language } from 'lib/components/CodeSnippet/CodeSnippet'import { NotFound } from 'lib/components/NotFound'import { dayjs } from 'lib/dayjs'import { IconLink } from 'lib/lemon-ui/icons'+import { More } from 'lib/lemon-ui/LemonButton/More'import { LemonField } from 'lib/lemon-ui/LemonField'import { LemonInput } from 'lib/lemon-ui/LemonInput'import { LemonMarkdownWithMermaid } from 'lib/lemon-ui/LemonMarkdown/LemonMarkdownWithMermaid'@@ -46,7 +46,7 @@ import { SkillLogicProps, SkillMode, isSkill, llmSkillLogic } from './llmSkillLoimport { SKILL_NAME_MAX_LENGTH, SKILL_DESCRIPTION_MAX_LENGTH } from './skillConstants'import { skillFileLogic } from './skillFileLogic'import { collectFilesFromDrop } from './skillFileUpload'-import { openArchiveSkillDialog } from './skillSceneComponents'+import { SkillPublishReviewModal, openArchiveSkillDialog } from './skillSceneComponents'const MonacoDiffEditor = lazyWithRetry(() => import('lib/components/MonacoDiffEditor'))@@ -56,7 +56,8 @@ export const scene: SceneExport<SkillLogicProps> = {productKey: ProductKey.AI_OBSERVABILITY,paramsToProps: ({ params: { name }, searchParams }) => ({skillName: name && name !== 'new' ? name : 'new',- mode: searchParams?.edit === 'true' ? SkillMode.Edit : SkillMode.View,+ // kea-router JSON-decodes query values, so ?edit=true arrives as boolean true+ mode: String(searchParams?.edit) === 'true' ? SkillMode.Edit : SkillMode.View,selectedVersion: searchParams?.version ? Number(searchParams.version) || null : null,}),}@@ -77,11 +78,21 @@ export function LLMSkillScene(): JSX.Element {canLoadMoreVersions,fileContentsLoading,downloadingZip,+ isSkillFormDirty,+ nextVersion,} = useValues(llmSkillLogic)const { searchParams } = useValues(router)- const { submitSkillForm, deleteSkill, setMode, setSkillFormValues, loadMoreVersions, downloadSkill } =- useActions(llmSkillLogic)+ const {+ submitSkillForm,+ requestPublish,+ deleteSkill,+ setMode,+ setSkillFormValues,+ loadMoreVersions,+ downloadSkill,+ cancelEditing,+ } = useActions(llmSkillLogic)if (isSkillMissing) {return <NotFound object="skill" />@@ -97,7 +108,7 @@ export function LLMSkillScene(): JSX.Element {)}- // A direct link with `?edit=true` shouldn't grant edit access the Edit/Use-as-latest buttons+ // A direct link with `?edit=true` shouldn't grant edit access the New version button// wouldn't otherwise give — fall back to the read-only view when the user can't actually publish.const canEditSkill = userHasAccess(AccessControlResourceType.LlmSkill, AccessControlLevel.Editor)const content =@@ -109,48 +120,6 @@ export function LLMSkillScene(): JSX.Element {isLoading={skillLoading}actions={<>- {isSkill(skill) && skill.is_latest ? (- <AccessControlAction- resourceType={AccessControlResourceType.LlmSkill}- minAccessLevel={AccessControlLevel.Editor}- >- <LemonButton- type="primary"- icon={<IconPencil />}- onClick={() => setMode(SkillMode.Edit)}- size="small"- data-attr="llma-skill-edit-button"- >- Edit latest- </LemonButton>- </AccessControlAction>- ) : (- <AccessControlAction- resourceType={AccessControlResourceType.LlmSkill}- minAccessLevel={AccessControlLevel.Editor}- >- <LemonButton- type="primary"- onClick={() => {- if (isSkill(skill)) {- setSkillFormValues({- name: skill.name,- description: skill.description,- body: skill.body,- license: skill.license || '',- compatibility: skill.compatibility || '',- })- setMode(SkillMode.Edit)- }- }}- size="small"- data-attr="llma-skill-use-as-latest-button"- >- Use as latest- </LemonButton>- </AccessControlAction>- )}-{isSkill(skill) && (<LemonButtontype="secondary"@@ -170,16 +139,50 @@ export function LLMSkillScene(): JSX.Element {minAccessLevel={AccessControlLevel.Editor}><LemonButton- type="secondary"- status="danger"- icon={<IconTrash />}- onClick={() => openArchiveSkillDialog(deleteSkill)}+ type="primary"+ icon={<IconPencil />}+ onClick={() => {+ if (isSkill(skill)) {+ setSkillFormValues({+ name: skill.name,+ description: skill.description,+ body: skill.body,+ license: skill.license || '',+ compatibility: skill.compatibility || '',+ })+ setMode(SkillMode.Edit)+ }+ }}size="small"- data-attr="llma-skill-delete-button"+ tooltip={+ isHistoricalVersion+ ? 'Start a new version from this historical version'+ : undefined+ }+ data-attr="llma-skill-new-version-button">- Archive+ New version</LemonButton></AccessControlAction>++ <More+ size="small"+ overlay={+ <AccessControlAction+ resourceType={AccessControlResourceType.LlmSkill}+ minAccessLevel={AccessControlLevel.Editor}+ >+ <LemonButton+ status="danger"+ onClick={() => openArchiveSkillDialog(deleteSkill)}+ data-attr="llma-skill-delete-button"+ fullWidth+ >+ Archive+ </LemonButton>+ </AccessControlAction>+ }+ /></>}/>@@ -213,14 +216,8 @@ export function LLMSkillScene(): JSX.Element {<><LemonButtontype="secondary"- onClick={() => {- if (isNewSkill) {- router.actions.push(urls.skills())- } else {- setMode(SkillMode.View)- }- }}- disabledReason={isSkillFormSubmitting ? 'Saving...' : undefined}+ onClick={() => cancelEditing()}+ disabledReason={isSkillFormSubmitting ? 'Saving…' : undefined}size="small"data-attr="llma-skill-cancel-button">@@ -233,32 +230,23 @@ export function LLMSkillScene(): JSX.Element {><LemonButtontype="primary"- onClick={submitSkillForm}+ onClick={isNewSkill ? submitSkillForm : requestPublish}loading={isSkillFormSubmitting}+ disabledReason={+ !isNewSkill && !isHistoricalVersion && !isSkillFormDirty+ ? 'No changes to publish'+ : undefined+ }size="small"data-attr={isNewSkill ? 'skill-create-button' : 'skill-save-button'}>- {isNewSkill ? 'Create skill' : 'Publish version'}+ {isNewSkill+ ? 'Create skill'+ : nextVersion+ ? `Publish v${nextVersion}`+ : 'Publish version'}</LemonButton></AccessControlAction>-- {!isNewSkill && (- <AccessControlAction- resourceType={AccessControlResourceType.LlmSkill}- minAccessLevel={AccessControlLevel.Editor}- >- <LemonButton- type="secondary"- status="danger"- icon={<IconTrash />}- onClick={() => openArchiveSkillDialog(deleteSkill)}- size="small"- data-attr="llma-skill-delete-button"- >- Archive- </LemonButton>- </AccessControlAction>- )}</>}/>@@ -267,8 +255,10 @@ export function LLMSkillScene(): JSX.Element {<div className="min-w-0 flex-1"><SkillEditFormisHistoricalVersion={isHistoricalVersion}+ selectedVersion={isSkill(skill) ? skill.version : null}fileContentsLoading={fileContentsLoading}/>+ <SkillPublishReviewModal /></div>{!isNewSkill && (@@ -280,6 +270,7 @@ export function LLMSkillScene(): JSX.Element {canLoadMoreVersions={canLoadMoreVersions}loadMoreVersions={loadMoreVersions}searchParams={searchParams ?? {}}+ readOnly/>)}</div>@@ -333,6 +324,11 @@ function SkillViewDetails(): JSX.Element {Historical</LemonTag>)}+ {skill.version_description ? (+ <span className="text-secondary text-sm italic" data-attr="llma-skill-version-description">+ “{skill.version_description}”+ </span>+ ) : null}<span className="text-secondary text-sm">This skill has {skill.version_count} published version{skill.version_count === 1 ? '' : 's'}.</span>@@ -688,12 +684,14 @@ const COMMON_CONTENT_TYPES = [function SkillEditForm({isHistoricalVersion,+ selectedVersion,fileContentsLoading,}: {isHistoricalVersion: boolean+ selectedVersion: number | nullfileContentsLoading: boolean}): JSX.Element {- const { isNewSkill, skillForm } = useValues(llmSkillLogic)+ const { isNewSkill, skillForm, publishConflict } = useValues(llmSkillLogic)const { setSkillFormValues, addUploadedFiles } = useActions(llmSkillLogic)const uploadInputRef = useRef<HTMLInputElement | null>(null)// Depth counter instead of a boolean: dragenter/dragleave also fire for child elements,@@ -753,12 +751,21 @@ function SkillEditForm({return (<div className="mt-4 max-w-3xl space-y-4">- {isHistoricalVersion && (- <div className="rounded border border-warning bg-warning-highlight p-3 text-sm">- You are publishing a new latest version from a historical version. The original version will remain- unchanged.- </div>- )}+ {publishConflict ? (+ <LemonBanner type="warning" data-attr="llma-skill-publish-conflict-banner">+ {publishConflict.latestVersion+ ? `v${publishConflict.latestVersion} was published while you were editing.`+ : 'This skill changed while you were editing.'}{' '}+ Your edits below are preserved. Review them before publishing again.+ </LemonBanner>+ ) : null}++ {isHistoricalVersion && selectedVersion ? (+ <LemonBanner type="info">+ You are publishing a new latest version from historical version v{selectedVersion}. The original+ version will remain unchanged.+ </LemonBanner>+ ) : null}<LemonFieldname="name"@@ -988,6 +995,7 @@ function SkillVersionSidebar({canLoadMoreVersions,loadMoreVersions,searchParams,+ readOnly = false,}: {skillName: stringskill: { id: string; version: number; version_count: number } | null@@ -996,6 +1004,7 @@ function SkillVersionSidebar({canLoadMoreVersions: booleanloadMoreVersions: () => voidsearchParams: Record<string, any>+ readOnly?: boolean}): JSX.Element {const { compareVersion } = useValues(llmSkillLogic)const { setCompareVersion } = useActions(llmSkillLogic)@@ -1016,7 +1025,7 @@ function SkillVersionSidebar({{versions.map((versionSkill) => {const selected = skill?.id === versionSkill.idconst isCompareTarget = compareVersion === versionSkill.version- const canCompare = skill?.version !== versionSkill.version+ const canCompare = !readOnly && skill?.version !== versionSkill.versionconst cleanedParams = { ...searchParams }delete cleanedParams.editconst versionUrl = combineUrl(urls.skill(skillName), {@@ -1024,19 +1033,8 @@ function SkillVersionSidebar({version: versionSkill.is_latest ? undefined : versionSkill.version,}).url- return (- <Link- key={versionSkill.id}- to={versionUrl}- className={`block rounded border p-3 no-underline ${- selected- ? 'border-primary bg-primary-highlight'- : isCompareTarget- ? 'border-warning bg-warning-highlight'- : 'border-primary/10 hover:bg-fill-secondary'- }`}- data-attr={`llma-skill-version-link-${versionSkill.version}`}- >+ const cardContent = (+ <><div className="mb-1 flex items-center justify-between"><div className="flex items-center gap-2"><span className="font-mono text-sm">v{versionSkill.version}</span>@@ -1070,12 +1068,48 @@ function SkillVersionSidebar({/>)}</div>+ {versionSkill.version_description ? (+ <div className="mb-1 line-clamp-2 text-xs" title={versionSkill.version_description}>+ {versionSkill.version_description}+ </div>+ ) : null}<div className="text-xs text-secondary">{dayjs(versionSkill.created_at).format('MMM D, YYYY h:mm A')}</div>{versionSkill.created_by?.email ? (<div className="mt-1 text-xs text-secondary">{versionSkill.created_by.email}</div>) : null}+ </>+ )++ const cardClassName = `block rounded border p-3 no-underline ${+ selected+ ? 'border-primary bg-primary-highlight'+ : isCompareTarget+ ? 'border-warning bg-warning-highlight'+ : readOnly+ ? 'border-primary/10 opacity-75'+ : 'border-primary/10 hover:bg-fill-secondary'+ }`++ // The selected version is not a link: navigating to the version already+ // shown would only trigger a pointless reload.+ if (readOnly || selected) {+ return (+ <div key={versionSkill.id} className={cardClassName}>+ {cardContent}+ </div>+ )+ }++ return (+ <Link+ key={versionSkill.id}+ to={versionUrl}+ className={cardClassName}+ data-attr={`llma-skill-version-link-${versionSkill.version}`}+ >+ {cardContent}</Link>)})}diff --git a/products/skills/frontend/generated/api.schemas.ts b/products/skills/frontend/generated/api.schemas.tsindex a1353af4d23d..137e7ad6a2c6 100644--- a/products/skills/frontend/generated/api.schemas.ts+++ b/products/skills/frontend/generated/api.schemas.ts@@ -116,6 +116,11 @@ export interface LLMSkillListApi {/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */readonly outline: readonly LLMSkillOutlineEntryApi[]readonly version: number+ /**+ * Optional note describing what changed in this version. Set when the version is published.+ * @nullable+ */+ readonly version_description: string | nullreadonly created_by: UserBasicApireadonly created_at: stringreadonly updated_at: string@@ -205,6 +210,11 @@ export interface LLMSkillCreateApi {/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */readonly outline: readonly LLMSkillOutlineEntryApi[]readonly version: number+ /**+ * Optional note describing what changed in this version. Set when the version is published.+ * @nullable+ */+ readonly version_description: string | nullreadonly created_by: UserBasicApireadonly created_at: stringreadonly updated_at: string@@ -271,6 +281,11 @@ export interface LLMSkillApi {/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */readonly outline: readonly LLMSkillOutlineEntryApi[]readonly version: number+ /**+ * Optional note describing what changed in this version. Set when the version is published.+ * @nullable+ */+ readonly version_description: string | nullreadonly created_by: UserBasicApireadonly created_at: stringreadonly updated_at: string@@ -421,6 +436,11 @@ export interface PatchedLLMSkillPublishApi {* @minimum 1*/base_version?: number+ /**+ * Optional note describing what changed in this version. Shown in the version history.+ * @maxLength 400+ */+ version_description?: string}export interface LLMSkillDuplicateApi {@@ -480,6 +500,8 @@ export interface LLMSkillFileApi {export interface LLMSkillVersionSummaryApi {readonly id: stringreadonly version: number+ /** @nullable */+ readonly version_description: string | nullreadonly created_by: UserBasicApireadonly created_at: stringreadonly is_latest: booleandiff --git a/products/skills/frontend/generated/api.zod.ts b/products/skills/frontend/generated/api.zod.tsindex 1ebcda73db6b..0cc143cdd704 100644--- a/products/skills/frontend/generated/api.zod.ts+++ b/products/skills/frontend/generated/api.zod.ts@@ -118,6 +118,8 @@ export const llmSkillsNamePartialUpdateBodyFileEditsItemPathMax = 500export const llmSkillsNamePartialUpdateBodyOwnersMax = 25+export const llmSkillsNamePartialUpdateBodyVersionDescriptionMax = 400+export const LlmSkillsNamePartialUpdateBody = /* @__PURE__ */ zod.object({body: zod.string()@@ -212,6 +214,11 @@ export const LlmSkillsNamePartialUpdateBody = /* @__PURE__ */ zod.object({.describe('Latest version you are editing from. Used for optimistic concurrency checks. Required when publishing content changes; optional for an owner-only update (when omitted, owners are replaced without a concurrency check).'),+ version_description: zod+ .string()+ .max(llmSkillsNamePartialUpdateBodyVersionDescriptionMax)+ .optional()+ .describe('Optional note describing what changed in this version. Shown in the version history.'),})export const llmSkillsNameDuplicateCreateBodyNewNameMax = 64diff --git a/products/skills/frontend/llmSkillLogic.test.ts b/products/skills/frontend/llmSkillLogic.test.tsindex 912521cef6d4..321c0ae0a89f 100644--- a/products/skills/frontend/llmSkillLogic.test.ts+++ b/products/skills/frontend/llmSkillLogic.test.ts@@ -2,88 +2,250 @@ import { expectLogic } from 'kea-test-utils'import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'+import { ApiError } from '~/lib/api-error'import { initKeaTests } from '~/test/init'-import { llmSkillLogic } from './llmSkillLogic'+import {+ llmSkillsNameFilesRetrieve,+ llmSkillsNamePartialUpdate,+ llmSkillsResolveNameRetrieve,+} from 'products/skills/frontend/generated/api'+import type { LLMSkillApi, LLMSkillResolveResponseApi } from 'products/skills/frontend/generated/api.schemas'++import { SkillMode, llmSkillLogic } from './llmSkillLogic'+import type { ResolvedLLMSkill } from './llmSkillLogic'import type { SkillFileUpload } from './skillFileUpload'jest.mock('lib/lemon-ui/LemonToast/LemonToast', () => ({lemonToast: { error: jest.fn(), success: jest.fn(), info: jest.fn() },}))-describe('llmSkillLogic file uploads', () => {- let logic: ReturnType<typeof llmSkillLogic.build>-- beforeEach(() => {- jest.clearAllMocks()- initKeaTests()- logic = llmSkillLogic({ skillName: 'new' })- logic.mount()- })-- afterEach(() => {- logic?.unmount()- })-- const asUpload = (content: string, path: string): SkillFileUpload => ({- path,- file: new File([content], path.split('/').pop() ?? path),- })-- const upload = async (files: SkillFileUpload[]): Promise<void> => {- await expectLogic(logic, () => logic.actions.addUploadedFiles(files)).toFinishAllListeners()- }-- it('adds uploaded files to the form, preserving folder paths and inferring content types', async () => {- await upload([asUpload('print("hi")', 'scripts/setup.py'), asUpload('# Guide', 'references/guide.md')])-- expect(logic.values.skillForm.files).toEqual([- { path: 'scripts/setup.py', content: 'print("hi")', content_type: 'text/x-python' },- { path: 'references/guide.md', content: '# Guide', content_type: 'text/markdown' },- ])- })-- it('re-uploading a path replaces its row instead of duplicating it', async () => {- await upload([asUpload('v1', 'notes.txt'), asUpload('extra', 'extra.txt')])- await upload([asUpload('v2', 'notes.txt')])-- expect(logic.values.skillForm.files).toEqual([- { path: 'notes.txt', content: 'v2', content_type: 'text/plain' },- { path: 'extra.txt', content: 'extra', content_type: 'text/plain' },- ])- })+jest.mock('products/skills/frontend/generated/api', () => ({+ llmSkillsCreate: jest.fn(),+ llmSkillsNameArchiveCreate: jest.fn(),+ llmSkillsNameFilesRetrieve: jest.fn(),+ llmSkillsNamePartialUpdate: jest.fn(),+ llmSkillsResolveNameRetrieve: jest.fn(),+}))- it('rejects oversized, binary, and SKILL.md files with a toast but keeps valid ones', async () => {- await upload([- { path: 'big.txt', file: new File([new ArrayBuffer(1_000_001)], 'big.txt') },- asUpload('\u0000binary', 'nul.txt'),- { path: 'invalid-utf8.txt', file: new File([new Uint8Array([0xc3, 0x28])], 'invalid-utf8.txt') },- asUpload('has a \ufffd char', 'replacement.txt'),- asUpload('# My skill', 'Skill.md'),- asUpload('ok', 'ok.txt'),- ])-- expect(logic.values.skillForm.files).toEqual([- { path: 'replacement.txt', content: 'has a \ufffd char', content_type: 'text/plain' },- { path: 'ok.txt', content: 'ok', content_type: 'text/plain' },- ])- expect(jest.mocked(lemonToast.error).mock.calls.map(([message]) => message)).toEqual([- "Couldn't add big.txt: files must be 1 MB or smaller",- "Couldn't add nul.txt: only text files are supported",- "Couldn't add invalid-utf8.txt: only text files are supported",- ])- expect(jest.mocked(lemonToast.info)).toHaveBeenCalledWith(- "SKILL.md wasn't added as a bundled file. Its body belongs in the skill body field."- )+const mockPartialUpdate = llmSkillsNamePartialUpdate as jest.MockedFunction<typeof llmSkillsNamePartialUpdate>+const mockResolve = llmSkillsResolveNameRetrieve as jest.MockedFunction<typeof llmSkillsResolveNameRetrieve>+const mockFilesRetrieve = llmSkillsNameFilesRetrieve as jest.MockedFunction<typeof llmSkillsNameFilesRetrieve>++const MOCK_FILE = { path: 'scripts/run.sh', content: 'echo hi', content_type: 'text/x-shellscript' }++const mockSkill = {+ id: 'skill-version-2',+ name: 'my-test-skill',+ description: 'Does useful things.',+ body: '# My skill',+ license: '',+ compatibility: '',+ allowed_tools: [],+ metadata: {},+ version: 2,+ version_description: null,+ latest_version: 2,+ version_count: 2,+ first_version_created_at: '2024-01-01T00:00:00Z',+ is_latest: true,+ deleted: false,+ created_at: '2024-01-02T00:00:00Z',+ updated_at: '2024-01-02T00:00:00Z',+ created_by: { id: 1, email: '[email protected]' },+ files: [{ path: MOCK_FILE.path, content_type: MOCK_FILE.content_type }],+ body_total_length: 10,+ body_next_offset: null,+ versions: [+ {+ id: 'skill-version-2',+ version: 2,+ version_description: null,+ created_by: { id: 1, email: '[email protected]' },+ created_at: '2024-01-02T00:00:00Z',+ is_latest: true,+ },+ {+ id: 'skill-version-1',+ version: 1,+ version_description: null,+ created_by: { id: 1, email: '[email protected]' },+ created_at: '2024-01-01T00:00:00Z',+ is_latest: false,+ },+ ],+ has_more: false,+} as unknown as ResolvedLLMSkill++describe('llmSkillLogic', () => {+ describe('publish flow', () => {+ let logic: ReturnType<typeof llmSkillLogic.build>++ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ mockFilesRetrieve.mockResolvedValue(MOCK_FILE)+ })++ afterEach(() => {+ logic?.unmount()+ })++ const resolveResponse = (skill: ResolvedLLMSkill): LLMSkillResolveResponseApi => {+ const { versions, has_more, ...skillFields } = skill+ return { skill: skillFields, versions, has_more } as unknown as LLMSkillResolveResponseApi+ }++ it('opens the review modal on requestPublish and sends the version description on publish', async () => {+ mockResolve.mockResolvedValue(resolveResponse(mockSkill))+ mockPartialUpdate.mockResolvedValue({+ ...mockSkill,+ id: 'skill-version-3',+ version: 3,+ latest_version: 3,+ version_description: 'Added a troubleshooting section',+ } as unknown as LLMSkillApi)++ logic = llmSkillLogic({ skillName: 'my-test-skill' })+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadSkillSuccess'])++ logic.actions.setMode(SkillMode.Edit)+ await expectLogic(logic).toFinishAllListeners()+ logic.actions.setSkillFormValues({ body: '# My skill, improved' })++ logic.actions.requestPublish()+ expect(logic.values.isPublishReviewOpen).toBe(true)+ expect(mockPartialUpdate).not.toHaveBeenCalled()++ logic.actions.setVersionDescription('Added a troubleshooting section')+ logic.actions.submitSkillForm()+ await expectLogic(logic).toDispatchActions(['submitSkillFormSuccess'])++ expect(mockPartialUpdate).toHaveBeenCalledWith(+ expect.anything(),+ 'my-test-skill',+ expect.objectContaining({+ body: '# My skill, improved',+ base_version: 2,+ version_description: 'Added a troubleshooting section',+ })+ )+ // Untouched files are omitted, so the server carries the current latest's files+ // forward instead of overwriting them with this editor's stale copy.+ expect(mockPartialUpdate.mock.calls[0]?.[2]?.files).toBeUndefined()+ expect(logic.values.isPublishReviewOpen).toBe(false)+ expect(logic.values.mode).toBe(SkillMode.View)+ })++ it('preserves form edits and advances the base version on a publish conflict', async () => {+ const conflictingLatest = {+ ...mockSkill,+ id: 'skill-version-3',+ body: 'Someone else edited this skill.',+ version: 3,+ latest_version: 3,+ version_count: 3,+ }++ mockResolve+ .mockResolvedValueOnce(resolveResponse(mockSkill))+ .mockResolvedValue(resolveResponse(conflictingLatest))+ mockPartialUpdate.mockRejectedValue(+ new ApiError('conflict', 409, undefined, { detail: 'The skill changed since you opened it.' })+ )++ logic = llmSkillLogic({ skillName: 'my-test-skill' })+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadSkillSuccess'])++ logic.actions.setMode(SkillMode.Edit)+ logic.actions.setSkillFormValues({ body: 'My in-progress edit.' })++ logic.actions.submitSkillForm()+ await expectLogic(logic).toDispatchActions(['submitSkillFormFailure'])++ expect(logic.values.skillForm.body).toBe('My in-progress edit.')+ expect(logic.values.publishConflict).toEqual({ latestVersion: 3 })+ expect(logic.values.skill).toMatchObject({ latest_version: 3 })+ expect(logic.values.mode).toBe(SkillMode.Edit)+ })})- it('caps a folder drop at 200 files and says so instead of silently failing on publish', async () => {- await upload(Array.from({ length: 205 }, (_, i) => asUpload(`content ${i}`, `references/file-${i}.txt`)))-- expect(logic.values.skillForm.files).toHaveLength(200)- expect(logic.values.skillForm.files[199].path).toBe('references/file-199.txt')- expect(jest.mocked(lemonToast.error)).toHaveBeenCalledWith(- "Some files weren't added: a skill can have at most 200 bundled files"- )+ describe('file uploads', () => {+ let logic: ReturnType<typeof llmSkillLogic.build>++ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ logic = llmSkillLogic({ skillName: 'new' })+ logic.mount()+ })++ afterEach(() => {+ logic?.unmount()+ })++ const asUpload = (content: string, path: string): SkillFileUpload => ({+ path,+ file: new File([content], path.split('/').pop() ?? path),+ })++ const upload = async (files: SkillFileUpload[]): Promise<void> => {+ await expectLogic(logic, () => logic.actions.addUploadedFiles(files)).toFinishAllListeners()+ }++ it('adds uploaded files to the form, preserving folder paths and inferring content types', async () => {+ await upload([asUpload('print("hi")', 'scripts/setup.py'), asUpload('# Guide', 'references/guide.md')])++ expect(logic.values.skillForm.files).toEqual([+ { path: 'scripts/setup.py', content: 'print("hi")', content_type: 'text/x-python' },+ { path: 'references/guide.md', content: '# Guide', content_type: 'text/markdown' },+ ])+ })++ it('re-uploading a path replaces its row instead of duplicating it', async () => {+ await upload([asUpload('v1', 'notes.txt'), asUpload('extra', 'extra.txt')])+ await upload([asUpload('v2', 'notes.txt')])++ expect(logic.values.skillForm.files).toEqual([+ { path: 'notes.txt', content: 'v2', content_type: 'text/plain' },+ { path: 'extra.txt', content: 'extra', content_type: 'text/plain' },+ ])+ })++ it('rejects oversized, binary, and SKILL.md files with a toast but keeps valid ones', async () => {+ await upload([+ { path: 'big.txt', file: new File([new ArrayBuffer(1_000_001)], 'big.txt') },+ asUpload('\u0000binary', 'nul.txt'),+ { path: 'invalid-utf8.txt', file: new File([new Uint8Array([0xc3, 0x28])], 'invalid-utf8.txt') },+ asUpload('has a \ufffd char', 'replacement.txt'),+ asUpload('# My skill', 'Skill.md'),+ asUpload('ok', 'ok.txt'),+ ])++ expect(logic.values.skillForm.files).toEqual([+ { path: 'replacement.txt', content: 'has a \ufffd char', content_type: 'text/plain' },+ { path: 'ok.txt', content: 'ok', content_type: 'text/plain' },+ ])+ expect(jest.mocked(lemonToast.error).mock.calls.map(([message]) => message)).toEqual([+ "Couldn't add big.txt: files must be 1 MB or smaller",+ "Couldn't add nul.txt: only text files are supported",+ "Couldn't add invalid-utf8.txt: only text files are supported",+ ])+ expect(jest.mocked(lemonToast.info)).toHaveBeenCalledWith(+ "SKILL.md wasn't added as a bundled file. Its body belongs in the skill body field."+ )+ })++ it('caps a folder drop at 200 files and says so instead of silently failing on publish', async () => {+ await upload(Array.from({ length: 205 }, (_, i) => asUpload(`content ${i}`, `references/file-${i}.txt`)))++ expect(logic.values.skillForm.files).toHaveLength(200)+ expect(logic.values.skillForm.files[199].path).toBe('references/file-199.txt')+ expect(jest.mocked(lemonToast.error)).toHaveBeenCalledWith(+ "Some files weren't added: a skill can have at most 200 bundled files"+ )+ })})})diff --git a/products/skills/frontend/llmSkillLogic.ts b/products/skills/frontend/llmSkillLogic.tsindex e9d6435cf845..99480337e435 100644--- a/products/skills/frontend/llmSkillLogic.ts+++ b/products/skills/frontend/llmSkillLogic.ts@@ -14,13 +14,14 @@ import {import { forms } from 'kea-forms'import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'import { loaders } from 'kea-loaders'-import { combineUrl, router, urlToAction } from 'kea-router'+import { actionToUrl, combineUrl, router, urlToAction } from 'kea-router'-import { ApiConfig } from '~/lib/api'+import { ApiConfig, ApiError } from '~/lib/api'import { lemonToast } from '~/lib/lemon-ui/LemonToast/LemonToast'import { urls } from '~/scenes/urls'import { Breadcrumb } from '~/types'+import { getApiErrorDetail, openDiscardChangesDialog } from 'products/ai_observability/frontend/prompts/utils'import {llmSkillsCreate,llmSkillsNameArchiveCreate,@@ -115,6 +116,28 @@ const DEFAULT_SKILL_FORM_VALUES: SkillFormValues = {}const SKILL_VERSIONS_LIMIT = 50+const STALE_SKILL_ERROR_MESSAGE =+ 'This skill changed while you were editing it. Your edits are preserved. Review the latest version and publish again.'++export interface PublishConflict {+ latestVersion: number | null+}++// Sorted by path so a reorder that ends up byte-identical on the server is not presented as a change.+function sortSkillFilesByPath(files: SkillFormFileValues[]): SkillFormFileValues[] {+ return [...files].sort((a, b) => a.path.localeCompare(b.path))+}++function normalizeSkillFormForCompare(form: SkillFormValues): SkillFormValues {+ return {+ ...form,+ files: sortSkillFilesByPath(form.files),+ }+}++function areSkillFilesEqual(a: SkillFormFileValues[], b: SkillFormFileValues[]): boolean {+ return JSON.stringify(sortSkillFilesByPath(a)) === JSON.stringify(sortSkillFilesByPath(b))+}async function fetchResolvedSkill(skillName: string,@@ -183,17 +206,22 @@ export interface llmSkillLogicValues {isHistoricalVersion: booleanisNewSkill: booleanisOutlineExpanded: boolean+ isPublishReviewOpen: boolean+ isSkillFormDirty: booleanisSkillFormSubmitting: booleanisSkillFormValid: booleanisSkillMissing: booleanisViewMode: booleanmode: SkillMode+ nextVersion: number | null+ publishConflict: PublishConflict | nullshouldDisplaySkeleton: booleanshowSkillFormErrors: booleanskill: ResolvedLLMSkill | SkillFormValues | nullskillFetched: booleanskillForm: SkillFormValuesskillFormAllErrors: Record<string, any>+ skillFormBaseline: SkillFormValues | nullskillFormChanged: booleanskillFormErrors: DeepPartialMap<SkillFormValues, ValidationErrorType>skillFormHasErrors: boolean@@ -202,6 +230,7 @@ export interface llmSkillLogicValues {skillFormTouches: Record<string, boolean>skillFormValidationErrors: DeepPartialMap<SkillFormValues, ValidationErrorType>skillLoading: boolean+ versionDescription: stringversions: LLMSkillVersionSummaryApi[]versionsLoading: boolean}@@ -211,6 +240,12 @@ export interface llmSkillLogicActions {addUploadedFiles: (files: SkillFileUpload[]) => {files: SkillFileUpload[]}+ cancelEditing: () => {+ value: true+ }+ closePublishReview: () => {+ value: true+ }deleteSkill: () => {value: true}@@ -253,6 +288,12 @@ export interface llmSkillLogicActions {skill: ResolvedLLMSkillpayload?: any}+ openPublishReview: () => {+ value: true+ }+ requestPublish: () => {+ value: true+ }resetSkillForm: (values?: SkillFormValues) => {values?: SkillFormValues}@@ -268,9 +309,15 @@ export interface llmSkillLogicActions {setMode: (mode: SkillMode) => {mode: SkillMode}+ setPublishConflict: (publishConflict: PublishConflict | null) => {+ publishConflict: PublishConflict | null+ }setSkill: (skill: ResolvedLLMSkill | SkillFormValues) => {skill: ResolvedLLMSkill | SkillFormValues}+ setSkillFormBaseline: (baseline: SkillFormValues | null) => {+ baseline: SkillFormValues | null+ }setSkillFormManualErrors: (errors: Record<string, any>) => {errors: Record<string, any>}@@ -284,6 +331,9 @@ export interface llmSkillLogicActions {setSkillFormValues: (values: DeepPartial<SkillFormValues>) => {values: DeepPartial<SkillFormValues>}+ setVersionDescription: (versionDescription: string) => {+ versionDescription: string+ }setVersionsLoading: (versionsLoading: boolean) => {versionsLoading: boolean}@@ -334,6 +384,12 @@ export interface llmSkillLogicMeta {) => Breadcrumb[]isViewMode: (mode: SkillMode, arg: any) => booleanisEditMode: (mode: SkillMode, arg: any) => boolean+ isSkillFormDirty: (+ skillForm: SkillFormValues,+ skillFormBaseline: SkillFormValues | null,+ isNewSkill: boolean+ ) => boolean+ nextVersion: (skill: ResolvedLLMSkill | SkillFormValues | null) => number | nullversions: (skill: ResolvedLLMSkill | SkillFormValues | null) => LLMSkillVersionSummaryApi[]canLoadMoreVersions: (skill: ResolvedLLMSkill | SkillFormValues | null) => booleanisDiffVisible: (compareVersion: number | null) => boolean@@ -372,6 +428,13 @@ export const llmSkillLogic = kea<llmSkillLogicType>([setCompareVersion: (compareVersion: number | null) => ({ compareVersion }),downloadSkill: true,setDownloadingZip: (downloadingZip: boolean) => ({ downloadingZip }),+ cancelEditing: true,+ setPublishConflict: (publishConflict: PublishConflict | null) => ({ publishConflict }),+ requestPublish: true,+ openPublishReview: true,+ closePublishReview: true,+ setVersionDescription: (versionDescription: string) => ({ versionDescription }),+ setSkillFormBaseline: (baseline: SkillFormValues | null) => ({ baseline }),}),reducers(({ props }) => ({@@ -436,6 +499,44 @@ export const llmSkillLogic = kea<llmSkillLogicType>([setDownloadingZip: (_, { downloadingZip }) => downloadingZip,},],+ publishConflict: [+ null as PublishConflict | null,+ {+ setPublishConflict: (_, { publishConflict }) => publishConflict,+ setMode: () => null,+ loadSkillSuccess: () => null,+ },+ ],+ isPublishReviewOpen: [+ false,+ {+ openPublishReview: () => true,+ closePublishReview: () => false,+ submitSkillFormSuccess: () => false,+ // A publish conflict (409) needs the editor visible again to show the banner+ setPublishConflict: () => false,+ setMode: () => false,+ },+ ],+ versionDescription: [+ '',+ {+ setVersionDescription: (_, { versionDescription }) => versionDescription,+ submitSkillFormSuccess: () => '',+ closePublishReview: () => '',+ setMode: () => '',+ },+ ],+ // What the editor started from, including lazily loaded file contents. The dirty check+ // compares the form against this, so a load that fills the form (loadFileContents) must+ // update it too or the fill itself would read as an edit.+ skillFormBaseline: [+ null as SkillFormValues | null,+ {+ loadSkillSuccess: (_, { skill }) => (isSkill(skill) ? getSkillFormDefaults(skill) : null),+ setSkillFormBaseline: (_, { baseline }) => baseline,+ },+ ],})),loaders(({ props }) => ({@@ -476,14 +577,19 @@ export const llmSkillLogic = kea<llmSkillLogicType>([try {let savedSkill: LLMSkillApi- const filesToSend: LLMSkillFileInputApi[] | undefined =- formValues.files.length > 0- ? formValues.files.map((f) => ({- path: f.path,- content: f.content,- content_type: f.content_type || undefined,- }))- : undefined+ const formFiles: LLMSkillFileInputApi[] = formValues.files.map((f) => ({+ path: f.path,+ content: f.content,+ content_type: f.content_type || undefined,+ }))+ // Send files only when the user changed them: omitting the key carries the+ // current latest's files forward on the server, so an untouched file set can't+ // clobber files a concurrent publish added, and publishing before the lazy file+ // contents finish loading can't wipe content. An emptied set is a real change+ // and goes through as [].+ const baselineFiles = values.skillFormBaseline?.files+ const filesChanged = !baselineFiles || !areSkillFilesEqual(formValues.files, baselineFiles)+ const filesToSend: LLMSkillFileInputApi[] | undefined = filesChanged ? formFiles : undefinedif (isNew) {const createResponse = await llmSkillsCreate(String(ApiConfig.getCurrentTeamId()), {@@ -492,7 +598,7 @@ export const llmSkillLogic = kea<llmSkillLogicType>([body: formValues.body,license: formValues.license || undefined,compatibility: formValues.compatibility || undefined,- files: filesToSend,+ files: formFiles.length > 0 ? formFiles : undefined,})savedSkill = { ...createResponse, files: [] }llmSkillsLogic.findMounted()?.actions.loadSkills(false)@@ -505,6 +611,7 @@ export const llmSkillLogic = kea<llmSkillLogicType>([throw new Error('Cannot publish skill version: skill data not loaded')}+ const versionDescription = values.versionDescription.trim()savedSkill = await llmSkillsNamePartialUpdate(String(ApiConfig.getCurrentTeamId()),props.skillName,@@ -517,10 +624,11 @@ export const llmSkillLogic = kea<llmSkillLogicType>([metadata: currentSkill.metadata,base_version: currentSkill.latest_version,files: filesToSend,+ ...(versionDescription ? { version_description: versionDescription } : {}),})llmSkillsLogic.findMounted()?.actions.loadSkills(false)- lemonToast.success('Skill version published successfully')+ lemonToast.success(`Published v${savedSkill.version}`)actions.setSkill({...savedSkill,@@ -528,6 +636,7 @@ export const llmSkillLogic = kea<llmSkillLogicType>([{id: savedSkill.id,version: savedSkill.version,+ version_description: savedSkill.version_description ?? null,created_by: savedSkill.created_by,created_at: savedSkill.created_at,is_latest: true,@@ -539,12 +648,15 @@ export const llmSkillLogic = kea<llmSkillLogicType>([has_more: currentSkill.has_more,})actions.setSkillFormValues(getSkillFormDefaults(savedSkill))+ actions.setSkillFormBaseline(getSkillFormDefaults(savedSkill))router.actions.replace(urls.skill(props.skillName))+ // PATCH already succeeded, so keep optimistic state even if follow-up read fails.try {const latest = await fetchResolvedSkill(props.skillName)actions.setSkill(latest)actions.setSkillFormValues(getSkillFormDefaults(latest))+ actions.setSkillFormBaseline(getSkillFormDefaults(latest))} catch (err) {console.error('Failed to refresh skill after publish', err)}@@ -558,13 +670,25 @@ export const llmSkillLogic = kea<llmSkillLogicType>([has_more: false,})actions.setSkillFormValues(getSkillFormDefaults(savedSkill))+ actions.setSkillFormBaseline(getSkillFormDefaults(savedSkill))}} catch (error: unknown) {- const detail =- error !== null && typeof error === 'object' && 'detail' in error- ? (error as { detail: string }).detail- : undefined- lemonToast.error(detail || 'Failed to save skill')+ if (error instanceof ApiError && error.status === 409) {+ // Refresh the underlying skill so base_version advances, but keep the+ // user's in-progress edits in the form. Never overwrite their work.+ let latestVersion: number | null = null+ try {+ const latestSkill = await fetchResolvedSkill(props.skillName)+ actions.setSkill(latestSkill)+ latestVersion = latestSkill.latest_version ?? latestSkill.version+ } catch {}++ actions.setPublishConflict({ latestVersion })+ lemonToast.error(STALE_SKILL_ERROR_MESSAGE)+ throw error+ }++ lemonToast.error(getApiErrorDetail(error) || 'Failed to save skill')throw error}},@@ -625,6 +749,35 @@ export const llmSkillLogic = kea<llmSkillLogicType>([(mode: SkillMode, props) => props.skillName === 'new' || mode === SkillMode.Edit,],+ isSkillFormDirty: [+ (s) => [s.skillForm, s.skillFormBaseline, s.isNewSkill],+ (skillForm: SkillFormValues, skillFormBaseline: SkillFormValues | null, isNewSkill: boolean): boolean => {+ if (isNewSkill) {+ return (+ !!skillForm.name.trim() ||+ !!skillForm.description.trim() ||+ !!skillForm.body.trim() ||+ !!skillForm.license.trim() ||+ !!skillForm.compatibility.trim() ||+ skillForm.files.length > 0+ )+ }+ if (!skillFormBaseline) {+ return false+ }+ return (+ JSON.stringify(normalizeSkillFormForCompare(skillForm)) !==+ JSON.stringify(normalizeSkillFormForCompare(skillFormBaseline))+ )+ },+ ],++ nextVersion: [+ (s) => [s.skill],+ (skill: ResolvedLLMSkill | SkillFormValues | null): number | null =>+ isSkill(skill) ? (skill.latest_version ?? skill.version) + 1 : null,+ ],+versions: [(s) => [s.skill],(skill: ResolvedLLMSkill | SkillFormValues | null): LLMSkillVersionSummaryApi[] =>@@ -789,13 +942,17 @@ export const llmSkillLogic = kea<llmSkillLogicType>([}try {const fileContents = await fetchAllFileContents(props.skillName, skill)- actions.setSkillFormValues({- files: fileContents.map((f) => ({- path: f.path,- content: f.content,- content_type: f.content_type || 'text/plain',- })),- })+ const files = fileContents.map((f) => ({+ path: f.path,+ content: f.content,+ content_type: f.content_type || 'text/plain',+ }))+ actions.setSkillFormValues({ files })+ actions.setSkillFormBaseline(+ values.skillFormBaseline+ ? { ...values.skillFormBaseline, files }+ : { ...getSkillFormDefaults(skill), files }+ )} catch (e) {console.error('Failed to load file contents for editing', e)} finally {@@ -814,6 +971,35 @@ export const llmSkillLogic = kea<llmSkillLogicType>([}},+ requestPublish: () => {+ // New skills publish directly (v1, nothing to diff against); an invalid form goes+ // through submit so kea-forms surfaces the validation errors.+ if (values.isNewSkill || !values.skillForm.body?.trim() || !values.skillForm.description?.trim()) {+ actions.submitSkillForm()+ return+ }+ actions.openPublishReview()+ },++ cancelEditing: () => {+ const exitEditMode = (): void => {+ if (values.isNewSkill) {+ router.actions.push(urls.skills())+ return+ }+ if (isSkill(values.skill)) {+ actions.setSkillFormValues(values.skillFormBaseline ?? getSkillFormDefaults(values.skill))+ }+ actions.setMode(SkillMode.View)+ }++ if (values.isSkillFormDirty) {+ openDiscardChangesDialog(exitEditMode)+ } else {+ exitEditMode()+ }+ },+loadSkillSuccess: ({ skill }) => {if (skill && isSkill(skill)) {actions.resetSkillForm()@@ -877,15 +1063,49 @@ export const llmSkillLogic = kea<llmSkillLogicType>([}),- afterMount(({ actions, values }) => {+ afterMount(({ actions, values, cache }) => {if (values.isNewSkill) {actions.setSkill(DEFAULT_SKILL_FORM_VALUES)actions.resetSkillForm(DEFAULT_SKILL_FORM_VALUES)} else {actions.loadSkill()}++ // pauseOnPageHidden: false because closing a background tab must still warn about unsaved edits.+ cache.disposables.add(+ () => {+ const handler = (e: BeforeUnloadEvent): void => {+ if (values.isEditMode && values.isSkillFormDirty && !values.isSkillFormSubmitting) {+ e.preventDefault()+ // Some engines only show the native dialog when returnValue is set+ e.returnValue = ''+ }+ }+ window.addEventListener('beforeunload', handler)+ return () => window.removeEventListener('beforeunload', handler)+ },+ 'unsavedEditsGuard',+ { pauseOnPageHidden: false }+ )}),+ actionToUrl(({ props }) => ({+ // replace, not push: a push would re-trigger loadSkill via urlToAction and+ // its success handler would reset the form under the user's edits.+ setMode: ({ mode }) => {+ if (props.skillName === 'new') {+ return undefined+ }+ const { edit: _edit, ...searchParams } = router.values.searchParams+ return [+ router.values.location.pathname,+ mode === SkillMode.Edit ? { ...searchParams, edit: true } : searchParams,+ router.values.hashParams,+ { replace: true },+ ]+ },+ })),+urlToAction(({ actions, values }) => ({'/skills/:name': (_, __, ___, { method }) => {if (method === 'PUSH' && values.isNewSkill) {diff --git a/products/skills/frontend/skillSceneComponents.tsx b/products/skills/frontend/skillSceneComponents.tsxindex f1ee60021cbf..6cef2b8ea48b 100644--- a/products/skills/frontend/skillSceneComponents.tsx+++ b/products/skills/frontend/skillSceneComponents.tsx@@ -1,8 +1,23 @@+import { useActions, useValues } from 'kea'+import { Suspense } from 'react'++import { LemonButton, LemonModal, LemonTag } from '@posthog/lemon-ui'++import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonInput } from 'lib/lemon-ui/LemonInput'+import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'+import { lazyWithRetry } from 'lib/utils/retryImport'+import { LemonDialog } from '~/lib/lemon-ui/LemonDialog'+import type { SkillFormFileValues } from './llmSkillLogic'+import { isSkill, llmSkillLogic } from './llmSkillLogic'+export { LLMSkillsScene } from './LLMSkillsScene'export { LLMSkillScene } from './LLMSkillScene'+const MonacoDiffEditor = lazyWithRetry(() => import('lib/components/MonacoDiffEditor'))+export function openArchiveSkillDialog(onConfirm: () => void): void {LemonDialog.open({title: 'Archive skill?',@@ -11,3 +26,189 @@ export function openArchiveSkillDialog(onConfirm: () => void): void {secondaryButton: { children: 'Cancel' },})}++interface FileChanges {+ added: string[]+ removed: string[]+ changed: string[]+}++function diffFiles(baseline: SkillFormFileValues[], current: SkillFormFileValues[]): FileChanges {+ const baselineByPath = new Map(baseline.map((f) => [f.path, f]))+ const currentByPath = new Map(current.map((f) => [f.path, f]))+ const added = current.filter((f) => !baselineByPath.has(f.path)).map((f) => f.path)+ const removed = baseline.filter((f) => !currentByPath.has(f.path)).map((f) => f.path)+ const changed = current+ .filter((f) => {+ const base = baselineByPath.get(f.path)+ return base && (base.content !== f.content || base.content_type !== f.content_type)+ })+ .map((f) => f.path)+ return { added, removed, changed }+}++export function SkillPublishReviewModal(): JSX.Element | null {+ const {+ isPublishReviewOpen,+ skill,+ skillForm,+ skillFormBaseline,+ nextVersion,+ isSkillFormSubmitting,+ versionDescription,+ } = useValues(llmSkillLogic)+ const { closePublishReview, submitSkillForm, setVersionDescription } = useActions(llmSkillLogic)++ if (!isSkill(skill)) {+ return null+ }++ const publishLabel = nextVersion ? `Publish v${nextVersion}` : 'Publish version'+ const isDescriptionChanged = skillForm.description !== skill.description+ const fileChanges = diffFiles(skillFormBaseline?.files ?? [], skillForm.files)+ const hasFileChanges =+ fileChanges.added.length > 0 || fileChanges.removed.length > 0 || fileChanges.changed.length > 0++ return (+ <LemonModal+ isOpen={isPublishReviewOpen}+ onClose={closePublishReview}+ title="Review changes"+ description={`Comparing v${skill.version} with your edits. Publishing creates ${+ nextVersion ? `v${nextVersion}` : 'a new version'+ }. Previous versions stay unchanged.`}+ width={880}+ footer={+ <>+ <LemonButton+ type="secondary"+ onClick={closePublishReview}+ disabledReason={isSkillFormSubmitting ? 'Publishing…' : undefined}+ data-attr="llma-skill-review-back-button"+ >+ Back to editing+ </LemonButton>+ <LemonButton+ type="primary"+ onClick={submitSkillForm}+ loading={isSkillFormSubmitting}+ data-attr="llma-skill-review-publish-button"+ >+ {publishLabel}+ </LemonButton>+ </>+ }+ >+ <div className="space-y-3">+ <div className="overflow-hidden rounded border" data-attr="llma-skill-publish-review-diff">+ <Suspense+ fallback={+ <div className="space-y-2 p-4">+ <LemonSkeleton active className="h-4 w-full" />+ <LemonSkeleton active className="h-4 w-3/4" />+ </div>+ }+ >+ <MonacoDiffEditor+ original={skill.body}+ value={skillForm.body}+ modified={skillForm.body}+ language="markdown"+ options={{+ readOnly: true,+ renderSideBySide: true,+ minimap: { enabled: false },+ scrollBeyondLastLine: false,+ wordWrap: 'on',+ lineNumbers: 'off',+ folding: false,+ hideUnchangedRegions: { enabled: true },+ }}+ />+ </Suspense>+ </div>+ {isDescriptionChanged ? (+ <div data-attr="llma-skill-publish-review-description-diff">+ <div className="mb-1 flex items-center gap-2">+ <span className="text-sm font-semibold">Description</span>+ <LemonTag type="warning" size="small">+ Changed+ </LemonTag>+ </div>+ <div className="overflow-hidden rounded border">+ <Suspense+ fallback={+ <div className="space-y-2 p-4">+ <LemonSkeleton active className="h-4 w-full" />+ </div>+ }+ >+ <MonacoDiffEditor+ original={skill.description}+ value={skillForm.description}+ modified={skillForm.description}+ language="markdown"+ options={{+ readOnly: true,+ renderSideBySide: true,+ minimap: { enabled: false },+ scrollBeyondLastLine: false,+ wordWrap: 'on',+ lineNumbers: 'off',+ folding: false,+ hideUnchangedRegions: { enabled: true },+ }}+ />+ </Suspense>+ </div>+ </div>+ ) : null}+ {hasFileChanges ? (+ <div data-attr="llma-skill-publish-review-file-changes">+ <div className="mb-1 flex items-center gap-2">+ <span className="text-sm font-semibold">Bundled files</span>+ <LemonTag type="warning" size="small">+ Changed+ </LemonTag>+ </div>+ <div className="space-y-1 rounded border p-3 text-sm">+ {fileChanges.added.map((path) => (+ <div key={`added-${path}`} className="flex items-center gap-2">+ <LemonTag type="success" size="small">+ Added+ </LemonTag>+ <span className="font-mono">{path}</span>+ </div>+ ))}+ {fileChanges.removed.map((path) => (+ <div key={`removed-${path}`} className="flex items-center gap-2">+ <LemonTag type="danger" size="small">+ Removed+ </LemonTag>+ <span className="font-mono">{path}</span>+ </div>+ ))}+ {fileChanges.changed.map((path) => (+ <div key={`changed-${path}`} className="flex items-center gap-2">+ <LemonTag type="warning" size="small">+ Changed+ </LemonTag>+ <span className="font-mono">{path}</span>+ </div>+ ))}+ </div>+ </div>+ ) : null}+ <LemonField.Pure label="What changed?" help="Optional. Shown in the version history.">+ <LemonInput+ value={versionDescription}+ onChange={setVersionDescription}+ placeholder="e.g. Added a troubleshooting section"+ maxLength={400}+ data-attr="llma-skill-version-description-input"+ />+ </LemonField.Pure>+ </div>+ </LemonModal>+ )+}diff --git a/products/skills/mcp/tools.yaml b/products/skills/mcp/tools.yamlindex f41e45556697..a1db5604e9ac 100644--- a/products/skills/mcp/tools.yaml+++ b/products/skills/mcp/tools.yaml@@ -234,6 +234,9 @@ tools:this replaces the owner set. Omit it to leave owners unchanged; pass an empty list toclear them. Ownership is independent of the version, so a body edit alone neverchanges it.++ Pass 'version_description' with a short note on what changed and why — it is shown in+ the skill's version history.include_params:- body- edits@@ -246,3 +249,4 @@ tools:- file_edits- owners- base_version+ - version_descriptiondiff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 945faf61cdcb..1f09e323e629 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -9037,7 +9037,7 @@}},"skill-update": {- "description": "Publish a new version of an existing agent skill by name. Any field not provided\nis carried forward from the current latest version. Requires base_version for\noptimistic concurrency.\n\nFor the body, you can either provide the full content via 'body', or use 'edits'\nfor incremental find/replace updates. Each edit must have 'old' (text to find,\nmust match exactly once) and 'new' (replacement text). Edits are applied\nsequentially. Only one of 'body' or 'edits' may be provided.\n\nFor file changes, prefer the per-file tools rather than passing a 'files' list:\nskill-file-create / skill-file-delete / skill-file-rename handle\nadd/remove/rename one file at a time and return the updated skill (including the\nbumped version) so callers can chain further edits via base_version.\n\nFor per-file content updates, use 'file_edits' to apply find/replace updates to\nindividual files without resending the full file set — each entry targets one\nexisting file by path. Non-targeted files carry forward unchanged. 'file_edits'\ncannot add, remove, or rename files; use the per-file tools or 'files' (replace-all)\nfor that. 'files' and 'file_edits' are mutually exclusive.\n\nPassing a 'files' list here replaces ALL files and risks data loss if any file is\nomitted — use it only when you intentionally want to replace the entire bundle.\n\nTo change who owns the skill, pass 'owners' (a list of project-member user UUIDs) —\nthis replaces the owner set. Omit it to leave owners unchanged; pass an empty list to\nclear them. Ownership is independent of the version, so a body edit alone never\nchanges it.",+ "description": "Publish a new version of an existing agent skill by name. Any field not provided\nis carried forward from the current latest version. Requires base_version for\noptimistic concurrency.\n\nFor the body, you can either provide the full content via 'body', or use 'edits'\nfor incremental find/replace updates. Each edit must have 'old' (text to find,\nmust match exactly once) and 'new' (replacement text). Edits are applied\nsequentially. Only one of 'body' or 'edits' may be provided.\n\nFor file changes, prefer the per-file tools rather than passing a 'files' list:\nskill-file-create / skill-file-delete / skill-file-rename handle\nadd/remove/rename one file at a time and return the updated skill (including the\nbumped version) so callers can chain further edits via base_version.\n\nFor per-file content updates, use 'file_edits' to apply find/replace updates to\nindividual files without resending the full file set — each entry targets one\nexisting file by path. Non-targeted files carry forward unchanged. 'file_edits'\ncannot add, remove, or rename files; use the per-file tools or 'files' (replace-all)\nfor that. 'files' and 'file_edits' are mutually exclusive.\n\nPassing a 'files' list here replaces ALL files and risks data loss if any file is\nomitted — use it only when you intentionally want to replace the entire bundle.\n\nTo change who owns the skill, pass 'owners' (a list of project-member user UUIDs) —\nthis replaces the owner set. Omit it to leave owners unchanged; pass an empty list to\nclear them. Ownership is independent of the version, so a body edit alone never\nchanges it.\n\nPass 'version_description' with a short note on what changed and why — it is shown in\nthe skill's version history.","category": "Skills","feature": "skills","summary": "Update skill",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 97125622c376..02247dcc314f 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -9664,7 +9664,7 @@}},"skill-update": {- "description": "Publish a new version of an existing agent skill by name. Any field not provided\nis carried forward from the current latest version. Requires base_version for\noptimistic concurrency.\n\nFor the body, you can either provide the full content via 'body', or use 'edits'\nfor incremental find/replace updates. Each edit must have 'old' (text to find,\nmust match exactly once) and 'new' (replacement text). Edits are applied\nsequentially. Only one of 'body' or 'edits' may be provided.\n\nFor file changes, prefer the per-file tools rather than passing a 'files' list:\nskill-file-create / skill-file-delete / skill-file-rename handle\nadd/remove/rename one file at a time and return the updated skill (including the\nbumped version) so callers can chain further edits via base_version.\n\nFor per-file content updates, use 'file_edits' to apply find/replace updates to\nindividual files without resending the full file set — each entry targets one\nexisting file by path. Non-targeted files carry forward unchanged. 'file_edits'\ncannot add, remove, or rename files; use the per-file tools or 'files' (replace-all)\nfor that. 'files' and 'file_edits' are mutually exclusive.\n\nPassing a 'files' list here replaces ALL files and risks data loss if any file is\nomitted — use it only when you intentionally want to replace the entire bundle.\n\nTo change who owns the skill, pass 'owners' (a list of project-member user UUIDs) —\nthis replaces the owner set. Omit it to leave owners unchanged; pass an empty list to\nclear them. Ownership is independent of the version, so a body edit alone never\nchanges it.",+ "description": "Publish a new version of an existing agent skill by name. Any field not provided\nis carried forward from the current latest version. Requires base_version for\noptimistic concurrency.\n\nFor the body, you can either provide the full content via 'body', or use 'edits'\nfor incremental find/replace updates. Each edit must have 'old' (text to find,\nmust match exactly once) and 'new' (replacement text). Edits are applied\nsequentially. Only one of 'body' or 'edits' may be provided.\n\nFor file changes, prefer the per-file tools rather than passing a 'files' list:\nskill-file-create / skill-file-delete / skill-file-rename handle\nadd/remove/rename one file at a time and return the updated skill (including the\nbumped version) so callers can chain further edits via base_version.\n\nFor per-file content updates, use 'file_edits' to apply find/replace updates to\nindividual files without resending the full file set — each entry targets one\nexisting file by path. Non-targeted files carry forward unchanged. 'file_edits'\ncannot add, remove, or rename files; use the per-file tools or 'files' (replace-all)\nfor that. 'files' and 'file_edits' are mutually exclusive.\n\nPassing a 'files' list here replaces ALL files and risks data loss if any file is\nomitted — use it only when you intentionally want to replace the entire bundle.\n\nTo change who owns the skill, pass 'owners' (a list of project-member user UUIDs) —\nthis replaces the owner set. Omit it to leave owners unchanged; pass an empty list to\nclear them. Ownership is independent of the version, so a body edit alone never\nchanges it.\n\nPass 'version_description' with a short note on what changed and why — it is shown in\nthe skill's version history.","category": "Skills","feature": "skills","summary": "Update skill",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 6981a743e6f3..b96c55864c26 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -40615,6 +40615,11 @@ export namespace Schemas {/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */readonly outline: readonly LLMSkillOutlineEntry[];readonly version: number;+ /**+ * Optional note describing what changed in this version. Set when the version is published.+ * @nullable+ */+ readonly version_description: string | null;readonly created_by: UserBasic;readonly created_at: string;readonly updated_at: string;@@ -40695,6 +40700,11 @@ export namespace Schemas {/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */readonly outline: readonly LLMSkillOutlineEntry[];readonly version: number;+ /**+ * Optional note describing what changed in this version. Set when the version is published.+ * @nullable+ */+ readonly version_description: string | null;readonly created_by: UserBasic;readonly created_at: string;readonly updated_at: string;@@ -40822,6 +40832,11 @@ export namespace Schemas {/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */readonly outline: readonly LLMSkillOutlineEntry[];readonly version: number;+ /**+ * Optional note describing what changed in this version. Set when the version is published.+ * @nullable+ */+ readonly version_description: string | null;readonly created_by: UserBasic;readonly created_at: string;readonly updated_at: string;@@ -40910,6 +40925,8 @@ export namespace Schemas {export interface LLMSkillVersionSummary {readonly id: string;readonly version: number;+ /** @nullable */+ readonly version_description: string | null;readonly created_by: UserBasic;readonly created_at: string;readonly is_latest: boolean;@@ -55247,6 +55264,11 @@ export namespace Schemas {* @minimum 1*/base_version?: number;+ /**+ * Optional note describing what changed in this version. Shown in the version history.+ * @maxLength 400+ */+ version_description?: string;}export interface PatchedLiveDebuggerBreakpoint {diff --git a/services/mcp/src/generated/skills/api.ts b/services/mcp/src/generated/skills/api.tsindex 575b12d001d5..e8fa88d33490 100644--- a/services/mcp/src/generated/skills/api.ts+++ b/services/mcp/src/generated/skills/api.ts@@ -192,6 +192,8 @@ export const llmSkillsNamePartialUpdateBodyFileEditsItemPathMax = 500export const llmSkillsNamePartialUpdateBodyOwnersMax = 25+export const llmSkillsNamePartialUpdateBodyVersionDescriptionMax = 400+export const LlmSkillsNamePartialUpdateBody = /* @__PURE__ */ zod.object({body: zod.string()@@ -286,6 +288,11 @@ export const LlmSkillsNamePartialUpdateBody = /* @__PURE__ */ zod.object({.describe('Latest version you are editing from. Used for optimistic concurrency checks. Required when publishing content changes; optional for an owner-only update (when omitted, owners are replaced without a concurrency check).'),+ version_description: zod+ .string()+ .max(llmSkillsNamePartialUpdateBodyVersionDescriptionMax)+ .optional()+ .describe('Optional note describing what changed in this version. Shown in the version history.'),})export const llmSkillsNameArchiveCreatePathSkillNameRegExp = new RegExp('^[^\/]+$')diff --git a/services/mcp/src/tools/generated/skills.ts b/services/mcp/src/tools/generated/skills.tsindex 5eeba000583a..592190f00804 100644--- a/services/mcp/src/tools/generated/skills.ts+++ b/services/mcp/src/tools/generated/skills.ts@@ -322,6 +322,9 @@ const skillUpdate = (): ToolBase<typeof SkillUpdateSchema, Schemas.LLMSkill> =>if (params.base_version !== undefined) {body['base_version'] = params.base_version}+ if (params.version_description !== undefined) {+ body['version_description'] = params.version_description+ }const result = await context.api.request<Schemas.LLMSkill>({method: 'PATCH',path: `/api/projects/${encodeURIComponent(String(projectId))}/llm_skills/name/${encodeURIComponent(String(params.skill_name))}/`,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-update.jsonindex 8cb4ccedaa95..d55aef4e2e25 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/llma-skill-update.json@@ -127,6 +127,11 @@"skill_name": {"pattern": "^[^/]+$","type": "string"+ },+ "version_description": {+ "description": "Optional note describing what changed in this version. Shown in the version history.",+ "maxLength": 400,+ "type": "string"}},"required": ["skill_name"],diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-update.jsonindex 8cb4ccedaa95..d55aef4e2e25 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/skill-update.json@@ -127,6 +127,11 @@"skill_name": {"pattern": "^[^/]+$","type": "string"+ },+ "version_description": {+ "description": "Optional note describing what changed in this version. Shown in the version history.",+ "maxLength": 400,+ "type": "string"}},"required": ["skill_name"],