implementing-command-patterns

Official

Master robust CLI patterns for maintainable code.

Authoropenkaiden
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Advanced guidance for implementing command patterns in CLI applications to improve maintainability, testability, and reliability.

Core Features & Use Cases

  • Command struct pattern that encapsulates state, dependencies, and validated inputs.
  • preRun patterns for parameter validation, flag binding to struct fields, and environment-variable fallbacks.
  • run method structure with clear separation of concerns, deterministic behavior, and testable outputs.
  • JSON output support and error handling patterns that adapt to output modes.
  • Use Case: refactor a messy CLI into a consistent, well-tested command structure.

Quick Start

Create a new command following the patterns in this guide and bind flags directly to struct fields so preRun has immediate access to validated values.

Dependency Matrix

Required Modules

None required

Components

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: implementing-command-patterns
Download link: https://github.com/openkaiden/kdn/archive/main.zip#implementing-command-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 510,000+ vetted skills library on demand.