一键导入
simple-skill
A minimal example demonstrating how to create skills with Skill Engine
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
A minimal example demonstrating how to create skills with Skill Engine
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Docker container and image management with native docker CLI integration. Use when you need to manage containers, images, networks, volumes, or run Docker Compose.
Video and audio processing using FFmpeg inside a secure Docker container
Image manipulation and conversion using ImageMagick inside a secure Docker container
MongoDB database client with Docker-based mongosh CLI
MySQL database client with Docker-based mysql CLI
PostgreSQL CLI client (psql) for database operations running inside a Docker container
| name | simple-skill |
| version | 1.0.0 |
| description | A minimal example demonstrating how to create skills with Skill Engine |
| author | Skill Engine Team |
| allowed-tools | ["hello","echo","calculate"] |
A minimal example demonstrating how easy it is to create skills with Skill Engine. This skill showcases the basic patterns for defining tools, handling parameters, and returning results - perfect for learning or as a template for new skills.
This skill requires no build steps - just write JavaScript and run! The runtime automatically compiles to WASM on first run and caches the result for fast subsequent executions.
Use this skill to:
Use this skill as a reference when:
Greet someone with a friendly message.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | Yes | - | Name of the person to greet |
| greeting | string | No | Hello | Custom greeting message |
Example:
# Basic greeting
skill run simple-skill hello name=World
# Output: Hello, World! 👋
# Custom greeting
skill run simple-skill hello name=Alice greeting="Hi"
# Output: Hi, Alice! 👋
# Direct path execution
skill run ./examples/wasm-skills/simple-skill hello name=Bob
Echo back the provided message, optionally repeating it multiple times.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| message | string | Yes | - | Message to echo back |
| repeat | number | No | 1 | Number of times to repeat the message |
Example:
# Simple echo
skill run simple-skill echo message="Hello World"
# Output: Hello World
# Repeat 3 times
skill run simple-skill echo message="Testing" repeat=3
# Output:
# Testing
# Testing
# Testing
# Echo with special characters
skill run simple-skill echo message="Skills are great!" repeat=2
Perform basic arithmetic operations on two numbers.
| Parameter | Type | Required | Description |
|---|---|---|---|
| operation | string | Yes | Operation: add, subtract, multiply, divide |
| a | number | Yes | First number |
| b | number | Yes | Second number |
Example:
# Addition
skill run simple-skill calculate operation=add a=10 b=5
# Output: 10 add 5 = 15
# Subtraction
skill run simple-skill calculate operation=subtract a=20 b=8
# Output: 20 subtract 8 = 12
# Multiplication
skill run simple-skill calculate operation=multiply a=7 b=6
# Output: 7 multiply 6 = 42
# Division
skill run simple-skill calculate operation=divide a=100 b=4
# Output: 100 divide 4 = 25
# Decimals work too
skill run simple-skill calculate operation=divide a=22 b=7
# Output: 22 divide 7 = 3.142857142857143
skill.js needs compilation~/.skill-engine/local-cache/skill.js changed (via hash)This skill demonstrates the minimal required structure:
// 1. Metadata - Basic information about your skill
export function getMetadata() {
return {
name: "simple-skill",
version: "1.0.0",
description: "A simple example skill",
author: "Skill Engine Team"
};
}
// 2. Tool Definitions - Declare available tools and their parameters
export function getTools() {
return [
{
name: "hello",
description: "Greet someone",
parameters: [
{
name: "name",
paramType: "string", // Type: string, number, boolean
description: "Name to greet",
required: true, // Is this parameter required?
defaultValue: "World" // Optional default value
}
]
}
];
}
// 3. Tool Execution - Handle tool invocations
export async function executeTool(toolName, argsJson) {
const args = JSON.parse(argsJson);
if (toolName === "hello") {
return {
success: true,
output: `Hello, ${args.name}!\n`,
errorMessage: null
};
}
return {
success: false,
output: "",
errorMessage: `Unknown tool: ${toolName}`
};
}
// 4. Config Validation (Optional) - Validate configuration
export async function validateConfig() {
return { ok: null };
}
When defining tools in getTools(), use these parameter types:
| paramType | JavaScript Type | Example Values | Validation |
|---|---|---|---|
string | String | "hello", "world" | Any text |
number | Number | 42, 3.14, -10 | Parsed as float |
boolean | Boolean | true, false | true/false only |
{
name: "param_name", // Parameter name (use snake_case)
paramType: "string", // Type: string, number, boolean
description: "What it does", // Clear description for users
required: true, // true = required, false = optional
defaultValue: "default" // Optional: default if not provided
}
# Create directory
mkdir my-skill
cd my-skill
# Create skill.js (copy from examples/wasm-skills/simple-skill/skill.js)
cat > skill.js << 'EOF'
export function getMetadata() {
return {
name: "my-skill",
version: "1.0.0",
description: "My first skill"
};
}
// ... add getTools() and executeTool() ...
EOF
# Run directly without installing
skill run ./my-skill tool-name param1=value1
# Check tool list
skill info ./my-skill
# View parameter help
skill run ./my-skill tool-name --help
# 1. Edit skill.js
vim skill.js
# 2. Run immediately (auto-recompiles)
skill run ./my-skill tool-name
# No build steps, no npm install, no package.json needed!
# Once ready, install globally
skill install ./my-skill
# Now run from anywhere
skill run my-skill tool-name
If your skill needs configuration (API keys, URLs, etc.):
[config]
api_key = "your-key-here"
api_url = "https://api.example.com"
timeout = 30
Configuration is automatically exposed as environment variables with SKILL_ prefix:
export async function executeTool(toolName, argsJson) {
const apiKey = process.env.SKILL_API_KEY;
const apiUrl = process.env.SKILL_API_URL;
const timeout = parseInt(process.env.SKILL_TIMEOUT || "30");
// Use configuration in your tool logic
}
export async function validateConfig() {
const apiKey = process.env.SKILL_API_KEY;
if (!apiKey) {
return {
ok: null,
error: "SKILL_API_KEY is required"
};
}
return { ok: null };
}
You can write skills in TypeScript - just change the extension:
# Rename to .ts
mv skill.js skill.ts
# Runtime automatically compiles TypeScript → JavaScript → WASM
skill run ./my-skill tool-name
// Bad - unclear error
return { success: false, output: "", errorMessage: "Error" };
// Good - specific error
return {
success: false,
output: "",
errorMessage: "Invalid operation: 'foo'. Use: add, subtract, multiply, or divide"
};
function handleCalculate(args) {
// Validate first
if (isNaN(parseFloat(args.a)) || isNaN(parseFloat(args.b))) {
return {
success: false,
output: "",
errorMessage: "Both 'a' and 'b' must be valid numbers"
};
}
// Then process
const result = parseFloat(args.a) + parseFloat(args.b);
return { success: true, output: `${result}\n`, errorMessage: null };
}
function handleDivide(args) {
const a = parseFloat(args.a);
const b = parseFloat(args.b);
// Check for division by zero
if (b === 0) {
return {
success: false,
output: "",
errorMessage: "Cannot divide by zero"
};
}
return { success: true, output: `${a / b}\n`, errorMessage: null };
}
# List available tools
skill info simple-skill
# Test each tool
skill run simple-skill hello name=Test
skill run simple-skill echo message="Testing 123"
skill run simple-skill calculate operation=add a=2 b=2
# Check parameter validation
skill run simple-skill hello # Missing required param
skill run simple-skill calculate operation=add # Missing required params
# Test edge cases
skill run simple-skill calculate operation=divide a=10 b=0 # Division by zero
skill run simple-skill echo message="Test" repeat=-1 # Negative repeat
After mastering this simple skill:
Study More Examples:
github-skill - HTTP API integrationslack-skill - OAuth authenticationkubernetes-skill - Native tool executionLearn the SDK:
Build Real Skills:
MIT - Use as a template for your own skills!