* Implement pack registry system and management CLI Add registry.json manifests to agent packs and commands to support structured discovery. Include a CLI for project initialization, a registry generator script, and a plugin version locker. Add a new learn command for session documentation. * Add CLI and centralized workflow registry Implement an interactive CLI tool to browse and install workflow packs. Consolidate decentralized manifests into a single root registry for easier maintenance. * update * buffer * Rewrite CLI as TUI workflow selector Replace the Commander-based CLI with a TUI built on Bun, Solid.js, and OpenTUI. This version provides hierarchical navigation for selecting workflow packs and standalone items. - Migrate code from packages/cli to howaboua-cli - Support global (~/.config/opencode/) and local (.opencode/) sync - Add one-shot verification rules to howaboua-cli/AGENTS.md * chore: ignore @howaboua-cli directory --------- Co-authored-by: OpenCode Agent <agent@opencode.ai>
Opencode Commands Template
Note
Partially Deprecated: OpenCode now supports Skills natively, which provide a more powerful way to extend agent capabilities. This template remains useful if you want agents to discover and execute your
/commandsagentically via a COMMANDS.md index file. For new projects, consider using Skills instead.
Note
Highly recommended: opencode-snippets by JosXa - this plugin allows you to put in composable commands directly into your prompts. This effectively replaces custom commands so you could just replace
commandswithsnippetsand getsnippets2skills!
A universal template for creating Opencode-based projects with structured commands, tool integration, and automated documentation maintenance.
Architecture Overview
This template demonstrates how to build command-based projects using Opencode with:
- Structured Commands: Workflow templates in
.opencode/command/with YAML frontmatter - Tool Integration: Commands serving as interfaces to external utilities (JavaScript, Python, CLI tools)
- Documentation System: Automated maintenance via the
/sync-commandscommand - Template Structure: Ready-to-copy architecture for new projects
- RFC+XML Format: All command files use XML tags and RFC 2119 keywords for precise agent understanding
Opencode Compatibility
These commands follow the exact same rules and patterns as Opencode's built-in /commands. For comprehensive documentation on command structure and behavior, see the Opencode Commands Documentation.
Command Integration Pattern
4-Part Architecture:
-
Command File (
.opencode/command/*.md)- Defines workflow, usage patterns, and error handling
- Contains arguments section and step-by-step execution
- Example:
calculate.mdprovides structured interface to calculations
-
External Tool (
calculate.js)- Handles the actual execution logic safely
- CLI integration with proper argument parsing
- Example: JavaScript calculator with mathematical functions
-
CLI Invocation
- Simple command-line interface integration
node calculate.js "$EXPRESSION"template- Handles errors and outputs formatted results
-
Structured Output
- Contextual information and help systems
- Clear formatting with explanatory details
- Consistent presentation across different tool types
Tool Integration
Commands can integrate with any external tools or services:
- Script files: JavaScript, Python, Bash, or any executable scripts
- Bash tools: System utilities, package managers, development tools
- API endpoints: Any curlable REST APIs or webhooks
- Natural language workflows: Pure LLM-driven processes without external tools
The calculate.js example demonstrates how commands can serve as structured interfaces to external utilities.
Available Commands
/explore - Repository Analysis
- Purpose: Explore repository structure, key files, and architectural patterns
- Arguments: Context-based scope determination (quick, deep, folder-specific)
- Output: Organized repository structure report with insights
/calculate - Mathematical Operations
- Purpose: Perform arithmetic calculations and mathematical functions
- Arguments: Mathematical expressions or context-based determination
- Output: Formatted results with contextual information
- Tool:
calculate.js- JavaScript calculator with error handling
Template Usage
For New Projects:
- Copy this entire folder structure to your new project
- Create your own
opencode.jsonbased onexample-opencode.json:{ "$schema": "https://opencode.ai/config.json", "instructions": [ "COMMANDS.md" ] } - Modify commands in
.opencode/command/to match your project needs - Create corresponding tools (JavaScript, Python, etc.) as needed
- Run
/sync-commandsto keep COMMANDS.md in sync
Adding New Commands:
- Create command file in
.opencode/command/ - Follow the established structure:
- YAML description
- Arguments section
- Step-by-step workflow
- Create supporting tool if needed
- Run
/sync-commandsto update documentation
Template Maintenance
The /sync-commands command keeps COMMANDS.md synchronized with your command files:
COMMANDS.md
- Lists all available commands with descriptions
- Provides usage instructions for LLMs
- Maintains consistent formatting and structure
Template Consistency
- Ensures template structure remains accurate
- Synchronizes documentation with available commands
- Maintains proper formatting for template distribution
File Structure
project/
├── COMMANDS.md # Command index and usage guide
├── example-opencode.json # Example Opencode configuration
├── calculate.js # Example tool integration
└── .opencode/
└── command/
├── explore.md # Repository exploration
├── calculate.md # Mathematical calculations
└── sync-commands.md # COMMANDS.md synchronization
Model Compatibility
Commands.md is injected at the beginning of the session, so models need strong context management and instruction following capabilities.
Please let me know if you test this template on different models.
Tested Models
| Model | Performance | Behavior |
|---|---|---|
| GPT-5.2 | Excellent | Reliable execution of all command patterns |
| GPT-5.2 Codex | Excellent | Strong performance for code-related commands |
| GLM-4.6 | Limited | Erratic behavior with agentic instruction following |
Model Requirements
For optimal performance, models should excel at:
- Context Attention: "Seeing" COMMANDS.md throughout the session
- Instruction Following: Precise execution of multi-step workflows
- Agentic Capabilities: Understanding when and how to use available commands
Benefits of This Template
- Universal Architecture: Works for any type of command-based project
- Tool Integration: Clear pattern for external utility integration
- Documentation Automation: Self-maintaining documentation system
- Scalable Structure: Easy to add new commands and tools
- Template-Ready: Copy-and-paste architecture for new projects
- LLM-Friendly: Clear instructions and structured workflows
This template provides a solid foundation for building sophisticated command-based projects with Opencode, demonstrating best practices for command organization, tool integration, and documentation maintenance.