different-ai/openwork · error · Error

Agent Skill name must match its parent directory.

Error message

Agent Skill name must match its parent directory.

What it means

This is a marketplace/store validation in the OpenWork Den plugin system. When a plugin whose sourceKind is 'agent_plugin_manifest' is stored, the server derives the Agent Skill's title from the manifest's raw source text (frontmatter `name`) and compares it to the directory the file lives in (second-to-last path segment). If they differ, the upload is rejected because OpenCode-style Agent Skills require the skill name to equal its parent directory name.

Source

Thrown at ee/apps/den-api/src/routes/org/plugin-system/store.ts:4682

  sourcePath: string
}): GithubPluginSkillImportSkill {
  const metadata = skillMetadataFromText(input.rawSourceText)
  const base = {
    description: metadata.description,
    name: metadata.title,
    pluginKey: input.plugin.key,
    pluginName: input.plugin.displayName,
    skillKey: githubPluginSkillKey({ pluginKey: input.plugin.key, sourcePath: input.sourcePath }),
    sourceSchemaVersion: input.plugin.sourceKind === "agent_plugin_manifest" ? input.plugin.sourceSchemaVersion : null,
    sourcePath: input.sourcePath,
  }
  if (input.plugin.sourceKind === "agent_plugin_manifest") {
    try {
      const projection = deriveSkillProjection({ rawSourceText: input.rawSourceText })
      const pathSegments = input.sourcePath.split("/").filter(Boolean)
      const skillDirectoryName = pathSegments.at(-2) ?? ""
      if (projection.title !== skillDirectoryName) {
        throw new Error("Agent Skill name must match its parent directory.")
      }
      return {
        ...base,
        description: projection.description,
        name: projection.title,
        rawSourceText: input.includeRawSourceText ? input.rawSourceText : undefined,
        skippedReason: null,
        supported: true,
      }
    } catch {
      return {
        ...base,
        skippedReason: "invalid_skill",
        supported: false,
      }
    }
  }
  if (!input.rawSourceText.trim() || !hasSkillFrontmatterName(input.rawSourceText)) {

View on GitHub (pinned to 2b7df46e8a)

Solutions

  1. Rename the skill's parent directory to exactly match the frontmatter `name:` value (usually the easiest, since the manifest content is authoritative).
  2. Alternatively, edit the SKILL.md frontmatter `name:` to exactly equal the parent directory name (case-sensitive, no spaces).
  3. Re-check the sourcePath used for the upload: pathSegments.at(-2) must be the skill directory — ensure you are uploading the SKILL.md path, not a nested or flat path where .at(-2) resolves to the wrong segment.
  4. Republish/re-save the plugin after the fix; the check runs on every store call.

Example fix

// before (skills/Data-Analysis/SKILL.md)
---
name: data analysis
---

// after (directory renamed to data-analysis, frontmatter matches)
---
name: data-analysis
---
# data-analysis skill
Defensive patterns

Strategy: validation

Validate before calling

function skillNameMatchesDirectory(sourcePath: string, rawSourceText: string): boolean {
  const dir = sourcePath.split("/").filter(Boolean).at(-2) ?? ""
  const m = /^name:\s*(.+)$/m.exec(rawSourceText)
  return m !== null && m[1].trim() === dir
}

Type guard

function hasValidSkillProjection(input: { sourcePath: string; rawSourceText: string }): boolean {
  const dir = input.sourcePath.split("/").filter(Boolean).at(-2)
  return typeof dir === "string" && dir.length > 0 &&
    deriveSkillProjection({ rawSourceText: input.rawSourceText }).title === dir
}

Try / catch

try {
  await storePlugin(input)
} catch (e) {
  if (e instanceof Error && e.message === "Agent Skill name must match its parent directory.") {
    // surface: rename dir or fix frontmatter name
  }
}

Prevention

When it happens

Trigger: Saving/publishing a plugin with sourceKind 'agent_plugin_manifest' via the org plugin store where the skill frontmatter `name:` field does not exactly match the directory containing SKILL.md (pathSegments.at(-2)). E.g. a file at `skills/my-skill/SKILL.md` whose frontmatter says `name: My Skill` or `name: myskill`.

Common situations: Hand-writing SKILL.md frontmatter with spaces, capitalization, hyphens, or underscores that differ from the folder name; renaming a skill folder without updating frontmatter (or vice versa); generated skills scaffolded with a template name; copy-pasting a skill into a differently named directory.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/78ebc1bc4c4c07ba. Report an issue: GitHub.