Skip to main content

Function: writeSkillFile()

writeSkillFile(tool, outputDir): Promise<string>

Defined in: packages/agentos/src/cognition/emergent/SkillExporter.ts:460

Writes a SKILL.md file to disk for an emergent tool.

Creates the output directory if it does not exist. The file is written to <outputDir>/<tool.name>/SKILL.md. The tool's name must be a safe folder name and its folder must resolve inside outputDir, and below outputDir the file is written through no link and only into a regular file; otherwise nothing is written.

Parameters​

tool​

EmergentTool

The emergent tool to export.

outputDir​

string

Base directory where the skill subdirectory will be created.

Returns​

Promise<string>

Absolute path to the written SKILL.md file.

Throws​

If the tool's name is not a safe folder name or its folder would lie outside outputDir. Nothing is written.

Throws​

If a link, a second name or anything but a regular file is at the tool's folder or at SKILL.md. Nothing is written.

Throws​

If the filesystem write fails (permissions, disk full, etc.).

Example​

const skillPath = await writeSkillFile(myTool, '/home/user/.wunderland/capabilities');
// => "/home/user/.wunderland/capabilities/my-tool/SKILL.md"