From 5d31e70b8a23008a745aa0315eeb6226694d481f Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Sat, 16 May 2026 23:38:46 +0200 Subject: [PATCH] fix(coding-agent): allow skill names to differ from directories closes #4534 --- packages/coding-agent/CHANGELOG.md | 1 + packages/coding-agent/docs/skills.md | 7 +++---- packages/coding-agent/src/core/skills.ts | 8 ++------ packages/coding-agent/test/skills.test.ts | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 95525d0c..b1a7a765 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixed +- Fixed skill diagnostics to stop warning when a skill name differs from its parent directory ([#4534](https://github.com/earendil-works/pi/issues/4534)). - Fixed prompt template argument parsing to split unquoted multiline input on newlines ([#4553](https://github.com/earendil-works/pi/issues/4553)). - Fixed `--resume` session listing to cap in-flight session metadata loads and avoid OOM on large session histories ([#4583](https://github.com/earendil-works/pi/issues/4583)). - Fixed interactive error messages to render with trailing spacing so reload errors do not run into resource listings ([#4510](https://github.com/earendil-works/pi/issues/4510)). diff --git a/packages/coding-agent/docs/skills.md b/packages/coding-agent/docs/skills.md index 746d549e..cb96dd97 100644 --- a/packages/coding-agent/docs/skills.md +++ b/packages/coding-agent/docs/skills.md @@ -4,7 +4,7 @@ Skills are self-contained capability packages that the agent loads on-demand. A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks. -Pi implements the [Agent Skills standard](https://agentskills.io/specification), warning about violations but remaining lenient. +Pi implements the [Agent Skills standard](https://agentskills.io/specification), warning about most violations but remaining lenient. Pi allows skill names to differ from their parent directory even though the standard disallows it; that rule is suboptimal for shared skill directories used across multiple agent harnesses. ## Table of Contents @@ -140,7 +140,7 @@ Per the [Agent Skills specification](https://agentskills.io/specification#frontm | Field | Required | Description | |-------|----------|-------------| -| `name` | Yes | Max 64 chars. Lowercase a-z, 0-9, hyphens. Must match parent directory. | +| `name` | Yes | Max 64 chars. Lowercase a-z, 0-9, hyphens. Unlike the standard, Pi does not require this to match the parent directory because that standard requirement is suboptimal for shared skill directories. | | `description` | Yes | Max 1024 chars. What the skill does and when to use it. | | `license` | No | License name or reference to bundled file. | | `compatibility` | No | Max 500 chars. Environment requirements. | @@ -154,7 +154,7 @@ Per the [Agent Skills specification](https://agentskills.io/specification#frontm - Lowercase letters, numbers, hyphens only - No leading/trailing hyphens - No consecutive hyphens -- Must match parent directory name +Pi does not require the name to match the parent directory. The Agent Skills standard does, but that requirement is suboptimal for shared skill directories used by multiple tools. Valid: `pdf-processing`, `data-analysis`, `code-review` Invalid: `PDF-Processing`, `-pdf`, `pdf--processing` @@ -177,7 +177,6 @@ description: Helps with PDFs. Pi validates skills against the Agent Skills standard. Most issues produce warnings but still load the skill: -- Name doesn't match parent directory - Name exceeds 64 characters or contains invalid characters - Name starts/ends with hyphen or has consecutive hyphens - Description exceeds 1024 characters diff --git a/packages/coding-agent/src/core/skills.ts b/packages/coding-agent/src/core/skills.ts index c0647473..82dc9a63 100644 --- a/packages/coding-agent/src/core/skills.ts +++ b/packages/coding-agent/src/core/skills.ts @@ -90,13 +90,9 @@ export interface LoadSkillsResult { * Validate skill name per Agent Skills spec. * Returns array of validation error messages (empty if valid). */ -function validateName(name: string, parentDirName: string): string[] { +function validateName(name: string): string[] { const errors: string[] = []; - if (name !== parentDirName) { - errors.push(`name "${name}" does not match parent directory "${parentDirName}"`); - } - if (name.length > MAX_NAME_LENGTH) { errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`); } @@ -301,7 +297,7 @@ function loadSkillFromFile( const name = frontmatter.name || parentDirName; // Validate name - const nameErrors = validateName(name, parentDirName); + const nameErrors = validateName(name); for (const error of nameErrors) { diagnostics.push({ type: "warning", message: error, path: filePath }); } diff --git a/packages/coding-agent/test/skills.test.ts b/packages/coding-agent/test/skills.test.ts index 84803e6b..36c02e87 100644 --- a/packages/coding-agent/test/skills.test.ts +++ b/packages/coding-agent/test/skills.test.ts @@ -41,7 +41,7 @@ describe("skills", () => { expect(diagnostics).toHaveLength(0); }); - it("should warn when name doesn't match parent directory", () => { + it("should allow names that don't match parent directory", () => { const { skills, diagnostics } = loadSkillsFromDir({ dir: join(fixturesDir, "name-mismatch"), source: "test", @@ -51,7 +51,7 @@ describe("skills", () => { expect(skills[0].name).toBe("different-name"); expect( diagnostics.some((d: ResourceDiagnostic) => d.message.includes("does not match parent directory")), - ).toBe(true); + ).toBe(false); }); it("should warn when name contains invalid characters", () => {