Overview
- Skill Key
- ianderrington/universal-command
- Author
- ianderrington
- Source Repo
- openclaw/skills
- Version
- -
- Source Path
- skills/ianderrington/universal-command
- Latest Commit SHA
- 1a30fe254e4633e5fc062d0d2faf593b1c873174
Define commands once, deploy to CLI, API, and MCP automatically. Use when building new commands/tools for Supernal — ensures consistent interfaces across all surfaces. DO NOT rebuild this pattern — use this package.
Stars
0
Installs
0
Status
ACTIVE
Visibility
PUBLIC
直接复制以下提示词,发送给你的 AI 助手即可完成安装。
请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 universal-command 技能。 若已安装,则直接安装 universal-command 技能。
# @supernal/universal-command
**Define once, deploy everywhere.** Single source of truth for CLI, API, and MCP interfaces.
## ⚠️ CRITICAL: Use This, Don't Rebuild
If you're building commands for Supernal, **use this package**. Don't create separate CLI/API/MCP implementations.
## Installation
```bash
npm install @supernal/universal-command
```
## Quick Start
### Define a Command
```typescript
import { UniversalCommand } from '@supernal/universal-command';
export const userCreate = new UniversalCommand({
name: 'user create',
description: 'Create a new user',
input: {
parameters: [
{ name: 'name', type: 'string', required: true },
{ name: 'email', type: 'string', required: true },
{ name: 'role', type: 'string', default: 'user', enum: ['user', 'admin'] },
],
},
output: { type: 'json' },
handler: async (args, context) => {
return await createUser(args);
},
});
```
### Deploy Everywhere
```typescript
// CLI
program.addCommand(userCreate.toCLI());
// → mycli user create --name "Alice" --email "alice@example.com"
// Next.js API
export const POST = userCreate.toNextAPI();
// → POST /api/users/create
// MCP Tool
const mcpTool = userCreate.toMCP();
// → user_create tool for AI agents
```
## Core Concepts
### Single Handler
Write your logic once. The handler receives validated args and returns the result:
```typescript
handler: async (args, context) => {
// This same code runs for CLI, API, and MCP
return await doThing(args);
}
```
### Input Schema
Define parameters once — validation, CLI options, API params, and MCP schema are auto-generated:
```typescript
input: {
parameters: [
{ name: 'id', type: 'string', required: true },
{ name: 'status', type: 'string', enum: ['draft', 'active', 'done'] },
{ name: 'limit', type: 'number', min: 1, max: 100, default: 10 },
],
}
```
### Interface-Specific Options
Override behavior per interface when needed:
```typescript
cli: {
format: (data)...
capt-marbles
Task Router
capncoconut
Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay, check marketplace stats, or manage agent credentials. Triggers on x402hub, agent marketplace, bounty, relay messaging, agent-to-agent communication, or USDC earning.
capevace
Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.
captchasco
OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.
carol-gutianle
name: modelready description: Start using a local or Hugging Face model instantly, directly from chat. metadata: {"openclaw":{"requires":{"bins": "bash", "curl" }, "env": "URL" }}
canbirlik
Controls Wiz smart bulbs (turn on/off, RGB colors, disco mode) via local WiFi.