cli-expert

Builds and troubleshoots npm package CLIs with cross-platform compatibility and Unix philosophy patterns.

3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill cli-expert-trudyan141
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-expert
Source: https://github.com/trudyan141/my-antigravity-agents-kit/tree/main/templates/.agent/skills/cli-expert
Command: npx skills add https://github.com/trudyan141/my-antigravity-agents-kit --skill cli-expert-trudyan141

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building command-line tools for npm packages involves recurring pitfalls: corrupted shebangs, PATH misconfiguration, broken Windows compatibility, frozen spinners, and failed global installs. This Skill provides research-backed solutions to 50+ documented CLI problems so you can ship working command-line tools without rediscovering these issues. ## Core Features & Use Cases - Installation & Distribution Fixes: Diagnose and resolve shebang corruption, binary permission issues, npm PATH problems, and pre-publish validation with npm pack testing. - Cross-Platform Compatibility: Implement correct path handling, config directory conventions (Windows/macOS/Linux), line ending management, and CI matrix testing across operating systems. - CLI Architecture Guidance: Apply Unix philosophy principles, choose argument parsing libraries (Commander.js, Yargs, parseArgs), detect monorepos (pnpm, Nx, Lerna), and handle TTY/CI interactive mode detection. - Use Case: You are publishing an npm CLI tool and users report it fails on Windows with path errors and the spinner freezes during prompts. This Skill walks you through path.join() fixes, async spinner patterns, and a GitHub Actions CI matrix to catch these issues before release. ## Quick Start Ask the agent to review your npm CLI package for cross-platform compatibility and common installation issues before publishing.

Frequently Asked Questions about cli-expert

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

FAQPage Schema
How do I build a CLI tool for an npm package?

Add a shebang (#!/usr/bin/env node) to your entry file, map command names in the package.json bin field, and use Commander.js or Yargs for argument parsing. Validate with npm pack and a global test install before publishing.

Commander.js vs Yargs vs parseArgs for CLI argument parsing?

Use native util.parseArgs for simple CLIs with under three commands, Commander.js for standard projects (39K+ dependents), and Yargs when you need middleware and complex validation. Oclif fits enterprise CLIs needing plugin architectures.

Why does my npm CLI break on Windows?

Windows failures usually come from hard-coded path separators, CRLF line endings corrupting the shebang, or incorrect config directory paths. Use path.join(), enforce LF via .gitattributes, and resolve config paths per platform with os.platform().

Why does my Inquirer.js spinner freeze during prompts?

Spinners freeze when synchronous code blocks the Node.js event loop. Ensure the wrapped operation is truly asynchronous using async/await, then call spinner.succeed() or spinner.fail() after the awaited operation completes.

How do I detect if a CLI runs in CI or interactive terminal?

Check process.stdin.isTTY and process.stdout.isTTY together with the absence of process.env.CI. In non-interactive mode, disable colors, spinners, and prompts, and fall back to plain output or default values.

How do I test an npm CLI before publishing?

Run npm pack, install the tarball globally with npm install -g, then verify the binary resolves via which and responds to --version. Automate this in CI across ubuntu, windows, and macos runners with a Node version matrix.