diff --git a/src/features/opencode-skill-loader/loader.ts b/src/features/opencode-skill-loader/loader.ts index 2d59f1477..5d6561da6 100644 --- a/src/features/opencode-skill-loader/loader.ts +++ b/src/features/opencode-skill-loader/loader.ts @@ -63,7 +63,7 @@ async function loadSkillFromPath( ): Promise { try { const content = await fs.readFile(skillPath, "utf-8") - const { data } = parseFrontmatter(content) + const { data, body } = parseFrontmatter(content) const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content) const mcpJsonMcp = await loadMcpJsonFromDir(resolvedPath) const mcpConfig = mcpJsonMcp || frontmatterMcp @@ -73,14 +73,7 @@ async function loadSkillFromPath( const isOpencodeSource = scope === "opencode" || scope === "opencode-project" const formattedDescription = `(${scope} - Skill) ${originalDescription}` - const lazyContent: LazyContentLoader = { - loaded: false, - content: undefined, - load: async () => { - if (!lazyContent.loaded) { - const fileContent = await fs.readFile(skillPath, "utf-8") - const { body } = parseFrontmatter(fileContent) - lazyContent.content = ` + const templateContent = ` Base directory for this skill: ${resolvedPath}/ File references (@path) in this skill are relative to this directory. @@ -90,16 +83,17 @@ ${body.trim()} $ARGUMENTS ` - lazyContent.loaded = true - } - return lazyContent.content! - }, + + const lazyContent: LazyContentLoader = { + loaded: true, + content: templateContent, + load: async () => templateContent, } const definition: CommandDefinition = { name: skillName, description: formattedDescription, - template: "", + template: templateContent, model: sanitizeModelField(data.model, isOpencodeSource ? "opencode" : "claude-code"), agent: data.agent, subtask: data.subtask,