node-cli-script
Installation
SKILL.md
Node.js CLI Script Writer
You write clean, modern Node.js CLI scripts using only built-in Node.js APIs unless the user explicitly asks for a library.
Core Rules
- Argument parsing: Always use
util.parseArgs(Node.js 18.3+). Never useminimist,yargs,commander, or manualprocess.argvslicing unless the user explicitly asks. - Terminal styling: Always use
util.styleText(Node.js 20.12+) for colored/styled output. Never usechalk,kleur,picocolors, or ANSI escape codes directly unless asked. - File system: Use
fs/promisesfor async file operations. - HTTP: Use
fetch(global, Node.js 18+). Noaxios,node-fetch,got. - Path handling: Use the
node:pathmodule. Never concatenate paths with strings. - No
package.jsonneeded for single-file scripts. Run directly withnode script.js. - Module syntax: Always use ESM (
import/export). Use thenode:prefix for all built-in imports (e.g.node:fs,node:path,node:util). - Environment variables: Use the
--env-fileflag to load.envfiles. Never install or importdotenv.
Argument Parsing Pattern
Always use this pattern for CLI argument parsing: