Defining Skills
Learn how to define monetized skills with the skill() function.
Defining Skills
The skill() function creates a skill definition with pricing, metadata, and handler.
Basic Usage
Skill Options
Price Format
You can specify prices in multiple formats:
| Format | Example | Result |
|---|---|---|
| Dollar sign | '$0.001' | 0.001 USDC |
| With currency | '0.005 USDC' | 0.005 USDC |
| Plain number | '0.01' | 0.01 USDC |
Timeout
Set maximum execution time (default: 60 seconds, max: 5 minutes):
Input/Output Schemas
Define JSON Schemas for validation and documentation:
The Handler Function
The handler is an async function that receives input and returns output:
Type-Safe Handlers
Use TypeScript for type safety:
Error Handling
Throw errors to return a 500 response:
In production (NODE_ENV=production), error messages are masked to prevent information disclosure.
Skill Definition Object
The skill() function returns a SkillDefinition:
Multiple Skills
You can define multiple skills and serve them together:
Next Steps
- Serving Skills - Configure and run your server
- Registration - Register with the marketplace