What problem does it solve?
This Skill addresses the complexity and lack of modularity in CLI tools with a single file handling registration, routing, and multiple handlers. It helps in isolating the routing logic for better unit testing and maintainability.
Core Features & Use Cases
- Command Routing Refactoring: Extracts routing logic from a CLI handler file to a dedicated router module, improving code readability and maintainability.
- Handler Isolation: Separates handler implementations, making it easier to unit-test individual handlers.
- Contextual Handling: Provides a unified context type for handlers, with options for natural-language intercept fallback.
- Use Case: Ideal for CLI tools or Pi extensions where a single file mixes command registration, routing logic, and handlers, leading to a monolithic and hard-to-maintain codebase.
Quick Start
Use the extract-command-router skill to refactor the command routing in your CLI tool by moving it into a new 'router.ts' file.