🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

Universal Command Pattern

by @ianderrington

Define commands once, deploy to CLI, API, and MCP automatically. Use when building new commands/tools for Supernal — ensures consistent interfaces across all...

Versionv1.0.0
Installs1
When to Use
TriggerAction
✅ Adding CLI interface to existing logic
✅ Exposing functionality to AI agents (MCP)
✅ Creating REST APIs with consistent patterns
❌ Simple one-off scripts (overkill)
❌ Third-party integrations with their own patterns
💡 Examples

Define a Command

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

// 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

View on ClawHub
TERMINAL
clawhub install universal-command

🧪 Use this skill with your agent

Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

🔍 Can't find the right skill?

Search 60,000+ AI agent skills — free, no login needed.

Search Skills →