cobra-modularity
CommunityModular Cobra CLIs with self-registering commands.
System Documentation
What problem does it solve?
Building scalable CLI tools often leads to monolithic root commands. This skill provides a modular Cobra-based architecture that lets each feature live in its own package and register itself with the root, avoiding centralized registration and making the codebase easier to extend and maintain.
Core Features & Use Cases
- Modular command structure: Each module implements a Register(parent *cobra.Command) and wires its own subcommands.
- Self-registration pattern: Modules automatically attach to the root without invasive root changes.
- Cobra best practices: Demonstrates RunE usage, persistent vs local flags, PreRun hooks, and proper argument validation.
- Use Case: Add a new feature module (e.g., a UUID generator) by placing it under modules/uuid and invoking Register on the root, enabling clean growth of CLI capabilities.
Quick Start
Create a new module directory under modules/yourmodule, implement a Register(parent *cobra.Command) function that attaches commands to the parent, and ensure subcommands self-register in init(). Example structure: modules/demo/ modules/uuid/
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: cobra-modularity Download link: https://github.com/yurifrl/cly/archive/main.zip#cobra-modularity Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.