commander-js-scaffolder

Generate Commander.js CLI project structure with TypeScript, commands, options, and best practices. Creates a complete scaffolded CLI application ready for development.

509 stars

Best use case

commander-js-scaffolder is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generate Commander.js CLI project structure with TypeScript, commands, options, and best practices. Creates a complete scaffolded CLI application ready for development.

Teams using commander-js-scaffolder should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/commander-js-scaffolder/SKILL.md --create-dirs "https://raw.githubusercontent.com/a5c-ai/babysitter/main/library/specializations/cli-mcp-development/skills/commander-js-scaffolder/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/commander-js-scaffolder/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How commander-js-scaffolder Compares

Feature / Agentcommander-js-scaffolderStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generate Commander.js CLI project structure with TypeScript, commands, options, and best practices. Creates a complete scaffolded CLI application ready for development.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Commander.js Scaffolder

Generate a complete Commander.js CLI application with TypeScript, proper project structure, and best practices.

## Capabilities

- Generate TypeScript-based Commander.js CLI projects
- Create command structure with subcommands and options
- Set up proper argument parsing with type coercion
- Configure help text generation
- Implement version management
- Set up build and development workflows

## Usage

Invoke this skill when you need to:
- Bootstrap a new CLI application using Commander.js
- Create a TypeScript CLI with proper structure
- Set up command hierarchies with subcommands
- Configure CLI options and arguments

## Inputs

| 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) |

### Command Structure

```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" }
      ]
    }
  ]
}
```

## Output Structure

```
<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.ts
```

## Generated Code Patterns

### Main CLI Entry (src/cli.ts)

```typescript
import { 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
}
```

### Command Template (src/commands/<name>.ts)

```typescript
import { 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
  });
```

## Dependencies

```json
{
  "dependencies": {
    "commander": "^12.0.0"
  },
  "devDependencies": {
    "@types/node": "^20.0.0",
    "typescript": "^5.0.0",
    "tsx": "^4.0.0",
    "vitest": "^1.0.0"
  }
}
```

## Workflow

1. **Validate inputs** - Check project name, commands structure
2. **Create directory structure** - Set up folders and base files
3. **Generate package.json** - Configure project metadata and scripts
4. **Generate tsconfig.json** - TypeScript configuration
5. **Create CLI entry point** - Main program setup
6. **Generate commands** - Individual command files
7. **Create utilities** - Logger, config helpers
8. **Set up tests** - Test structure for commands
9. **Initialize git** - Optional git initialization

## Best Practices Applied

- TypeScript strict mode enabled
- Proper error handling with exitOverride
- Consistent command naming conventions
- Help text formatting standards
- Version flag configuration
- Debug/verbose mode support
- Graceful error messages

## References

- Commander.js Documentation: https://github.com/tj/commander.js
- Commander.js Examples: https://github.com/tj/commander.js/tree/master/examples
- Node.js CLI Best Practices: https://clig.dev/

## Target Processes

- cli-application-bootstrap
- cli-command-structure-design
- argument-parser-setup

Related Skills

yargs-scaffolder

509
from a5c-ai/babysitter

Generate Yargs-based CLI applications with commands, positional args, middleware, and TypeScript support. Creates a complete scaffolded CLI application with modern patterns.

textual-scaffolder

509
from a5c-ai/babysitter

Generate Textual (Python) TUI application structure with widgets, screens, and CSS styling.

oclif-scaffolder

509
from a5c-ai/babysitter

Generate oclif CLI framework projects with plugin support, topics, hooks, and TypeScript. Creates enterprise-grade CLI applications with extensibility.

cobra-scaffolder

509
from a5c-ai/babysitter

Generate Cobra/Viper-based Go CLI applications with persistent flags, subcommands, and configuration management. Creates production-ready Go CLI with modern patterns.

click-scaffolder

509
from a5c-ai/babysitter

Generate Click-based Python CLI applications with decorators, groups, context, and modern Python patterns. Creates complete scaffolded CLI with proper project structure.

clap-scaffolder

509
from a5c-ai/babysitter

Generate Clap-based Rust CLI applications with derive macros, subcommands, and modern Rust patterns. Creates production-ready Rust CLI with proper cargo structure.

bubble-tea-scaffolder

509
from a5c-ai/babysitter

Generate Bubble Tea (Go) TUI application structure with models, commands, and views using the Elm architecture.

bats-test-scaffolder

509
from a5c-ai/babysitter

Generate BATS test structure and fixtures for shell script testing with setup/teardown, assertions, and mocking.

argparse-scaffolder

509
from a5c-ai/babysitter

Generate argparse-based Python CLI applications with subparsers, type converters, and standard library patterns. Creates lightweight Python CLIs without external dependencies.

process-builder

509
from a5c-ai/babysitter

Scaffold new babysitter process definitions following SDK patterns, proper structure, and best practices. Guides the 3-phase workflow from research to implementation.

Workflow & Productivity

babysitter

509
from a5c-ai/babysitter

Orchestrate via @babysitter. Use this skill when asked to babysit a run, orchestrate a process or whenever it is called explicitly. (babysit, babysitter, orchestrate, orchestrate a run, workflow, etc.)

yolo

509
from a5c-ai/babysitter

Run Babysitter autonomously with minimal manual interruption.