Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate Commander.js CLI project structure with TypeScript, commands, options, and best practices. Creates a complete scaffolded CLI application ready for development.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 82% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -3% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 43% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 23% | 0% |
Generate a complete Commander.js CLI application with TypeScript, proper project structure, and best practices.
Invoke this skill when you need to:
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | projectName | string | Yes | Name of the CLI project (kebab-case) | | description | string | Yes | Short description of the CLI | | commands | array | No | List of commands to scaffold | | typescript | boolean | No | Use TypeScript (default: true) | | packageManager | string | No | npm, yarn, or pnpm (default: npm) |
json{ "commands": [ { "name": "init", "description": "Initialize a new project", "options": [ { "flags": "-t, --template <name>", "description": "Template to use" }, { "flags": "-f, --force", "description": "Overwrite existing files" } ], "arguments": [ { "name": "<directory>", "description": "Target directory" } ] } ] }
<projectName>/
├── package.json
├── tsconfig.json
├── .gitignore
├── README.md
├── src/
│ ├── index.ts # Entry point with shebang
│ ├── cli.ts # Main CLI setup
│ ├── commands/
│ │ ├── index.ts # Command exports
│ │ └── <command>.ts # Individual commands
│ ├── utils/
│ │ ├── logger.ts # Logging utilities
│ │ └── config.ts # Configuration helpers
│ └── types/
│ └── index.ts # Type definitions
├── bin/
│ └── <projectName> # Compiled binary entry
└── tests/
└── commands/
└── <command>.test.tstypescriptimport { Command } from 'commander'; import { version } from '../package.json'; const program = new Command(); program .name('<projectName>') .description('<description>') .version(version, '-v, --version', 'Display version number'); // Register commands program.addCommand(initCommand); program.addCommand(buildCommand); // Global options program .option('-d, --debug', 'Enable debug mode') .option('-q, --quiet', 'Suppress output'); // Error handling program.exitOverride(); try { program.parse(); } catch (err) { // Handle gracefully }
typescriptimport { Command } from 'commander'; export const <name>Command = new Command('<name>') .description('<description>') .argument('<required>', 'Required argument description') .argument('[optional]', 'Optional argument description') .option('-o, --option <value>', 'Option description', 'default') .action(async (required, optional, options) => { // Command implementation });
json{ "dependencies": { "commander": "^12.0.0" }, "devDependencies": { "@types/node": "^20.0.0", "typescript": "^5.0.0", "tsx": "^4.0.0", "vitest": "^1.0.0" } }
Other measured skills in the registry, with their headline benchmark lift.