lirantal/nodejs-cli-apps-best-practices/nodejs-cli-best-practices

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Guide and audit Node.js CLI application development against 41 established best practices covering UX, distribution, interoperability, accessibility, testing, error handling, development setup, analytics, versioning, and security. Use this skill when building, extending, reviewing, or scaffolding a Node.js CLI — including when someone says "audit my CLI", "review my CLI code", "I'm building a CLI tool", or asks about adding argument parsing, help output, shell completion/autocomplete, error handling, color output, STDIN, --json flags, exit codes, --version flags, or npm publishing. Applies even when best practices are not explicitly mentioned. Also trigger for "how should I implement X in my CLI" or "what's the right way to do Y in a Node.js CLI". Do NOT use for Node.js backend or API development with no CLI entry point.

Install

npx vskill@latest install lirantal/nodejs-cli-apps-best-practices/nodejs-cli-best-practices

SKILL.md

This skill operates in two modes — audit for reviewing existing CLI code and development guide for building new features or tools.

Critical

Always read references/best-practices.md before producing any output. It contains the complete reference for all 41 practices with code examples and recommended packages. It is the source of truth for both modes — do not rely on general knowledge alone, as several practices (specific package recommendations, §X.X numbering, configuration precedence order) are specific to this guide.

Determining the mode

TriggerModeAction
User provides existing CLI code or files to reviewAuditProduce a structured audit report
User asks how to build or implement somethingDevelopment guideSurface relevant practices with examples
User says "review and help me improve"BothAudit first, then provide concrete guidance for each failing practice

Audit mode

Systematically compare the provided code against the practices in references/best-practices.md. Focus on what is verifiable from the code. Use judgment to mark practices as not applicable (➖) when there's genuinely no way to assess them from static analysis (e.g., Docker support when the project shows no distribution intent).

Prioritize by user impact — a missing exit code (§6.4) or absent --version flag (§9.1) affects every user and every CI pipeline; missing Docker image (§4.1) is low priority for most projects.

Audit report format
## Node.js CLI Best Practices Audit
### Summary
✅ N practices followed ⚠️ N need attention ❌ N not implemented ➖ N not applicable
---
### 1. Command Line Experience
| # | Practice | Status | Finding |
|---|----------|--------|---------|
| 1.1 | Respect POSIX args | ✅ | Uses yargs with proper short/long aliases |
| 1.2 | Build empathic CLIs | ❌ | No interactive fallback when required args absent |
...
[Repeat for each section with applicable practices]
---
### Priority recommendations
**High priority** (user-facing or CI-breaking):
- **§6.4 Exit codes** — `process.exit()` called without a code
```js
// Fix
process.exit(1); // on error
process.exit(0); // on success
```
**Medium priority**:
- ...
**Low priority / nice to have**:
- ...

Keep findings concise and tied to specific code patterns. Always include a concrete fix with code for each ❌.


Development guide mode

When building a new CLI feature or tool, don't wait to be asked — surface relevant best practices immediately based on what the user is building.

For a "building a CLI from scratch" request, organize guidance by development phase:

  1. Project setup (§7.1, §7.3, §4.4, §2.2): bin object, shebang, files field, shrinkwrap
  2. Argument design (§1.1, §1.2, §1.7, §1.9, §3.4): POSIX compliance, empathic fallbacks, zero-config, help output, config precedence
  3. I/O and interoperability (§3.1, §3.2, §3.5, §3.6, §3.7, §4.2): STDIN, structured output, gated interactivity, STDOUT/STDERR separation, shell completion, graceful degradation
  4. Error handling (§6.1–§6.5): trackable codes, actionable messages, debug mode, exit codes
  5. UX polish (§1.4, §1.5, §1.6): colors, rich interactions, hyperlinks
  6. Versioning (§9.1–§9.7): --version flag, semver, changelog
  7. Security (§10.1): argument injection

For a targeted feature request (e.g., "add error handling", "add a --json flag"), surface only the directly relevant practices.

Development guidance format
## Node.js CLI best practices for [feature/topic]
### Checklist
- [ ] §X.Y Practice name — one-line explanation of why it matters
### Implementation
[Concrete, copy-pasteable code]
### Recommended packages
- `package-name` — when and why to use it
npm install package-name
### Common mistakes
- What not to do → why it breaks → what to do instead

Quick reference: which section applies

TopicSections
Argument parsing / flags§1.1, §1.7, §1.9, §3.4
Help / usage output§1.9
Shell completion / autocomplete§3.7
Prompts / interactivity§1.2, §1.5, §3.5
Colors / styling§1.4, §4.2
STDIN / piping§3.1, §3.5, §3.6
STDOUT / STDERR§3.6
JSON / structured output§3.2, §3.6, §4.2
Cross-platform issues§3.3, §7.2
Error messages§3.6, §6.1, §6.2
Exit codes§6.4
Debug / verbose mode§3.6, §6.3
--version flag§9.1, §9.3
package.json setup§7.1, §7.3, §9.3
npm publishing / distribution§2.1, §2.2, §9.6
Security / user input§10.1
Configuration persistence§1.3, §2.3
Node.js version targeting§4.3
Analytics / telemetry§8.1

Examples

Example 1: Audit mode

User says: "Audit my Node.js CLI against best practices. Here's my entry file and package.json."

Actions:

  1. Read references/best-practices.md
  2. Examine the provided files against each applicable practice
  3. Produce the structured audit report with per-section table and priority recommendations

Example 2: Development guide mode (new CLI from scratch)

User says: "I'm building a Node.js CLI that parses log files and outputs a summary table. It needs to work cross-platform and I want to publish it on npm."

Actions:

  1. Read references/best-practices.md
  2. Identify all practices relevant to this CLI type (cross-platform, npm-published, table output)
  3. Organize guidance by development phase (project setup → argument design → I/O → errors → UX → versioning → security)

Example 3: Development guide mode (targeted feature)

User says: "My CLI is crashing and just dumping stack traces. How do I add proper error handling?"

Actions:

  1. Read references/best-practices.md sections §6.1–§6.5
  2. Surface only the directly relevant practices
  3. Provide a concrete, copy-pasteable error handling wrapper

Common mistakes to avoid

MistakeWhy it mattersCorrect approach
Marking §4.1 (Docker) as ❌ for a small personal CLIDocker is rarely needed; not applicable is honestUse ➖ when the practice genuinely doesn't fit the project's scope
Only auditing the entry file, ignoring package.jsonSeveral high-impact violations (§7.1, §7.3, §2.1, §4.3) live in package.jsonAlways audit both the entry file and package.json when both are provided
Recommending package-lock.json for §2.2The practice specifically calls for npm-shrinkwrap.json for published CLIsReference references/best-practices.md for the exact requirement
Skipping the priority grouping in audit reportsUsers need to know what to fix first, not just what's wrongAlways include High / Medium / Low priority sections with concrete fixes
Providing a development guide without code examplesProse guidance alone is not actionableEvery recommended practice should include at least one copy-pasteable code block

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
3,958
Repository forks
158
7-day trend score
41

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 25 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/lirantal/nodejs-cli-apps-best-practices/nodejs-cli-best-practices/badge)](https://verified-skill.com/skills/lirantal/nodejs-cli-apps-best-practices/nodejs-cli-best-practices)

Something wrong with this skill or its page? Tell us.