cli-expert

Design npm-based CLIs with Unix philosophy and Commander.js or Yargs.

Updated Oct 17, 2025
One-click install
npx skills add https://github.com/duynhne/monitoring --skill cli-expert-duynhne
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-expert
Source: https://github.com/duynhne/monitoring/tree/main/.agent/skills/cli-expert
Command: npx skills add https://github.com/duynhne/monitoring --skill cli-expert-duynhne

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides developers in building robust npm-based CLIs by applying the Unix philosophy and pragmatic patterns, covering root detection, argument parsing, and interactive/non-interactive UX.

Core Features & Use Cases

  • Proactive CLI design guidance for npm packages, including project layout, command structure, and UX conventions.
  • Recommendations for libraries (Commander.js, Yargs), prompts (Inquirer), and visual polish (Chalk, Ora).
  • Use Case: starting a new CLI project, adding subcommands, and implementing a reliable non-interactive mode for CI.

Quick Start

Initialize a starter Node.js CLI scaffold with automatic root detection, a main command, and a sample subcommand, then tailor it to your project.

Frequently Asked Questions about cli-expert

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

FAQPage Schema
How do I design an npm CLI that follows Unix philosophy and best-practice patterns?

To design an npm CLI following Unix philosophy, apply modular patterns for project root detection, argument parsing, and interactive versus non-interactive UX. This approach ensures your command-line tool remains composable, testable, and user-friendly across mono-repos and multi-command setups.

What is the best way to structure a Node.js CLI for both interactive use and CI environments?

The best way to structure a Node.js CLI for CI environments is implementing a reliable non-interactive mode alongside interactive prompts. This dual-mode UX design allows your command-line tool to execute seamlessly in automated pipelines while providing user-friendly prompts during local development.

Commander.js vs Yargs: which library should I use for npm CLI argument parsing?

Choosing between Commander.js and Yargs for npm CLI argument parsing depends on your command structure complexity. Commander.js offers a lightweight, intuitive API for standard commands, while Yargs provides advanced features for multi-command setups and complex argument validation in mono-repos.

How do I implement project root detection for a CLI tool in a mono-repo setup?

Implementing project root detection for a CLI tool in a mono-repo setup involves scanning directory structures upward to locate configuration files or workspace boundaries. This pattern ensures your npm CLI executes commands relative to the correct project root across multi-command mono-repo architectures.

Does this CLI design approach support cross-platform command execution on Windows and Unix?

Yes, this CLI design approach supports cross-platform command execution on Windows and Unix systems. By emphasizing cross-platform command design alongside the Unix ethos, your npm-based CLI tools maintain consistent behavior and path handling across different operating system environments.