lirantal/nodejs-cli-apps-best-practices/nodejs-cli-best-practices
- community
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-practicesSKILL.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
| Trigger | Mode | Action | |
|---|---|---|---|
| User provides existing CLI code or files to review | Audit | Produce a structured audit report | |
| User asks how to build or implement something | Development guide | Surface relevant practices with examples | |
| User says "review and help me improve" | Both | Audit 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
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:
- Project setup (§7.1, §7.3, §4.4, §2.2): bin object, shebang, files field, shrinkwrap
- Argument design (§1.1, §1.2, §1.7, §1.9, §3.4): POSIX compliance, empathic fallbacks, zero-config, help output, config precedence
- 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
- Error handling (§6.1–§6.5): trackable codes, actionable messages, debug mode, exit codes
- UX polish (§1.4, §1.5, §1.6): colors, rich interactions, hyperlinks
- Versioning (§9.1–§9.7):
--versionflag, semver, changelog - 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
Quick reference: which section applies
| Topic | Sections | |
|---|---|---|
| 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:
- Read
references/best-practices.md - Examine the provided files against each applicable practice
- 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:
- Read
references/best-practices.md - Identify all practices relevant to this CLI type (cross-platform, npm-published, table output)
- 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:
- Read
references/best-practices.mdsections §6.1–§6.5 - Surface only the directly relevant practices
- Provide a concrete, copy-pasteable error handling wrapper
Common mistakes to avoid
| Mistake | Why it matters | Correct approach | |
|---|---|---|---|
| Marking §4.1 (Docker) as ❌ for a small personal CLI | Docker is rarely needed; not applicable is honest | Use ➖ when the practice genuinely doesn't fit the project's scope | |
| Only auditing the entry file, ignoring package.json | Several high-impact violations (§7.1, §7.3, §2.1, §4.3) live in package.json | Always audit both the entry file and package.json when both are provided | |
Recommending package-lock.json for §2.2 | The practice specifically calls for npm-shrinkwrap.json for published CLIs | Reference references/best-practices.md for the exact requirement | |
| Skipping the priority grouping in audit reports | Users need to know what to fix first, not just what's wrong | Always include High / Medium / Low priority sections with concrete fixes | |
| Providing a development guide without code examples | Prose guidance alone is not actionable | Every 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
- SKILL.md in the repositoryCheckingskills/nodejs-cli-best-practices/SKILL.md
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
[](https://verified-skill.com/skills/lirantal/nodejs-cli-apps-best-practices/nodejs-cli-best-practices)