{"record":{"id":"ab67d1dc087e7075","repo":"mastra-ai/mastra","slug":"skill-md-not-found-in-skillpath","errorCode":null,"errorMessage":"SKILL.md not found in ${skillPath}","messagePattern":"SKILL\\.md not found in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/workspace/skills/publish.ts","lineNumber":330,"sourceCode":"          mimeType,\n          createdAt: now,\n        });\n      }\n    }\n  }\n\n  const tree: SkillVersionTree = { entries: treeEntries };\n  const blobs = Array.from(blobMap.values());\n  const fileNodes = buildSkillFileNodes(files);\n\n  // 3. Parse SKILL.md frontmatter and discover references/scripts/assets paths\n  let snapshot: Omit<StorageSkillSnapshotType, 'tree'>;\n  try {\n    snapshot = parseSkillSnapshotFromFiles(files);\n  } catch (err) {\n    // Surface the skill path to make the error easier to debug\n    if (err instanceof Error && err.message.includes('SKILL.md not found')) {\n      throw new Error(`SKILL.md not found in ${skillPath}`);\n    }\n    throw err;\n  }\n\n  return { snapshot, tree, blobs, files: fileNodes };\n}\n\n/**\n * Publish a skill: collect files, store blobs, create version.\n * This is the full publish flow.\n *\n * @param source - The SkillSource to read from\n * @param skillPath - Path to the skill directory\n * @param blobStore - Where to store file blobs\n */\nexport async function publishSkillFromSource(\n  source: SkillSource,\n  skillPath: string,","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/workspace/skills/publish.ts#L312-L348","documentation":"collectSkillForPublish gathers all files under a skill directory and then parses a snapshot; when the underlying parse fails because SKILL.md is absent, it rethrows with the skill's path included so the developer knows which directory is broken. This is the user-facing form of the 'SKILL.md not found in skill files' error.","triggerScenarios":"Calling collectSkillForPublish(skillPath) where the directory at skillPath has no root-level SKILL.md (missing, misnamed, or excluded by collection filters).","commonSituations":"Publishing a freshly scaffolded skill folder where only assets were copied; renaming SKILL.md to something else; .gitignore-like filters dropping SKILL.md; wrong skillPath passed (parent dir instead of the skill dir).","solutions":["Create or restore SKILL.md at the root of the directory passed as skillPath, with valid frontmatter.","Check the spelling/casing of the filename — it must be exactly 'SKILL.md'.","Confirm skillPath points at the skill directory itself, not its parent or a subfolder.","Review any include/exclude globs in the collection step so SKILL.md isn't filtered out."],"exampleFix":"// before\nawait collectSkillForPublish('./skills/my-skill'); // dir has only assets/\n// after\n// add ./skills/my-skill/SKILL.md with frontmatter:\n// ---\n// name: my-skill\n// description: ...\n// ---\nawait collectSkillForPublish('./skills/my-skill');","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (!existsSync(`${skillPath}/SKILL.md`)) {\n  throw new Error(`Refusing to publish '${skillPath}': missing SKILL.md`);\n}\nconst result = await collectSkillForPublish(skillPath);","typeGuard":null,"tryCatchPattern":"try {\n  return await collectSkillForPublish(skillPath);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('SKILL.md not found in')) {\n    // guide the user to add SKILL.md at that path\n  }\n  throw err;\n}","preventionTips":["Scaffold new skills from a template that always includes SKILL.md.","Point skillPath at the skill directory itself, not its parent.","CI check: fail fast if any skills/* directory lacks SKILL.md."],"tags":["skills","publishing","missing-file","validation"],"backgroundTag":"missing-required-file","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}