Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(skills): tell skill authors why a skill is not packageable (#99974)

posthog[bot]7e2256ad10d0
diff --git a/products/skills/backend/api/community_publish_services.py b/products/skills/backend/api/community_publish_services.py
index e41163752a8c..7f8fc0dd1a35 100644
--- a/products/skills/backend/api/community_publish_services.py
+++ b/products/skills/backend/api/community_publish_services.py
@@ -196,7 +196,7 @@ def render_skill_md(
raise CommunitySkillPublishValidationError("Skill description is required to publish.")
# The LLMSkill.description column holds 4096, and the Agent Skills spec stops at 1024. New writes
# cap at 1024, but a legacy row can still exceed it. A longer one publishes, syncs and installs,
- # and then validate_for_export refuses the installed skill, so the publisher hands someone a skill
+ # and then compute_spec_problems refuses the installed skill, so the publisher hands someone a skill
# they can never export.
if len(description.strip()) > SPEC_DESCRIPTION_MAX_LENGTH:
raise CommunitySkillPublishValidationError(
diff --git a/products/skills/backend/api/community_skill_sync.py b/products/skills/backend/api/community_skill_sync.py
index 63bd626b14d2..1348eec1cdf0 100644
--- a/products/skills/backend/api/community_skill_sync.py
+++ b/products/skills/backend/api/community_skill_sync.py
@@ -94,7 +94,7 @@ def _validate_entry_shape(entry: dict[str, Any]) -> None:
raise ValueError(f"slug '{slug}' is not a valid, routable skill identifier")
# Blank passes both the type and length checks but leaves an unusable entry: a nameless card in
- # the catalog, and a blank description that `marketplace.packaging.validate_for_export` refuses,
+ # the catalog, and a blank description that `compute_spec_problems` refuses,
# so the skill installs and then can't be exported. The install path rejects it too.
for required in ("name", "description"):
if not _text(entry, required, f"'{required}'").strip():
@@ -160,7 +160,7 @@ def _validate_entry_within_caps(entry: dict[str, Any]) -> None:
raise ValueError(f"file path '{raw_path}' is invalid: {err.detail}") from err
if path_max is not None and len(path) > path_max:
raise ValueError(f"file path '{path}' exceeds the {path_max} character limit")
- # Case-insensitive, matching `_skill_files_are_tree_safe`: two paths differing only by case
+ # Case-insensitive, matching `compute_spec_problems`: two paths differing only by case
# collide on a case-insensitive filesystem, and that check silently drops the whole skill
# from a team's marketplace clone. Cheaper to reject the entry than to ship a skill that
# installs fine and then vanishes from the generated tree.
diff --git a/products/skills/backend/api/skill_serializers.py b/products/skills/backend/api/skill_serializers.py
index 3577d48b9d43..936c2fb3aaf2 100644
--- a/products/skills/backend/api/skill_serializers.py
+++ b/products/skills/backend/api/skill_serializers.py
@@ -1,3 +1,4 @@
+from dataclasses import asdict
from typing import Any
from django.db import transaction
@@ -26,6 +27,7 @@ from .skill_services import (
SKILL_NAME_PATTERN,
LLMSkillOwnerNotFoundError,
check_allowed_tool_name,
+ compute_spec_problems,
normalize_skill_file_path,
resolve_owner_users,
resolve_skill_owners,
@@ -271,6 +273,16 @@ class LLMSkillOutlineEntrySerializer(serializers.Serializer):
text = serializers.CharField(help_text="Heading text.")
+class LLMSkillSpecProblemSerializer(serializers.Serializer):
+ code = serializers.CharField(
+ help_text="Stable machine-readable code for the problem, e.g. description_too_long or file_path_collides."
+ )
+ message = serializers.CharField(help_text="What is wrong and what to change, written for the skill's author.")
+ file_path = serializers.CharField(
+ allow_null=True, help_text="The bundled file the problem is about. Null when it is about the skill itself."
+ )
+
+
class LLMSkillFileSerializer(serializers.ModelSerializer):
class Meta:
model = LLMSkillFile
@@ -529,6 +541,10 @@ class LLMSkillSerializer(serializers.ModelSerializer):
outline = serializers.SerializerMethodField(
help_text="Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents.",
)
+ spec_problems = serializers.SerializerMethodField(
+ help_text="Why this skill is left out of the skills bundle and the plugin marketplace, as stable codes with "
+ "author-facing messages. Empty when the skill packages cleanly.",
+ )
body_total_length = serializers.SerializerMethodField(
help_text="Total length of the full body in characters, independent of any body_offset/body_length paging. "
"Compare against the length of the returned body to detect a truncated response.",
@@ -557,6 +573,7 @@ class LLMSkillSerializer(serializers.ModelSerializer):
"owners",
"files",
"outline",
+ "spec_problems",
"version",
"version_description",
"created_by",
@@ -573,6 +590,7 @@ class LLMSkillSerializer(serializers.ModelSerializer):
"owners",
"files",
"outline",
+ "spec_problems",
"body_total_length",
"body_next_offset",
"version",
@@ -657,6 +675,18 @@ class LLMSkillSerializer(serializers.ModelSerializer):
dict(row) for row in annotated.values("path", "content_type", "line_count", "char_count", "size", "sha256")
]
+ @extend_schema_field(LLMSkillSpecProblemSerializer(many=True))
+ def get_spec_problems(self, instance: LLMSkill) -> list[dict[str, Any]]:
+ # Like owners: the list endpoint pre-resolves paths for the whole page (one query) and passes
+ # them via context to avoid N+1; a single-skill fetch reads them on demand. Paths only,
+ # because loading the relation would carry every bundled file's content the response drops.
+ paths_by_skill_id = self.context.get("file_paths_by_skill_id")
+ if paths_by_skill_id is not None:
+ paths = paths_by_skill_id.get(instance.id, [])
+ else:
+ paths = sorted(LLMSkillFile.objects.filter(skill=instance).values_list("path", flat=True))
+ return [asdict(problem) for problem in compute_spec_problems(instance.name, instance.description, paths)]
+
@extend_schema_field(LLMSkillOutlineEntrySerializer(many=True))
def get_outline(self, instance: LLMSkill) -> list[dict[str, Any]]:
return get_markdown_outline(instance.body)
diff --git a/products/skills/backend/api/skill_services.py b/products/skills/backend/api/skill_services.py
index 4d7434a2afc1..f6db9afe7c5e 100644
--- a/products/skills/backend/api/skill_services.py
+++ b/products/skills/backend/api/skill_services.py
@@ -9,7 +9,7 @@ from django.utils import timezone
from posthog.dataclasses import frozen
from posthog.models import Team, User
-from ..marketplace.packaging import SPEC_DESCRIPTION_MAX_LENGTH
+from ..marketplace.packaging import CODEX_METADATA_PATH, SPEC_DESCRIPTION_MAX_LENGTH
from ..models.skills import (
CATEGORY_BY_NAME_PREFIX,
LLMSkill,
@@ -82,6 +82,147 @@ def normalize_skill_file_path(value: str) -> str:
return normalized
+# Stable codes for the reasons a skill cannot be packaged. The archive walks and the read-only
+# `spec_problems` API field both branch on them, so a code is part of the contract; the message is
+# for the author.
+SPEC_PROBLEM_NAME_MALFORMED = "name_malformed"
+SPEC_PROBLEM_DESCRIPTION_EMPTY = "description_empty"
+SPEC_PROBLEM_DESCRIPTION_TOO_LONG = "description_too_long"
+SPEC_PROBLEM_FILE_PATH_INVALID = "file_path_invalid"
+SPEC_PROBLEM_FILE_PATH_NOT_CANONICAL = "file_path_not_canonical"
+SPEC_PROBLEM_FILE_PATH_COLLIDES = "file_path_collides"
+SPEC_PROBLEM_FILE_PATH_SHADOWS_DIRECTORY = "file_path_shadows_directory"
+
+# Entries every packaged skill directory carries, generated from the skill row (see
+# marketplace.packaging.build_skill_tree). A bundled file only takes one of these paths back when it
+# spells it exactly, so the generated entry is replaced rather than duplicated.
+_GENERATED_SKILL_ENTRIES = ("SKILL.md", CODEX_METADATA_PATH)
+
+
+@frozen
+class SkillSpecProblem:
+ code: str
+ message: str
+ file_path: str | None = None
+
+
+def _name_problems(name: str) -> list[SkillSpecProblem]:
+ if skill_name_is_well_formed(name):
+ return []
+ return [
+ SkillSpecProblem(
+ code=SPEC_PROBLEM_NAME_MALFORMED,
+ message=(
+ f"'{name}' cannot be a skill directory name. Use up to {MAX_SKILL_NAME_LENGTH} lowercase letters, "
+ "numbers and hyphens, with no leading, trailing or consecutive hyphens."
+ ),
+ )
+ ]
+
+
+def _description_problems(description: str) -> list[SkillSpecProblem]:
+ problems: list[SkillSpecProblem] = []
+ if len(description) > SPEC_DESCRIPTION_MAX_LENGTH:
+ problems.append(
+ SkillSpecProblem(
+ code=SPEC_PROBLEM_DESCRIPTION_TOO_LONG,
+ message=(
+ f"The description is {len(description)} characters. Shorten it to "
+ f"{SPEC_DESCRIPTION_MAX_LENGTH} characters or fewer."
+ ),
+ )
+ )
+ if not description.strip():
+ problems.append(
+ SkillSpecProblem(
+ code=SPEC_PROBLEM_DESCRIPTION_EMPTY,
+ message="Add a description. It tells an agent what the skill does and when to use it.",
+ )
+ )
+ return problems
+
+
+def _shadowing_entry(path: str, claimed: dict[str, str]) -> str | None:
+ """The claimed entry that is a parent directory of ``path``, such as `assets` under `assets/logo.png`."""
+ parts = path.lower().split("/")
+ for depth in range(1, len(parts)):
+ parent = claimed.get("/".join(parts[:depth]))
+ if parent is not None:
+ return parent
+ return None
+
+
+def compute_file_path_problems(file_paths: list[str]) -> list[SkillSpecProblem]:
+ problems: list[SkillSpecProblem] = []
+ # Keyed by the lowercased entry name, valued by the spelling that claimed it, so a collision can
+ # name the entry it collides with. Seeded with the generated entries.
+ claimed: dict[str, str] = {entry.lower(): entry for entry in _GENERATED_SKILL_ENTRIES}
+ for path in file_paths:
+ try:
+ canonical = normalize_skill_file_path(path)
+ except ValueError as err:
+ problems.append(SkillSpecProblem(code=SPEC_PROBLEM_FILE_PATH_INVALID, message=str(err), file_path=path))
+ continue
+ if canonical != path:
+ # A legacy `refs\\guide.md` is archived verbatim, so it lands as one flat file instead of a
+ # file under `refs/`, or collides with `refs/guide.md`.
+ problems.append(
+ SkillSpecProblem(
+ code=SPEC_PROBLEM_FILE_PATH_NOT_CANONICAL,
+ message=f"Rename this file to '{canonical}'. The stored path does not unpack to that location.",
+ file_path=path,
+ )
+ )
+ continue
+ lowered = path.lower()
+ # Only the exact sidecar path replaces the generated one; a case variant such as
+ # `Agents/OpenAI.yaml` keys a second entry and collides instead.
+ if lowered in claimed and path != CODEX_METADATA_PATH:
+ claimant = claimed[lowered]
+ if path == claimant:
+ # A zip can carry one member twice, and the backslash swap on import can collapse
+ # two members onto one path, so the pair is not always a case variant.
+ message = f"Remove this duplicate. Another file already uses the path '{claimant}'."
+ else:
+ message = (
+ f"Rename this file. It differs from '{claimant}' only in letter case, so the two "
+ "become one file on a case-insensitive filesystem."
+ )
+ problems.append(SkillSpecProblem(code=SPEC_PROBLEM_FILE_PATH_COLLIDES, message=message, file_path=path))
+ continue
+ claimed[lowered] = path
+ for path in claimed.values():
+ parent = _shadowing_entry(path, claimed)
+ if parent is None:
+ continue
+ # Either side of the pair can be a generated entry, which the author has no row for and
+ # cannot rename. Report the bundled side, because that is the only name they can change.
+ if parent in _GENERATED_SKILL_ENTRIES:
+ message = (
+ f"Move this file out of '{parent}/'. Every skill generates '{parent}', so it cannot "
+ "also be a directory."
+ )
+ culprit = path
+ else:
+ message = f"Rename '{parent}'. It is a file, so this skill cannot also hold '{path}' under it."
+ culprit = parent
+ problems.append(
+ SkillSpecProblem(code=SPEC_PROBLEM_FILE_PATH_SHADOWS_DIRECTORY, message=message, file_path=culprit)
+ )
+ return problems
+
+
+def compute_spec_problems(name: str, description: str, file_paths: list[str]) -> list[SkillSpecProblem]:
+ """Every reason a skill cannot be packaged. Empty means it packages cleanly.
+
+ One rule set for the three consumers: the skills bundle, the plugin marketplace, and the
+ read-only `spec_problems` field that tells the author why the skill is missing from both. A
+ skill with no problems here synthesizes an archive that unpacks on any filesystem, and a git
+ tree real git can clone.
+ """
+ return [*_name_problems(name), *_description_problems(description), *compute_file_path_problems(file_paths)]
+
+
def check_allowed_tool_name(value: str) -> None:
"""Raise ValueError when a tool name can't survive the Agent Skills allowed-tools encoding."""
# The Agent Skills spec serializes allowed-tools as a single space-separated string, so a tool
diff --git a/products/skills/backend/api/skills.py b/products/skills/backend/api/skills.py
index 4ff3f67f0cdc..53d2a17e240b 100644
--- a/products/skills/backend/api/skills.py
+++ b/products/skills/backend/api/skills.py
@@ -56,7 +56,7 @@ from ..marketplace.credentials import (
marketplace_credential_label,
marketplace_repo_url,
)
-from ..marketplace.packaging import SkillImportError, build_skill_zip, parse_skill_zip, validate_for_export
+from ..marketplace.packaging import SkillExport, SkillImportError, build_skill_zip, parse_skill_zip
from ..models.skills import LLMSkill, LLMSkillFile
from .community_publish_services import (
CommunitySkillPublishError,
@@ -97,7 +97,6 @@ from .skill_serializers import (
LLMSkillVersionSummarySerializer,
validate_allowed_tool,
validate_skill_body_size,
- validate_skill_file_path,
validate_skill_name_value,
)
from .skill_services import (
@@ -113,6 +112,7 @@ from .skill_services import (
LLMSkillVersionConflictError,
LLMSkillVersionLimitError,
archive_skill,
+ compute_spec_problems,
create_skill,
create_skill_file,
delete_skill_file,
@@ -128,6 +128,7 @@ from .skill_services import (
resolve_skill_owners_for_names,
resolve_versions_page,
set_skill_owners,
+ skill_name_is_well_formed,
skill_names_owned_by,
)
@@ -370,6 +371,17 @@ class ZipRenderer(BaseRenderer):
return SafeJSONRenderer().render(data, "application/json", renderer_context)
+def _spec_problem_messages(export: SkillExport) -> list[str]:
+ """The shared packaging rules as plain messages, for the endpoints that report them as strings."""
+ return [
+ # Most rules word the message for the `spec_problems` field, which carries the path in its
+ # own column. A flat string has nowhere else to put it, so two bad files would otherwise
+ # produce the same sentence twice and the author could not tell which file to rename.
+ f"file '{problem.file_path}': {problem.message}" if problem.file_path else problem.message
+ for problem in compute_spec_problems(export.name, export.description, [f.path for f in export.files])
+ ]
+
+
def _spec_problems_detail(lead: str, problems: list[str], next_step: str) -> str:
# Clients such as the app toast show only `detail`, so the specific problems must live there too.
sentences = ". ".join((problem[:1].upper() + problem[1:]).removesuffix(".") for problem in problems)
@@ -1017,7 +1029,7 @@ class LLMSkillViewSet(
return self._skill_not_found_response(skill_name)
export = load_skill_export(skill)
- problems = validate_for_export(export)
+ problems = _spec_problem_messages(export)
if problems:
return Response(
{
@@ -1171,12 +1183,15 @@ class LLMSkillViewSet(
# The import path calls create_skill directly, so it must re-apply the same size/shape limits
# the create/edit serializers enforce — otherwise a spec-valid zip could persist content
# (oversized body/files, whitespace-bearing tools) the rest of the system assumes is bounded.
- # validate_for_export already covers the description (non-empty, ≤ spec limit).
- problems: list[str] = list(validate_for_export(skill_export))
- try:
- validate_skill_name_value(skill_export.name)
- except serializers.ValidationError as err:
- problems.append(f"name: {self._first_error(err)}")
+ # _spec_problem_messages already covers the description, the name shape and the file paths.
+ problems: list[str] = _spec_problem_messages(skill_export)
+ # The reserved-name rule is all this adds on top of the shape rules above, so calling it for
+ # a malformed name would report that defect twice.
+ if skill_name_is_well_formed(skill_export.name):
+ try:
+ validate_skill_name_value(skill_export.name)
+ except serializers.ValidationError as err:
+ problems.append(f"name: {self._first_error(err)}")
try:
validate_skill_body_size(skill_export.body)
except serializers.ValidationError as err:
@@ -1191,18 +1206,13 @@ class LLMSkillViewSet(
if len(skill_export.compatibility) > 500:
problems.append("compatibility must be 500 characters or fewer")
- seen_lower: set[str] = set()
for skill_file in skill_export.files:
- try:
- validate_skill_file_path(skill_file.path)
- except serializers.ValidationError as err:
- problems.append(f"file '{skill_file.path}': {self._first_error(err)}")
+ # create_skill inserts the files with bulk_create, which runs no model validation, so a
+ # path the column cannot hold reaches Postgres as a DataError and fails the request.
+ if len(skill_file.path) > 500:
+ problems.append(f"file '{skill_file.path}': path must be 500 characters or fewer")
if len(skill_file.content.encode("utf-8")) > MAX_SKILL_FILE_BYTES:
problems.append(f"file '{skill_file.path}': content must be {MAX_SKILL_FILE_BYTES} bytes or fewer")
- lowered = skill_file.path.lower()
- if lowered in seen_lower:
- problems.append(f"file '{skill_file.path}': collides with another file (case-insensitive)")
- seen_lower.add(lowered)
return problems
@staticmethod
@@ -1835,9 +1845,20 @@ class LLMSkillViewSet(
# `Sequence`, not `list[...]`: the viewset defines a `list` method that shadows the builtin in the
# class body where this annotation is evaluated.
def _list_context_with_owners(self, skills: Sequence[LLMSkill]) -> dict[str, Any]:
- """Serializer context carrying a name→owners map, so the list serializes owners in one query."""
- owners_by_skill_name = resolve_skill_owners_for_names(self.team, [skill.name for skill in skills])
- return {**self.get_serializer_context(), "owners_by_skill_name": owners_by_skill_name}
+ """Serializer context carrying the per-page owners and bundled-file paths, one query each.
+
+ The list drops the file manifest but still reports `spec_problems`, which the paths decide.
+ """
+ file_paths_by_skill_id: dict[Any, list[str]] = {}
+ for skill_id, path in (
+ LLMSkillFile.objects.filter(skill__in=skills).order_by("path").values_list("skill_id", "path")
+ ):
+ file_paths_by_skill_id.setdefault(skill_id, []).append(path)
+ return {
+ **self.get_serializer_context(),
+ "owners_by_skill_name": resolve_skill_owners_for_names(self.team, [skill.name for skill in skills]),
+ "file_paths_by_skill_id": file_paths_by_skill_id,
+ }
# Explicit response schema: the request serializer (`LLMSkillCreateSerializer`) exposes `owners`
# write-only as a UUID list, but the view returns `_serialize_skill` (`LLMSkillSerializer`) with
diff --git a/products/skills/backend/api/test/test_community_publish_services.py b/products/skills/backend/api/test/test_community_publish_services.py
index db2650f3e0d5..9704ca50ecff 100644
--- a/products/skills/backend/api/test/test_community_publish_services.py
+++ b/products/skills/backend/api/test/test_community_publish_services.py
@@ -113,7 +113,7 @@ class TestRenderSkillMd:
# install_community_skill refuses a blank body as having no instructions, so publishing
# one merges a listing that nobody can ever install.
("blank body", "n", "d", " \n "),
- # Longer than the Agent Skills spec allows, so validate_for_export refuses the skill once
+ # Longer than the Agent Skills spec allows, so compute_spec_problems refuses the skill once
# someone installs it from the catalog.
("description over the spec cap", "n", "x" * (SPEC_DESCRIPTION_MAX_LENGTH + 1), "b"),
# Longer than CommunitySkill.name: the PR would merge and ingest would then drop the entry.
diff --git a/products/skills/backend/api/test/test_community_skill_sync.py b/products/skills/backend/api/test/test_community_skill_sync.py
index e548422b8a50..a5039e495110 100644
--- a/products/skills/backend/api/test/test_community_skill_sync.py
+++ b/products/skills/backend/api/test/test_community_skill_sync.py
@@ -192,7 +192,7 @@ class TestCommunitySkillSync(APIBaseTest):
# deletes the existing files first, so a live skill would lose its whole bundle.
("falsy_non_list_files", {"files": {}}),
# Blank passes the type and length checks but leaves a nameless catalog card, and a
- # blank description is refused by marketplace.packaging.validate_for_export.
+ # blank description is refused by compute_spec_problems.
("blank_name", {"name": " "}),
("blank_description", {"description": ""}),
# Case-only collisions break a case-insensitive filesystem, and the marketplace
diff --git a/products/skills/backend/api/test/test_marketplace_endpoints.py b/products/skills/backend/api/test/test_marketplace_endpoints.py
index 85609ee98f17..a67a2c1e6e08 100644
--- a/products/skills/backend/api/test/test_marketplace_endpoints.py
+++ b/products/skills/backend/api/test/test_marketplace_endpoints.py
@@ -32,7 +32,7 @@ from ...api.skill_services import archive_skill, set_skill_owners
from ...marketplace import adapters
from ...marketplace.adapters import build_team_marketplace_tree
from ...marketplace.credentials import issue_marketplace_credential
-from ...marketplace.packaging import SkillExport, build_skill_zip
+from ...marketplace.packaging import SkillExport, SkillFileExport, build_skill_zip
from ...models.skills import LLMSkill, LLMSkillFile
_PAK_TOKEN = "phx_marketplacetoken123"
@@ -137,6 +137,33 @@ class TestSkillZipExport(APIBaseTest):
assert data["allowed_tools"] == ["Bash", "Write"]
assert any(f["path"] == "scripts/x.py" for f in data["files"])
+ def test_export_names_the_file_in_each_path_problem(self):
+ # Most path rules word their message without the path, so two bad files would report the
+ # same sentence twice and the author could not tell which one to rename.
+ skill = LLMSkill.objects.create(
+ team=self.team,
+ name="legacy-paths",
+ description="Legacy paths.",
+ body="# legacy-paths\n",
+ version=1,
+ is_latest=True,
+ created_by=self.user,
+ )
+ # Bypasses the serializer validation so the rows look like ones that predate it.
+ LLMSkillFile.objects.create(skill=skill, path="/first.md", content="x")
+ LLMSkillFile.objects.create(skill=skill, path="/second.md", content="x")
+
+ response = self.client.get(self._url("legacy-paths"))
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST
+ body = response.json()
+ assert body["problems"] == [
+ "file '/first.md': File paths must be relative, not absolute.",
+ "file '/second.md': File paths must be relative, not absolute.",
+ ]
+ assert "/first.md" in body["detail"]
+ assert "/second.md" in body["detail"]
+
def test_import_missing_file_is_400(self):
response = self.client.post(f"/api/environments/{self.team.id}/llm_skills/import", {}, format="multipart")
assert response.status_code == status.HTTP_400_BAD_REQUEST
@@ -152,6 +179,26 @@ class TestSkillZipExport(APIBaseTest):
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ def test_import_rejects_a_path_over_the_stored_limit(self):
+ # bulk_create skips model validation, so a path the column cannot hold reaches Postgres and
+ # fails the insert rather than the request.
+ long_path = f"{'d' * 500}.md"
+ export = SkillExport(
+ name="long-path",
+ description="Long path.",
+ body="# long-path\n",
+ version=1,
+ files=[SkillFileExport(path=long_path, content="x")],
+ )
+ upload = SimpleUploadedFile("long-path.zip", build_skill_zip(export), content_type="application/zip")
+
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/llm_skills/import", {"file": upload}, format="multipart"
+ )
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content
+ assert response.json()["problems"] == [f"file '{long_path}': path must be 500 characters or fewer"]
+
def test_export_rejects_spec_invalid_description(self):
# Stored limit is 4096 but the spec caps description at 1024 — export must refuse rather
# than emit a spec-invalid SKILL.md.
@@ -168,7 +215,7 @@ class TestSkillZipExport(APIBaseTest):
assert response.status_code == status.HTTP_400_BAD_REQUEST
body = response.json()
assert body["problems"]
- assert "Description is 1025 characters; the spec maximum is 1024" in body["detail"]
+ assert "The description is 1025 characters. Shorten it to 1024 characters or fewer" in body["detail"]
SANDBOX_FLAG = "posthog.permissions.posthoganalytics.feature_enabled"
@@ -639,23 +686,60 @@ class TestSkillFilePathValidation:
class TestMarketplaceResilience(APIBaseTest):
- def test_skill_with_uncloneable_paths_is_skipped_not_fatal(self):
- # A skill with two files colliding only by case would synthesize a tree that aborts
- # `git clone` on a case-insensitive filesystem — it must be skipped, not break the whole
- # team's marketplace.
+ @parameterized.expand(
+ [
+ ("case_collision", "bad", "d", ["a.md", "A.md"]),
+ ("not_canonical", "bad", "d", ["refs\\guide.md"]),
+ ("malformed_name", "Bad/Name", "d", []),
+ ("overlong_description", "bad", "x" * 1025, []),
+ ]
+ )
+ def test_unpackageable_skill_is_skipped_not_fatal(self, _label: str, name: str, description: str, paths: list[str]):
+ # The marketplace applies the same rules as the skills bundle. A skill that breaks one of
+ # them is skipped on its own, so it cannot break the whole team's clone. Rows here bypass
+ # the serializer validation, so they look like ones that predate it.
good = LLMSkill.objects.create(
team=self.team, name="good", description="d", body="b", version=1, is_latest=True, created_by=self.user
)
LLMSkillFile.objects.create(skill=good, path="scripts/run.py", content="x", content_type="text/x-python")
bad = LLMSkill.objects.create(
- team=self.team, name="bad", description="d", body="b", version=1, is_latest=True, created_by=self.user
+ team=self.team,
+ name=name,
+ description=description,
+ body="b",
+ version=1,
+ is_latest=True,
+ created_by=self.user,
)
- LLMSkillFile.objects.create(skill=bad, path="a.md", content="x", content_type="text/markdown")
- LLMSkillFile.objects.create(skill=bad, path="A.md", content="y", content_type="text/markdown")
+ for path in paths:
+ LLMSkillFile.objects.create(skill=bad, path=path, content="x", content_type="text/markdown")
tree = build_team_marketplace_tree(self.team)
- assert "plugins/posthog-skill-store/skills/good/SKILL.md" in tree
- assert "plugins/posthog-skill-store/skills/bad/SKILL.md" not in tree
+ assert [key for key in tree if key.endswith("/SKILL.md")] == [
+ "plugins/posthog-skill-store/skills/good/SKILL.md"
+ ]
+
+ def test_skip_warning_samples_names_instead_of_listing_every_one(self):
+ # A team can hold very many unpackageable skills, so the warning carries a fixed-size sample
+ # and the true count, never one name per skipped skill.
+ for index in range(3):
+ LLMSkill.objects.create(
+ team=self.team,
+ name=f"bad-{index}",
+ description="x" * 1025,
+ body="b",
+ version=1,
+ is_latest=True,
+ created_by=self.user,
+ )
+
+ with patch.object(adapters, "_SKIPPED_LOG_SAMPLE_SIZE", 1), patch.object(adapters, "logger") as logger:
+ build_team_marketplace_tree(self.team)
+
+ args, kwargs = logger.warning.call_args
+ assert args == ("skills_marketplace_skipped_unsafe_skills",)
+ assert kwargs["skipped_count"] == 3
+ assert kwargs["skills_sample"] == ["bad-0"]
class TestMarketplaceVersion(APIBaseTest):
@@ -867,6 +951,25 @@ class TestImportAndCreateValidation(APIBaseTest):
assert response.status_code == status.HTTP_400_BAD_REQUEST
assert "body" in str(response.json()).lower()
+ @parameterized.expand(
+ [
+ ("malformed", "Bad_Name", "cannot be a skill directory name"),
+ ("reserved", "community", "is a reserved name"),
+ ]
+ )
+ def test_import_reports_one_message_per_name_problem(self, _label: str, name: str, expected: str):
+ # The shared spec rules cover the name shape and the import adds the reserved-name rule on
+ # top, so a name that breaks one rule must not be reported by both.
+ export = SkillExport(name=name, description="A skill.", body="# skill\n", version=1)
+ upload = SimpleUploadedFile("skill.zip", build_skill_zip(export), content_type="application/zip")
+
+ response = self.client.post(self._import_url(), {"file": upload}, format="multipart")
+
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content
+ problems = response.json()["problems"]
+ assert len(problems) == 1, problems
+ assert expected in problems[0]
+
def test_create_rejects_whitespace_allowed_tool(self):
# A tool name with a space would fracture the spec's space-delimited allowed-tools string.
response = self.client.post(
diff --git a/products/skills/backend/api/test/test_marketplace_packaging.py b/products/skills/backend/api/test/test_marketplace_packaging.py
index 11145bf5386b..1d80e682b12e 100644
--- a/products/skills/backend/api/test/test_marketplace_packaging.py
+++ b/products/skills/backend/api/test/test_marketplace_packaging.py
@@ -20,7 +20,6 @@ from products.skills.backend.marketplace.packaging import (
parse_skill_zip,
render_frontmatter,
render_skill_md,
- validate_for_export,
)
# These tests are intentionally DB-free — the packaging core takes plain dataclasses.
@@ -79,18 +78,6 @@ class TestFrontmatter:
assert out.rstrip().endswith("Do the thing.")
-class TestExportValidation:
- def test_description_over_spec_limit_is_flagged(self):
- problems = validate_for_export(_skill(description="x" * 1025))
- assert any("1024" in p for p in problems)
-
- def test_empty_description_is_flagged(self):
- assert any("non-empty" in p for p in validate_for_export(_skill(description=" ")))
-
- def test_clean_skill_has_no_problems(self):
- assert validate_for_export(_skill()) == []
-
-
class TestSkillTreeAndZip:
def test_skill_tree_contains_skill_md_and_bundled_files(self):
tree = build_skill_tree(_skill())
diff --git a/products/skills/backend/api/test/test_skills.py b/products/skills/backend/api/test/test_skills.py
index 6adfe1731144..ca33de761cca 100644
--- a/products/skills/backend/api/test/test_skills.py
+++ b/products/skills/backend/api/test/test_skills.py
@@ -37,6 +37,7 @@ from ...api.skill_services import (
SkillDigestBackfillCounts,
archive_skill,
backfill_skill_digests,
+ compute_spec_problems,
create_skill,
publish_skill_version,
resolve_skill_owners,
@@ -317,6 +318,36 @@ class TestLLMSkillAPI(APIBaseTest):
# Body-paging metadata is meaningless without the body — it must not leak into the list.
assert all("body_total_length" not in r and "body_next_offset" not in r for r in results)
+ def test_list_skills_reports_spec_problems_in_one_file_query(self):
+ # The list serializer drops the file manifest but still reports spec_problems, so the file
+ # paths must come from one query for the page, not one query per skill.
+ for index in range(3):
+ skill = self.create_skill(name=f"skill-{index}", description="Does things.")
+ LLMSkillFile.objects.create(skill=skill, path="references/guide.md", content="x")
+ broken = self.create_skill(name="broken", description="Does things.")
+ # Bypasses the serializer validation so the row looks like one that predates it.
+ LLMSkillFile.objects.create(skill=broken, path="references\\guide.md", content="x")
+
+ with CaptureQueriesContext(connection) as captured_queries:
+ response = self.client.get(self._url())
+
+ assert response.status_code == status.HTTP_200_OK
+ problems_by_name = {result["name"]: result["spec_problems"] for result in response.json()["results"]}
+ assert problems_by_name["skill-0"] == []
+ assert problems_by_name["broken"] == [
+ {
+ "code": "file_path_not_canonical",
+ "message": "Rename this file to 'references/guide.md'. The stored path does not unpack to that location.",
+ "file_path": "references\\guide.md",
+ }
+ ]
+ file_queries = [
+ query["sql"]
+ for query in captured_queries.captured_queries
+ if query["sql"].lstrip().startswith('SELECT "llm_analytics_llmskillfile".')
+ ]
+ assert len(file_queries) == 1, "\n---\n".join(file_queries)
+
def test_list_skills_search_by_name(self):
self.create_skill(name="pdf-processing", description="Handles PDFs.")
self.create_skill(name="code-review", description="Reviews code.")
@@ -2411,3 +2442,73 @@ class TestSkillContentDigests(APIBaseTest):
assert backfill_skill_digests(batch_size=1, recompute=True) == SkillDigestBackfillCounts(skills=1, files=1)
stamped_file.refresh_from_db()
assert stamped_file.content_sha256 == self._digest_of("# Notes ✅")
+
+
+class TestSpecProblems(SimpleTestCase):
+ @parameterized.expand(
+ [
+ ("clean", "my-skill", "Does things.", ["references/guide.md"], []),
+ # The exact sidecar path replaces the generated entry rather than colliding with it.
+ ("sidecar_exact_path", "my-skill", "Does things.", ["agents/openai.yaml"], []),
+ ("malformed_name", "Bad/Name", "Does things.", [], ["name_malformed"]),
+ ("empty_description", "my-skill", " ", [], ["description_empty"]),
+ ("overlong_description", "my-skill", "x" * 1025, [], ["description_too_long"]),
+ ("invalid_path", "my-skill", "Does things.", ["../escape.md"], ["file_path_invalid"]),
+ ("not_canonical_path", "my-skill", "Does things.", ["refs\\guide.md"], ["file_path_not_canonical"]),
+ ("case_collision", "my-skill", "Does things.", ["a.md", "A.md"], ["file_path_collides"]),
+ ("sidecar_case_variant", "my-skill", "Does things.", ["Agents/OpenAI.yaml"], ["file_path_collides"]),
+ (
+ "file_where_a_directory_is_needed",
+ "my-skill",
+ "Does things.",
+ ["assets", "assets/logo.png"],
+ ["file_path_shadows_directory"],
+ ),
+ ]
+ )
+ def test_reports_a_stable_code_per_problem(
+ self, _label: str, name: str, description: str, paths: list[str], expected_codes: list[str]
+ ) -> None:
+ # The codes are the contract the bundle walk, the marketplace walk and the API field share.
+ problems = compute_spec_problems(name, description, paths)
+
+ assert [problem.code for problem in problems] == expected_codes
+
+ @parameterized.expand(
+ [
+ ("case_variant", ["a.md", "A.md"], "Rename this file."),
+ # A zip can hold one member twice, and the backslash swap on import can collapse two
+ # members onto one path, so a collision is not always a case variant.
+ ("exact_duplicate", ["a.md", "a.md"], "Remove this duplicate."),
+ ]
+ )
+ def test_collision_problem_tells_the_author_what_to_change(
+ self, _label: str, paths: list[str], expected_instruction: str
+ ) -> None:
+ problems = compute_spec_problems("my-skill", "Does things.", paths)
+
+ assert [problem.code for problem in problems] == ["file_path_collides"]
+ assert problems[0].message.startswith(expected_instruction)
+
+ @parameterized.expand(
+ [
+ ("bundled_pair", ["assets", "assets/logo.png"], "assets", "Rename 'assets'."),
+ # The skill generates `agents/openai.yaml`, so a bundled file named `agents` blocks it.
+ ("generated_child", ["agents"], "agents", "Rename 'agents'."),
+ (
+ "generated_parent",
+ ["SKILL.md/notes.txt"],
+ "SKILL.md/notes.txt",
+ "Move this file out of 'SKILL.md/'.",
+ ),
+ ]
+ )
+ def test_shadow_problem_reports_a_file_the_author_can_change(
+ self, _label: str, paths: list[str], expected_file_path: str, expected_instruction: str
+ ) -> None:
+ # SKILL.md and the Codex sidecar are generated for every skill, so the author has no row to
+ # rename for either one.
+ problems = compute_spec_problems("my-skill", "Does things.", paths)
+
+ assert [problem.file_path for problem in problems] == [expected_file_path]
+ assert problems[0].message.startswith(expected_instruction)
diff --git a/products/skills/backend/management/commands/normalize_skill_file_paths.py b/products/skills/backend/management/commands/normalize_skill_file_paths.py
index e218a5a250b3..91f26823dc9b 100644
--- a/products/skills/backend/management/commands/normalize_skill_file_paths.py
+++ b/products/skills/backend/management/commands/normalize_skill_file_paths.py
@@ -9,8 +9,7 @@ from django.utils import timezone
from posthog.dataclasses import frozen
-from products.skills.backend.api.skill_services import normalize_skill_file_path
-from products.skills.backend.marketplace.adapters import bundle_paths_are_safe
+from products.skills.backend.api.skill_services import compute_file_path_problems, normalize_skill_file_path
from products.skills.backend.models import LLMSkill, LLMSkillFile
READ_CHUNK_SIZE = 1000
@@ -81,7 +80,7 @@ def plan_skill_paths(rows: list[tuple[UUID, str]]) -> SkillPathPlan:
collisions.sort()
unfixable.sort()
rewritten = {path: canonical for _, path, canonical in rewrites}
- if rewrites and not bundle_paths_are_safe([rewritten.get(path, path) for _, path in rows]):
+ if rewrites and compute_file_path_problems([rewritten.get(path, path) for _, path in rows]):
return SkillPathPlan(rewrites=[], collisions=collisions, unfixable=unfixable, unsafe=True)
return SkillPathPlan(rewrites=rewrites, collisions=collisions, unfixable=unfixable, unsafe=False)
diff --git a/products/skills/backend/marketplace/README.md b/products/skills/backend/marketplace/README.md
index 4b407e2b1907..e5f0779f91fd 100644
--- a/products/skills/backend/marketplace/README.md
+++ b/products/skills/backend/marketplace/README.md
@@ -68,7 +68,8 @@ unit-testable against the real `git` binary without booting the app
reads the file treats it as pre-approved; a host that loads the skill over MCP ignores it until the user
approves the grant. See `docs/internal/skills/skills-over-mcp.md`.
- platform `version` → `metadata.version` (the spec defines no top-level version field)
-- `description` is validated against the spec's 1024 limit on export (`validate_for_export`)
+- `description` is validated against the spec's 1024 limit on export (`compute_spec_problems`, which also
+ decides whether a skill is packageable at all; the API reports its output as `spec_problems`)
## Cross-agent portability
diff --git a/products/skills/backend/marketplace/adapters.py b/products/skills/backend/marketplace/adapters.py
index 7bfede063c88..ac597df2797f 100644
--- a/products/skills/backend/marketplace/adapters.py
+++ b/products/skills/backend/marketplace/adapters.py
@@ -12,20 +12,16 @@ from django.db.models import F, Func, IntegerField, Max, Q, QuerySet, TextField
from django.db.models.functions import Cast
import structlog
-from rest_framework import serializers
from posthog.dataclasses import frozen
from posthog.models import Team, User
-from ..api.skill_serializers import validate_skill_file_path
-from ..api.skill_services import normalize_skill_file_path, skill_name_is_well_formed, skill_names_owned_by
+from ..api.skill_services import compute_spec_problems, skill_names_owned_by
from ..models.skills import LLMSkill, LLMSkillFile
from .git_smart_http import FileTree, SynthesizedRepo, synthesize_repo
from .packaging import (
- CODEX_METADATA_PATH,
DEFAULT_BUNDLE_SKILLS,
MAX_BUNDLE_SKILLS,
- SPEC_DESCRIPTION_MAX_LENGTH,
SkillExport,
SkillStub,
archive_entry_bytes,
@@ -35,7 +31,6 @@ from .packaging import (
build_skills_bundle_zip,
compute_plugin_version,
file_tree_bytes,
- validate_for_export,
)
logger = structlog.get_logger(__name__)
@@ -125,19 +120,20 @@ def build_team_marketplace_tree(team: Team, version: str | None = None) -> FileT
files_by_skill = _files_by_skill_id(skills)
- # Drop any skill whose bundled-file paths would synthesize a corrupt/uncloneable git tree
- # (e.g. legacy rows that predate the stricter path validation, or case-only collisions). One
- # bad skill is skipped rather than 500-ing the whole team's marketplace clone. We also cap the
- # cumulative content size: past the ceiling, remaining skills are skipped so a pathological team
- # can't OOM the clone.
+ # Drop any skill that would synthesize a corrupt/uncloneable git tree (e.g. legacy rows that
+ # predate the stricter path validation, or case-only collisions). One bad skill is skipped
+ # rather than 500-ing the whole team's marketplace clone, and `spec_problems` on the skill tells
+ # its author why. We also cap the cumulative content size: past the ceiling, remaining skills are
+ # skipped so a pathological team can't OOM the clone.
exports: list[SkillExport] = []
- skipped_unsafe: list[str] = []
+ skipped_unsafe_count = 0
+ skipped_unsafe_sample: list[str] = []
skipped_oversize: list[str] = []
total_bytes = 0
for skill in skills:
files = files_by_skill.get(skill.id, [])
- if not _skill_files_are_tree_safe(files):
- skipped_unsafe.append(skill.name)
+ if compute_spec_problems(skill.name, skill.description, [f.path for f in files]):
+ skipped_unsafe_count = _record_skip(skipped_unsafe_count, skipped_unsafe_sample, skill.name)
continue
skill_bytes = len((skill.body or "").encode("utf-8")) + sum(
len((f.content or "").encode("utf-8")) for f in files
@@ -149,8 +145,13 @@ def build_team_marketplace_tree(team: Team, version: str | None = None) -> FileT
continue
total_bytes += skill_bytes
exports.append(skill.to_export(files))
- if skipped_unsafe:
- logger.warning("skills_marketplace_skipped_unsafe_skills", team_id=team.id, skills=skipped_unsafe)
+ if skipped_unsafe_count:
+ logger.warning(
+ "skills_marketplace_skipped_unsafe_skills",
+ team_id=team.id,
+ skipped_count=skipped_unsafe_count,
+ skills_sample=skipped_unsafe_sample,
+ )
if skipped_oversize:
logger.warning(
"skills_marketplace_skipped_oversize",
@@ -169,22 +170,6 @@ def build_team_marketplace_tree(team: Team, version: str | None = None) -> FileT
)
-def _skill_files_are_tree_safe(files: list[LLMSkillFile]) -> bool:
- """True if every file path is valid and no two collide case-insensitively — i.e. the set
- synthesizes a tree real git can clone on any filesystem."""
- seen_lower: set[str] = set()
- for skill_file in files:
- try:
- validate_skill_file_path(skill_file.path)
- except serializers.ValidationError:
- return False
- lowered = skill_file.path.lower()
- if lowered in seen_lower:
- return False
- seen_lower.add(lowered)
- return True
-
-
def _files_by_skill_id(skills: list[LLMSkill]) -> dict[Any, list[LLMSkillFile]]:
grouped: dict[Any, list[LLMSkillFile]] = {} # keyed by skill UUID (matches skill.id lookups)
if not skills:
@@ -391,53 +376,14 @@ def _walk_stubs(candidates: QuerySet[LLMSkill], limit: int) -> _StubWalk:
skipped_sample=skipped_sample,
)
name = row["name"]
- if not _name_and_description_are_valid(name, row["description"]):
+ # A stub bundle writes only the generated SKILL.md, so a bundled-file path cannot break it.
+ if compute_spec_problems(name, row["description"], []):
skipped_count = _record_skip(skipped_count, skipped_sample, name)
continue
stubs.append(SkillStub(name=name, description=row["description"], version=row["version"]))
return _StubWalk(stubs=stubs, dropped_count=0, skipped_count=skipped_count, skipped_sample=skipped_sample)
-def _name_and_description_are_valid(name: str, description: str) -> bool:
- return (
- skill_name_is_well_formed(name)
- and bool(description.strip())
- and len(description) <= SPEC_DESCRIPTION_MAX_LENGTH
- )
-
-
-_GENERATED_ENTRIES = ("SKILL.md", CODEX_METADATA_PATH)
-
-
-def bundle_paths_are_safe(paths: list[str]) -> bool:
- """True when a skill's archive entries unpack cleanly into a home directory on any filesystem.
-
- Every stored path must already be canonical (a legacy ``refs\\guide.md`` would be archived
- verbatim and land as one flat file, or collide with ``refs/guide.md``), no two entries may
- collide case-insensitively, and no entry may name a directory another entry needs
- (``assets`` next to ``assets/logo.png``), counting the generated SKILL.md and Codex sidecar.
- """
- seen = {entry.lower() for entry in _GENERATED_ENTRIES}
- for path in paths:
- try:
- canonical = normalize_skill_file_path(path)
- except ValueError:
- return False
- if canonical != path:
- return False
- lowered = path.lower()
- # Only the exact sidecar path replaces the generated one (see build_skill_tree); a case
- # variant like `Agents/OpenAI.yaml` keys a second tree entry and would collide instead.
- if lowered in seen and path != CODEX_METADATA_PATH:
- return False
- seen.add(lowered)
- for lowered in seen:
- parts = lowered.split("/")
- if any("/".join(parts[:depth]) in seen for depth in range(1, len(parts))):
- return False
- return True
-
-
def _walk_full(candidates: QuerySet[LLMSkill], limit: int) -> _BundleWalk:
# Names, descriptions and column byte counts only. A skill's row and files load one skill at a
# time, and only once it has passed every check, so a user with many or very large skills does
@@ -460,9 +406,9 @@ def _walk_full(candidates: QuerySet[LLMSkill], limit: int) -> _BundleWalk:
if len(trees) >= limit:
capped = True
break
- # Skips are decided before the cap so an invalid skill never caps the bundle. Validity is
- # cheap: the name and description are in the row, and the paths are a small query.
- if not _name_and_description_are_valid(name, candidate["description"]):
+ # Skips are decided before the cap so an invalid skill never caps the bundle. The row-level
+ # rules run first, off the columns already in hand, so a skill they reject costs no query.
+ if compute_spec_problems(name, candidate["description"], []):
skipped_count = _record_skip(skipped_count, skipped_sample, name)
continue
sized_files = list(
@@ -470,7 +416,7 @@ def _walk_full(candidates: QuerySet[LLMSkill], limit: int) -> _BundleWalk:
.annotate(content_bytes=_octet_length(F("content")))
.values_list("path", "content_bytes")
)
- if not bundle_paths_are_safe([path for path, _ in sized_files]):
+ if compute_spec_problems(name, candidate["description"], [path for path, _ in sized_files]):
skipped_count = _record_skip(skipped_count, skipped_sample, name)
continue
# The stored bytes are a floor for the rendered tree, so a skill that fails here would fail
@@ -487,11 +433,7 @@ def _walk_full(candidates: QuerySet[LLMSkill], limit: int) -> _BundleWalk:
# it either, so it is neither included, skipped nor dropped.
continue
files = list(LLMSkillFile.objects.filter(skill=skill).order_by("path"))
- export = skill.to_export(files)
- if validate_for_export(export):
- skipped_count = _record_skip(skipped_count, skipped_sample, name)
- continue
- tree = build_skill_tree(export)
+ tree = build_skill_tree(skill.to_export(files))
tree_bytes = file_tree_bytes(tree, prefix=f"{name}/")
if total_bytes + tree_bytes > MAX_BUNDLE_BYTES:
capped = True
diff --git a/products/skills/backend/marketplace/packaging.py b/products/skills/backend/marketplace/packaging.py
index 7867db9f7cb8..f737bc358fae 100644
--- a/products/skills/backend/marketplace/packaging.py
+++ b/products/skills/backend/marketplace/packaging.py
@@ -171,18 +171,6 @@ def build_skill_stub_tree(stub: SkillStub) -> FileTree:
return {"SKILL.md": render_skill_stub_md(stub)}
-def validate_for_export(skill: SkillExport) -> list[str]:
- """Return spec-compliance problems that should block or warn on export. Empty == clean."""
- problems: list[str] = []
- if len(skill.description) > SPEC_DESCRIPTION_MAX_LENGTH:
- problems.append(
- f"description is {len(skill.description)} characters; the spec maximum is {SPEC_DESCRIPTION_MAX_LENGTH}"
- )
- if not skill.description.strip():
- problems.append("description is required and must be non-empty")
- return problems
-
-
# OpenAI Codex reads this optional sidecar for UI metadata + tool deps; every other agent
# ignores it. Generated into the tree so the same artifact is first-class in Codex too.
CODEX_METADATA_PATH = "agents/openai.yaml"
diff --git a/products/skills/frontend/LLMSkillScene.stories.tsx b/products/skills/frontend/LLMSkillScene.stories.tsx
index 356f5d3507a6..666098cd7629 100644
--- a/products/skills/frontend/LLMSkillScene.stories.tsx
+++ b/products/skills/frontend/LLMSkillScene.stories.tsx
@@ -98,6 +98,7 @@ const SKILL: LLMSkillApi = {
{ level: 2, text: 'Steps' },
{ level: 2, text: 'Notes' },
],
+ spec_problems: [],
version: 4,
version_description: 'Added OCR guidance for scanned PDFs',
created_by: MOCK_AUTHOR,
@@ -127,6 +128,7 @@ const SKILL_LIST_ENTRY: LLMSkillListApi = {
metadata: {},
category: SKILL.category,
outline: SKILL.outline,
+ spec_problems: [],
version: SKILL.version,
version_description: SKILL.version_description,
created_by: SKILL.created_by,
diff --git a/products/skills/frontend/generated/api.schemas.ts b/products/skills/frontend/generated/api.schemas.ts
index 54280eabbcdc..5b2a0c7a6e8b 100644
--- a/products/skills/frontend/generated/api.schemas.ts
+++ b/products/skills/frontend/generated/api.schemas.ts
@@ -267,6 +267,18 @@ export interface LLMSkillOutlineEntryApi {
text: string
}
+export interface LLMSkillSpecProblemApi {
+ /** Stable machine-readable code for the problem, e.g. description_too_long or file_path_collides. */
+ code: string
+ /** What is wrong and what to change, written for the skill's author. */
+ message: string
+ /**
+ * The bundled file the problem is about. Null when it is about the skill itself.
+ * @nullable
+ */
+ file_path: string | null
+}
+
export interface LLMSkillApi {
readonly id: string
/**
@@ -310,6 +322,8 @@ export interface LLMSkillApi {
readonly files: readonly LLMSkillFileManifestApi[]
/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */
readonly outline: readonly LLMSkillOutlineEntryApi[]
+ /** Why this skill is left out of the skills bundle and the plugin marketplace, as stable codes with author-facing messages. Empty when the skill packages cleanly. */
+ readonly spec_problems: readonly LLMSkillSpecProblemApi[]
readonly version: number
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -373,6 +387,8 @@ export interface LLMSkillListApi {
readonly owners: readonly UserBasicApi[]
/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */
readonly outline: readonly LLMSkillOutlineEntryApi[]
+ /** Why this skill is left out of the skills bundle and the plugin marketplace, as stable codes with author-facing messages. Empty when the skill packages cleanly. */
+ readonly spec_problems: readonly LLMSkillSpecProblemApi[]
readonly version: number
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -467,6 +483,8 @@ export interface LLMSkillCreateApi {
files?: LLMSkillFileInputApi[]
/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */
readonly outline: readonly LLMSkillOutlineEntryApi[]
+ /** Why this skill is left out of the skills bundle and the plugin marketplace, as stable codes with author-facing messages. Empty when the skill packages cleanly. */
+ readonly spec_problems: readonly LLMSkillSpecProblemApi[]
readonly version: number
/**
* Optional note describing what changed in this version. Set when the version is published.
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 9eac643c93eb..5abfff87edcf 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -49337,6 +49337,18 @@ export namespace Schemas {
text: string;
}
+ export interface LLMSkillSpecProblem {
+ /** Stable machine-readable code for the problem, e.g. description_too_long or file_path_collides. */
+ code: string;
+ /** What is wrong and what to change, written for the skill's author. */
+ message: string;
+ /**
+ * The bundled file the problem is about. Null when it is about the skill itself.
+ * @nullable
+ */
+ file_path: string | null;
+ }
+
export interface LLMSkill {
readonly id: string;
/**
@@ -49380,6 +49392,8 @@ export namespace Schemas {
readonly files: readonly LLMSkillFileManifest[];
/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */
readonly outline: readonly LLMSkillOutlineEntry[];
+ /** Why this skill is left out of the skills bundle and the plugin marketplace, as stable codes with author-facing messages. Empty when the skill packages cleanly. */
+ readonly spec_problems: readonly LLMSkillSpecProblem[];
readonly version: number;
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -49465,6 +49479,8 @@ export namespace Schemas {
files?: LLMSkillFileInput[];
/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */
readonly outline: readonly LLMSkillOutlineEntry[];
+ /** Why this skill is left out of the skills bundle and the plugin marketplace, as stable codes with author-facing messages. Empty when the skill packages cleanly. */
+ readonly spec_problems: readonly LLMSkillSpecProblem[];
readonly version: number;
/**
* Optional note describing what changed in this version. Set when the version is published.
@@ -49597,6 +49613,8 @@ export namespace Schemas {
readonly owners: readonly UserBasic[];
/** Flat list of markdown headings parsed from the skill body. Useful as a lightweight table of contents. */
readonly outline: readonly LLMSkillOutlineEntry[];
+ /** Why this skill is left out of the skills bundle and the plugin marketplace, as stable codes with author-facing messages. Empty when the skill packages cleanly. */
+ readonly spec_problems: readonly LLMSkillSpecProblem[];
readonly version: number;
/**
* Optional note describing what changed in this version. Set when the version is published.