cli-patterns

Create Commander.js CLI commands with standardized patterns for options, prompts, and output.

Updated Jan 13, 2026
One-click install
npx skills add https://github.com/ADLenehan/battery --skill cli-patterns-adlenehan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-patterns
Source: https://github.com/ADLenehan/battery/tree/main/.claude/skills/cli-patterns
Command: npx skills add https://github.com/ADLenehan/battery --skill cli-patterns-adlenehan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinating the creation of Battery CLI commands across projects is error-prone and inconsistent. This skill provides a standardized approach to building commands with Commander.js, ensuring uniform structure, options, prompts, and output formatting.

Core Features & Use Cases

  • Unified command structure: reuse proven patterns for subcommands, arguments, and actions.
  • Option and flag handling: consistent parsing, defaults, validation, and help text.
  • Output formatting & prompts: standardized UI feedback, colors, spinners, and interactive prompts.
  • Use Case: when adding a new command like deploy or config, follow these patterns to rapidly deliver a reliable CLI feature.

Quick Start

Create a new Commander.js command with a name, a few options, and an action handler to implement the feature.

Frequently Asked Questions about cli-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create consistent CLI commands with Commander.js across a monorepo?

Standardized CLI patterns provide reusable blueprints for command structure, option parsing, and output formatting using Commander.js, ensuring uniform behavior and reducing inconsistencies when adding new commands across monorepo projects.

What is the best way to standardize interactive prompts and output formatting in a CLI?

The best way to standardize interactive prompts and output formatting in a CLI is to enforce documented patterns for UI feedback, colors, and spinners, ensuring consistent visual responses and interactive experiences across all command actions.

How do I handle errors and validate flags when building a new CLI command?

Handle errors and validate flags in a new CLI command by applying standardized patterns for consistent parsing, defining defaults, and enforcing validation rules, which ensures robust error handling and predictable command execution.

Can I use these CLI patterns to rapidly add new subcommands and arguments?

Yes, you can use these CLI patterns to rapidly add new subcommands and arguments by reusing proven structures for command definitions and action handlers, allowing you to quickly deliver reliable CLI features without rewriting boilerplate code.

Why does my Battery CLI command structure feel inconsistent across different projects?

Your Battery CLI command structure feels inconsistent across projects due to a lack of standardized patterns for options, prompts, and output formatting, which can be resolved by applying a unified Commander.js approach to coordinate command creation.