example-skill
npx machina-cli add skill paulp-o/ask-user-questions-mcp/example-skill --openclawFiles (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
- Define your skill using
defineSkill()inmodules/src/skills/<name>/index.ts - Create modular content in
prompts/subfolder - Import and register in
modules/src/skills/index.ts - 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
- Step 1: Define your skill using defineSkill() in modules/src/skills/example-skill/index.ts.
- Step 2: Create modular prompts under prompts/ for the skill content.
- 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