Category: guide
Purpose: Rapidly build, register, and deploy CLI tools for OpenAgents Control skills
Framework: FAB (Features, Advantages, Benefits)
Don't start from scratch. Use the standard pattern to build robust CLIs in minutes.
mkdir -p .opencode/skills/{name}/scriptsskill-cli.ts (TypeScript) and router.sh (Bash)registry.jsonbash .opencode/skills/{name}/router.sh help| Component | File | Purpose |
|---|---|---|
| Logic | scripts/skill-cli.ts |
Type-safe implementation using ts-node. Handles args, logic, and output. |
| Router | router.sh |
Universal entry point. Routes commands to the TS script. |
| Docs | SKILL.md |
User guide, examples, and integration details. |
| Config | registry.json |
Makes the skill discoverable and installable via install.sh. |
router.sh)Why: Provides a consistent, dependency-free entry point for all environments.
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
case "$1" in
help|--help|-h)
echo "Usage: bash router.sh <command>"
;;
*)
# Route to TypeScript implementation
npx ts-node "$SCRIPT_DIR/scripts/skill-cli.ts" "$@"
;;
esac
skill-cli.ts)Why: Type safety, async/await support, and rich ecosystem access.
#!/usr/bin/env ts-node
async function main() {
const [command, ...args] = process.argv.slice(2);
switch (command) {
case 'action':
await handleAction(args);
break;
default:
console.log("Unknown command");
process.exit(1);
}
}
main().catch(console.error);
Before shipping, verify your CLI delivers value:
router.sh help provide clear, actionable usage info?registry.json with correct paths?Apply content-creation principles to your CLI output:
npm test to verify."Reference: See .opencode/context/openagents-repo/guides/adding-skill.md for the full, detailed walkthrough.