What Does scripts/build-openclaw-skills.js Emit? OpenClaw Skill Package Generation Explained

The scripts/build-openclaw-skills.js Node.js script emits a set of OpenClaw-compatible SKILL.md files—each containing YAML front-matter with metadata plus the verbatim skill body—into the .openclaw/skills/ directory while logging each written file path to the console.

The scripts/build-openclaw-skills.js file in the DietrichGebert/ponytail repository serves as a build automation tool that transforms internal skill definitions into standardized OpenClaw packages. When executed, this script emits structured Markdown files that combine machine-readable metadata headers with the original skill content sourced from the skills/ folder.

Output Files Emitted by scripts/build-openclaw-skills.js

Generated SKILL.md Files in .openclaw/skills/

The primary output consists of individual SKILL.md files written to .openclaw/skills/<name>/SKILL.md for each Ponytail skill. The script creates these directories recursively if they do not exist, ensuring a clean output structure that mirrors the source organization.

A typical emitted file appears as follows:

---
name: ponytail
description: "Lazy senior dev mode for any coding task (write, refactor, fix, review): YAGNI, stdlib first, no unrequested abstractions. Not for non-coding requests."
homepage: https://github.com/DietrichGebert/ponytail
license: MIT
---

# Ponytail  

...original skill content...

YAML Front-Matter Metadata

Each emitted file begins with a YAML front-matter section containing four standardized fields populated by the script:

  • name – The skill identifier derived from the directory name.
  • description – A concise summary (≤160 characters) pulled from the internal DESCRIPTIONS map within scripts/build-openclaw-skills.js.
  • homepage – The repository URL, stored in the HOMEPAGE constant.
  • license – Hard-coded as MIT according to the source.

Verbatim Skill Body Content

Following the front-matter, the script copies the entire body of the source file skills/<name>/SKILL.md without modification. This ensures the canonical skill instructions remain synchronized between the source and the emitted OpenClaw package.

Step-by-Step Build Process

The scripts/build-openclaw-skills.js script executes a four-step pipeline to emit the OpenClaw packages:

  1. Constructs YAML front-matter using a template literal that injects the skill name, description from the DESCRIPTIONS map, HOMEPAGE URL, and hard-coded MIT license.

  2. Reads the canonical skill body from skills/<name>/SKILL.md via the sourceBody() helper function.

  3. Writes the combined output to .openclaw/skills/<name>/SKILL.md using fs.mkdirSync with recursive: true followed by fs.writeFileSync.

  4. Logs the operation to stdout using console.log('wrote', relativePath) for verification.

Implementation Details

The front-matter construction follows this exact template literal pattern found in the source:

const frontmatter = `---\nname: ${name}\ndescription: "${desc}"\nhomepage: ${HOMEPAGE}\nlicense: MIT\n---\n`;

The file system operations ensure directory existence before writing:

fs.mkdirSync(path.dirname(p), { recursive: true });
fs.writeFileSync(p, frontmatter + body);

Console Output Format

For every file successfully written, the script emits a log line to stdout displaying the relative path from the repository root:

wrote .openclaw/skills/ponytail/SKILL.md
wrote .openclaw/skills/ponytail-review/SKILL.md

Running the Build Script

To emit the OpenClaw skill packages locally, execute the script from the repository root:

node scripts/build-openclaw-skills.js

The script processes all skills defined in the DESCRIPTIONS map and populates the .openclaw/skills/ directory with the generated files, emitting one line of console output per skill processed.

Summary

  • scripts/build-openclaw-skills.js emits one SKILL.md file per Ponytail skill into .openclaw/skills/<name>/SKILL.md.
  • Each emitted file contains YAML front-matter with name, description, homepage, and license metadata.
  • The script preserves the original skill body verbatim from skills/<name>/SKILL.md.
  • Console output logs every written file path for build verification.
  • The build process uses standard Node.js fs module methods with recursive directory creation.

Frequently Asked Questions

What file format does scripts/build-openclaw-skills.js emit?

The script emits Markdown (.md) files specifically formatted for OpenClaw consumption. Each file contains YAML front-matter delimited by triple dashes (---) followed by the skill content body copied verbatim from the source.

Where does the script write its output files?

According to the source code in scripts/build-openclaw-skills.js, all output is written to the hidden directory .openclaw/skills/<name>/SKILL.md, where <name> corresponds to the individual skill identifier defined in the build configuration.

What metadata is included in the emitted SKILL.md files?

The emitted files include four metadata fields in the YAML front-matter: the skill name, a concise description (sourced from the internal DESCRIPTIONS map and limited to 160 characters), the repository homepage URL, and the license type (set to MIT).

How do I run scripts/build-openclaw-skills.js to generate the output?

Execute the Node.js script from your terminal with the command node scripts/build-openclaw-skills.js. The script requires no arguments and automatically processes all defined skills, emitting the corresponding files to the .openclaw/skills/ directory while logging progress to stdout.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →