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.

fix(llma): rename skill_identifier back to skill_name on skills endpoints (#60054)

Paul D'Ambrae550637258b6
diff --git a/products/llm_analytics/backend/api/skills.py b/products/llm_analytics/backend/api/skills.py
index 695f77487093..cb3b93456089 100644
--- a/products/llm_analytics/backend/api/skills.py
+++ b/products/llm_analytics/backend/api/skills.py
@@ -304,31 +304,31 @@ class LLMSkillViewSet(
parameters=[LLMSkillFetchQuerySerializer],
responses={200: LLMSkillSerializer},
)
- @action(methods=["GET"], detail=False, url_path=r"name/(?P<skill_identifier>[^/]+)")
+ @action(methods=["GET"], detail=False, url_path=r"name/(?P<skill_name>[^/]+)")
@llma_track_latency("llma_skills_get_by_name")
@monitor(feature=None, endpoint="llma_skills_get_by_name", method="GET")
- def get_by_name(self, request: Request, skill_identifier: str = "", **kwargs) -> Response:
+ def get_by_name(self, request: Request, skill_name: str = "", **kwargs) -> Response:
version_params = self._get_requested_version_params(request)
version = cast(int | None, version_params.get("version"))
- skill = get_skill_by_name_from_db(self.team, skill_identifier, version)
+ skill = get_skill_by_name_from_db(self.team, skill_name, version)
- if skill is None and _is_uuid(skill_identifier):
- redirect = self._redirect_to_name(request, skill_identifier)
+ if skill is None and _is_uuid(skill_name):
+ redirect = self._redirect_to_name(request, skill_name)
if redirect is not None:
return redirect
if skill is None:
- return self._skill_not_found_response(skill_identifier)
+ return self._skill_not_found_response(skill_name)
return Response(self._serialize_skill(skill))
- def _redirect_to_name(self, request: Request, skill_identifier: str) -> Response | None:
- skill_by_id = get_active_skill_queryset(self.team).filter(id=skill_identifier).first()
+ def _redirect_to_name(self, request: Request, skill_name: str) -> Response | None:
+ skill_by_id = get_active_skill_queryset(self.team).filter(id=skill_name).first()
if skill_by_id is None:
return None
# Use a relative path (no build_absolute_uri) to avoid embedding the
# Host header in the Location value — prevents host-header open-redirect.
- redirect_url = request.get_full_path().replace(skill_identifier, skill_by_id.name, 1)
+ redirect_url = request.get_full_path().replace(skill_name, skill_by_id.name, 1)
response = Response(status=status.HTTP_302_FOUND)
response["Location"] = redirect_url
return response
@@ -337,7 +337,7 @@ class LLMSkillViewSet(
@get_by_name.mapping.patch
@llma_track_latency("llma_skills_publish_by_name")
@monitor(feature=None, endpoint="llma_skills_publish_by_name", method="PATCH")
- def update_by_name(self, request: Request, skill_identifier: str = "", **kwargs) -> Response:
+ def update_by_name(self, request: Request, skill_name: str = "", **kwargs) -> Response:
auth_error = self._ensure_web_authenticated(request)
if auth_error is not None:
return auth_error
@@ -349,7 +349,7 @@ class LLMSkillViewSet(
published_skill = publish_skill_version(
self.team,
user=cast(User, request.user),
- skill_name=skill_identifier,
+ skill_name=skill_name,
body=payload.validated_data.get("body"),
edits=payload.validated_data.get("edits"),
description=payload.validated_data.get("description"),
@@ -366,7 +366,7 @@ class LLMSkillViewSet(
raise serializers.ValidationError({"files": "Duplicate file paths are not allowed."}, code="unique")
raise
except LLMSkillNotFoundError:
- return self._skill_not_found_response(skill_identifier)
+ return self._skill_not_found_response(skill_name)
except LLMSkillVersionConflictError as err:
return Response(
{
diff --git a/products/llm_analytics/frontend/generated/api.ts b/products/llm_analytics/frontend/generated/api.ts
index 2c74e1fec32a..dc9f2a9b7be3 100644
--- a/products/llm_analytics/frontend/generated/api.ts
+++ b/products/llm_analytics/frontend/generated/api.ts
@@ -1752,7 +1752,7 @@ export const llmSkillsCreate = async (
export const getLlmSkillsNameRetrieveUrl = (
projectId: string,
- skillIdentifier: string,
+ skillName: string,
params?: LlmSkillsNameRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
@@ -1766,33 +1766,33 @@ export const getLlmSkillsNameRetrieveUrl = (
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
- ? `/api/environments/${projectId}/llm_skills/name/${skillIdentifier}/?${stringifiedParams}`
- : `/api/environments/${projectId}/llm_skills/name/${skillIdentifier}/`
+ ? `/api/environments/${projectId}/llm_skills/name/${skillName}/?${stringifiedParams}`
+ : `/api/environments/${projectId}/llm_skills/name/${skillName}/`
}
export const llmSkillsNameRetrieve = async (
projectId: string,
- skillIdentifier: string,
+ skillName: string,
params?: LlmSkillsNameRetrieveParams,
options?: RequestInit
): Promise<LLMSkillApi> => {
- return apiMutator<LLMSkillApi>(getLlmSkillsNameRetrieveUrl(projectId, skillIdentifier, params), {
+ return apiMutator<LLMSkillApi>(getLlmSkillsNameRetrieveUrl(projectId, skillName, params), {
...options,
method: 'GET',
})
}
-export const getLlmSkillsNamePartialUpdateUrl = (projectId: string, skillIdentifier: string) => {
- return `/api/environments/${projectId}/llm_skills/name/${skillIdentifier}/`
+export const getLlmSkillsNamePartialUpdateUrl = (projectId: string, skillName: string) => {
+ return `/api/environments/${projectId}/llm_skills/name/${skillName}/`
}
export const llmSkillsNamePartialUpdate = async (
projectId: string,
- skillIdentifier: string,
+ skillName: string,
patchedLLMSkillPublishApi?: PatchedLLMSkillPublishApi,
options?: RequestInit
): Promise<LLMSkillApi> => {
- return apiMutator<LLMSkillApi>(getLlmSkillsNamePartialUpdateUrl(projectId, skillIdentifier), {
+ return apiMutator<LLMSkillApi>(getLlmSkillsNamePartialUpdateUrl(projectId, skillName), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
diff --git a/services/mcp/src/generated/llm_analytics/api.ts b/services/mcp/src/generated/llm_analytics/api.ts
index a1ebc3b5981a..02c77567df2c 100644
--- a/services/mcp/src/generated/llm_analytics/api.ts
+++ b/services/mcp/src/generated/llm_analytics/api.ts
@@ -1510,7 +1510,7 @@ export const LlmSkillsCreateBody = /* @__PURE__ */ zod
})
.describe('Create serializer — accepts bundled files as write-only input on POST.')
-export const llmSkillsNameRetrievePathSkillIdentifierRegExp = new RegExp('^[^/]+$')
+export const llmSkillsNameRetrievePathSkillNameRegExp = new RegExp('^[^/]+$')
export const LlmSkillsNameRetrieveParams = /* @__PURE__ */ zod.object({
project_id: zod
@@ -1518,7 +1518,7 @@ export const LlmSkillsNameRetrieveParams = /* @__PURE__ */ zod.object({
.describe(
"Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
),
- skill_identifier: zod.string().regex(llmSkillsNameRetrievePathSkillIdentifierRegExp),
+ skill_name: zod.string().regex(llmSkillsNameRetrievePathSkillNameRegExp),
})
export const LlmSkillsNameRetrieveQueryParams = /* @__PURE__ */ zod.object({
@@ -1529,7 +1529,7 @@ export const LlmSkillsNameRetrieveQueryParams = /* @__PURE__ */ zod.object({
.describe('Specific skill version to fetch. If omitted, the latest version is returned.'),
})
-export const llmSkillsNamePartialUpdatePathSkillIdentifierRegExp = new RegExp('^[^/]+$')
+export const llmSkillsNamePartialUpdatePathSkillNameRegExp = new RegExp('^[^/]+$')
export const LlmSkillsNamePartialUpdateParams = /* @__PURE__ */ zod.object({
project_id: zod
@@ -1537,7 +1537,7 @@ export const LlmSkillsNamePartialUpdateParams = /* @__PURE__ */ zod.object({
.describe(
"Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
),
- skill_identifier: zod.string().regex(llmSkillsNamePartialUpdatePathSkillIdentifierRegExp),
+ skill_name: zod.string().regex(llmSkillsNamePartialUpdatePathSkillNameRegExp),
})
export const llmSkillsNamePartialUpdateBodyDescriptionMax = 4096
diff --git a/services/mcp/src/tools/generated/llm_analytics.ts b/services/mcp/src/tools/generated/llm_analytics.ts
index b26c61459137..f6a3ee3c35a1 100644
--- a/services/mcp/src/tools/generated/llm_analytics.ts
+++ b/services/mcp/src/tools/generated/llm_analytics.ts
@@ -1365,7 +1365,7 @@ const llmaSkillGet = (): ToolBase<typeof LlmaSkillGetSchema, Schemas.LLMSkill> =
const projectId = await context.stateManager.getProjectId()
const result = await context.api.request<Schemas.LLMSkill>({
method: 'GET',
- path: `/api/environments/${encodeURIComponent(String(projectId))}/llm_skills/name/${encodeURIComponent(String(params.skill_identifier))}/`,
+ path: `/api/environments/${encodeURIComponent(String(projectId))}/llm_skills/name/${encodeURIComponent(String(params.skill_name))}/`,
query: {
version: params.version,
},
@@ -1437,7 +1437,7 @@ const llmaSkillUpdate = (): ToolBase<typeof LlmaSkillUpdateSchema, Schemas.LLMSk
}
const result = await context.api.request<Schemas.LLMSkill>({
method: 'PATCH',
- path: `/api/environments/${encodeURIComponent(String(projectId))}/llm_skills/name/${encodeURIComponent(String(params.skill_identifier))}/`,
+ path: `/api/environments/${encodeURIComponent(String(projectId))}/llm_skills/name/${encodeURIComponent(String(params.skill_name))}/`,
body,
})
return result
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-get.json
index ecde453f3fb0..ed1bb018c7d8 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-get.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-get.json
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
- "skill_identifier": {
+ "skill_name": {
"pattern": "^[^/]+$",
"type": "string"
},
@@ -11,6 +11,6 @@
"type": "number"
}
},
- "required": ["skill_identifier"],
+ "required": ["skill_name"],
"type": "object"
}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-update.json
index 498a37d937d2..ccab96beb18b 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/common/llma-skill-update.json
@@ -116,11 +116,11 @@
},
"type": "object"
},
- "skill_identifier": {
+ "skill_name": {
"pattern": "^[^/]+$",
"type": "string"
}
},
- "required": ["skill_identifier"],
+ "required": ["skill_name"],
"type": "object"
}