yargs-scaffolder
Generate Yargs-based CLI applications with commands, positional args, middleware, and TypeScript support. Creates a complete scaffolded CLI application with modern patterns.
Best use case
yargs-scaffolder is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Generate Yargs-based CLI applications with commands, positional args, middleware, and TypeScript support. Creates a complete scaffolded CLI application with modern patterns.
Teams using yargs-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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/yargs-scaffolder/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How yargs-scaffolder Compares
| Feature / Agent | yargs-scaffolder | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Generate Yargs-based CLI applications with commands, positional args, middleware, and TypeScript support. Creates a complete scaffolded CLI application with modern patterns.
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
# Yargs Scaffolder
Generate a complete Yargs CLI application with TypeScript, middleware support, and best practices.
## Capabilities
- Generate TypeScript-based Yargs CLI projects
- Create command modules with positional arguments
- Set up middleware for common operations (logging, config loading)
- Configure type coercion and validation
- Implement strict mode and fail handlers
- Set up build and development workflows
## Usage
Invoke this skill when you need to:
- Bootstrap a new CLI application using Yargs
- Create a CLI with command modules pattern
- Set up middleware-based processing
- Configure complex argument parsing
## 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) |
| strictMode | boolean | No | Enable strict mode (default: true) |
### Command Structure
```json
{
"commands": [
{
"name": "serve",
"description": "Start the server",
"aliases": ["s"],
"positional": [
{ "name": "port", "type": "number", "default": 3000 }
],
"options": [
{ "name": "host", "type": "string", "default": "localhost" },
{ "name": "watch", "type": "boolean", "alias": "w" }
]
}
]
}
```
## Output Structure
```
<projectName>/
├── package.json
├── tsconfig.json
├── .gitignore
├── README.md
├── src/
│ ├── index.ts # Entry point
│ ├── cli.ts # Yargs setup
│ ├── commands/
│ │ ├── index.ts # Command exports
│ │ └── <command>.ts # Command modules
│ ├── middleware/
│ │ ├── logger.ts # Logging middleware
│ │ └── config.ts # Config loading middleware
│ ├── utils/
│ │ └── helpers.ts # Helper utilities
│ └── types/
│ └── index.ts # Type definitions
└── tests/
└── commands/
└── <command>.test.ts
```
## Generated Code Patterns
### Main CLI Entry (src/cli.ts)
```typescript
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import * as commands from './commands';
import { loggerMiddleware } from './middleware/logger';
export const cli = yargs(hideBin(process.argv))
.scriptName('<projectName>')
.usage('$0 <cmd> [args]')
.middleware([loggerMiddleware])
.command(commands.serveCommand)
.command(commands.buildCommand)
.demandCommand(1, 'You need at least one command')
.strict()
.fail((msg, err, yargs) => {
if (err) throw err;
console.error(msg);
console.error(yargs.help());
process.exit(1);
})
.help()
.alias('help', 'h')
.version()
.alias('version', 'v')
.wrap(Math.min(120, process.stdout.columns || 80));
```
### Command Module Template
```typescript
import { CommandModule, Argv } from 'yargs';
interface ServeArgs {
port: number;
host: string;
watch: boolean;
}
export const serveCommand: CommandModule<{}, ServeArgs> = {
command: 'serve [port]',
aliases: ['s'],
describe: 'Start the development server',
builder: (yargs: Argv) => {
return yargs
.positional('port', {
type: 'number',
default: 3000,
describe: 'Port to listen on'
})
.option('host', {
type: 'string',
default: 'localhost',
describe: 'Host to bind to'
})
.option('watch', {
alias: 'w',
type: 'boolean',
default: false,
describe: 'Enable watch mode'
});
},
handler: async (argv) => {
console.log(`Starting server on ${argv.host}:${argv.port}`);
}
};
```
## Dependencies
```json
{
"dependencies": {
"yargs": "^17.0.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"@types/yargs": "^17.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
4. **Generate tsconfig.json** - TypeScript configuration
5. **Create CLI entry point** - Yargs setup with middleware
6. **Generate command modules** - Individual command files
7. **Create middleware** - Logger, config middleware
8. **Set up tests** - Test structure for commands
9. **Initialize git** - Optional git initialization
## Best Practices Applied
- TypeScript strict mode enabled
- Command module pattern for scalability
- Middleware for cross-cutting concerns
- Strict mode with custom fail handler
- Proper type definitions for arguments
- Completion script support
## References
- Yargs Documentation: https://yargs.js.org/
- Yargs GitHub: https://github.com/yargs/yargs
- Command Modules: https://yargs.js.org/docs/#api-reference-commandmodule
## Target Processes
- cli-application-bootstrap
- argument-parser-setup
- cli-command-structure-designRelated Skills
textual-scaffolder
Generate Textual (Python) TUI application structure with widgets, screens, and CSS styling.
oclif-scaffolder
Generate oclif CLI framework projects with plugin support, topics, hooks, and TypeScript. Creates enterprise-grade CLI applications with extensibility.
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.
cobra-scaffolder
Generate Cobra/Viper-based Go CLI applications with persistent flags, subcommands, and configuration management. Creates production-ready Go CLI with modern patterns.
click-scaffolder
Generate Click-based Python CLI applications with decorators, groups, context, and modern Python patterns. Creates complete scaffolded CLI with proper project structure.
clap-scaffolder
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
Generate Bubble Tea (Go) TUI application structure with models, commands, and views using the Elm architecture.
bats-test-scaffolder
Generate BATS test structure and fixtures for shell script testing with setup/teardown, assertions, and mocking.
argparse-scaffolder
Generate argparse-based Python CLI applications with subparsers, type converters, and standard library patterns. Creates lightweight Python CLIs without external dependencies.
process-builder
Scaffold new babysitter process definitions following SDK patterns, proper structure, and best practices. Guides the 3-phase workflow from research to implementation.
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
Run Babysitter autonomously with minimal manual interruption.