Get the FREE Ultimate OpenClaw Setup Guide →

example-skill

npx machina-cli add skill paulp-o/ask-user-questions-mcp/example-skill --openclaw
Files (1)
SKILL.md
756 B

This is an example skill that demonstrates the programmatic skill definition pattern.

Purpose: Show how to define skills using TypeScript with modular prompt composition.

Steps

  1. Define your skill using defineSkill() in modules/src/skills/<name>/index.ts
  2. Create modular content in prompts/ subfolder
  3. Import and register in modules/src/skills/index.ts
  4. Run build to generate SKILL.md files

Guardrails

  • Skills are static content (no template variables)
  • Use kebab-case for skill names
  • Avoid names that conflict with openspec-* skills

Source

git clone https://github.com/paulp-o/ask-user-questions-mcp/blob/master/.opencode/skills/example-skill/SKILL.mdView on GitHub

Overview

example-skill demonstrates how to define skills with TypeScript using defineSkill() and modular prompts. It shows the programmatic pattern for building reusable skill content that can be compiled into a SKILL.md file.

How This Skill Works

The pattern defines the skill in modules/src/skills/example-skill/index.ts using defineSkill(), then creates modular prompts in prompts/ and registers the skill in modules/src/skills/index.ts. A build step generates SKILL.md from the defined structure.

When to Use It

  • Onboarding new engineers to the programmatic skill pattern and showing a concrete example.
  • Demonstrating modular prompts and how they compose a skill's content.
  • Documenting a repository with a runnable template skill (example-skill).
  • Verifying the required project structure (modules/src/skills and prompts/).
  • Teaching how to avoid template variables and adhere to naming rules.

Quick Start

  1. Step 1: Define your skill using defineSkill() in modules/src/skills/example-skill/index.ts.
  2. Step 2: Create modular prompts under prompts/ for the skill content.
  3. Step 3: Import, register in modules/src/skills/index.ts, then run the build to generate SKILL.md.

Best Practices

  • Name skills in kebab-case (e.g., example-skill) to prevent conflicts.
  • Keep content static; avoid template variables in the skill.
  • Organize content modularly under prompts/ to support composition.
  • Register skills consistently in modules/src/skills/index.ts.
  • Always run the build step to regenerate SKILL.md after updates.

Example Use Cases

  • Basic example showing defineSkill() usage.
  • Prompts/ folder containing modular content for the skill.
  • Skills index.ts with registration for discovery by the system.
  • Build process generating SKILL.md for documentation.
  • Guardrails example: static content and naming constraints.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers