oclif-scaffolder

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

509 stars

Best use case

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

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

Teams using oclif-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/oclif-scaffolder/SKILL.md --create-dirs "https://raw.githubusercontent.com/a5c-ai/babysitter/main/library/specializations/cli-mcp-development/skills/oclif-scaffolder/SKILL.md"

Manual Installation

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

How oclif-scaffolder Compares

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

Frequently Asked Questions

What does this skill do?

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

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

# oclif Scaffolder

Generate a complete oclif CLI application with plugin architecture, topics, and enterprise patterns.

## Capabilities

- Generate TypeScript-based oclif CLI projects
- Create command topics with hierarchical organization
- Set up plugin system for extensibility
- Configure hooks for lifecycle events
- Implement flag inheritance and parsing
- Set up testing and development workflows

## Usage

Invoke this skill when you need to:
- Bootstrap an enterprise-grade CLI with oclif
- Create extensible CLIs with plugin support
- Build CLIs with complex command hierarchies
- Implement lifecycle hooks and middleware

## 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 |
| plugins | boolean | No | Enable plugin support (default: true) |
| topics | array | No | Command topics/namespaces |

### Command Structure

```json
{
  "commands": [
    {
      "name": "deploy",
      "description": "Deploy application",
      "topic": "app",
      "flags": [
        { "name": "env", "char": "e", "required": true },
        { "name": "force", "char": "f", "allowNo": true }
      ],
      "args": [
        { "name": "service", "required": true }
      ]
    }
  ],
  "topics": [
    { "name": "app", "description": "Application commands" },
    { "name": "config", "description": "Configuration management" }
  ]
}
```

## Output Structure

```
<projectName>/
├── package.json
├── tsconfig.json
├── .gitignore
├── README.md
├── bin/
│   ├── dev.js               # Development entry
│   └── run.js               # Production entry
├── src/
│   ├── index.ts             # Plugin exports
│   ├── commands/
│   │   ├── app/
│   │   │   ├── deploy.ts    # app:deploy command
│   │   │   └── status.ts    # app:status command
│   │   └── config/
│   │       ├── get.ts       # config:get command
│   │       └── set.ts       # config:set command
│   ├── hooks/
│   │   ├── init.ts          # Init hook
│   │   └── prerun.ts        # Pre-run hook
│   └── lib/
│       ├── base-command.ts  # Base command class
│       └── config.ts        # Configuration
└── test/
    └── commands/
        └── app/
            └── deploy.test.ts
```

## Generated Code Patterns

### Base Command (src/lib/base-command.ts)

```typescript
import { Command, Flags } from '@oclif/core';
import { Config } from './config';

export abstract class BaseCommand extends Command {
  static baseFlags = {
    verbose: Flags.boolean({
      char: 'v',
      description: 'Enable verbose output',
    }),
    config: Flags.string({
      char: 'c',
      description: 'Path to config file',
    }),
  };

  protected config!: Config;

  async init(): Promise<void> {
    const { flags } = await this.parse(this.constructor as typeof BaseCommand);
    this.config = new Config(flags.config);
  }

  protected log(message: string): void {
    this.logToStderr(message);
  }
}
```

### Command Template (src/commands/app/deploy.ts)

```typescript
import { Args, Flags } from '@oclif/core';
import { BaseCommand } from '../../lib/base-command';

export default class Deploy extends BaseCommand {
  static description = 'Deploy application to environment';

  static examples = [
    '<%= config.bin %> <%= command.id %> my-service -e production',
    '<%= config.bin %> <%= command.id %> my-service --force',
  ];

  static flags = {
    ...BaseCommand.baseFlags,
    env: Flags.string({
      char: 'e',
      description: 'Target environment',
      required: true,
      options: ['development', 'staging', 'production'],
    }),
    force: Flags.boolean({
      char: 'f',
      description: 'Force deployment without confirmation',
      allowNo: true,
    }),
  };

  static args = {
    service: Args.string({
      description: 'Service to deploy',
      required: true,
    }),
  };

  async run(): Promise<void> {
    const { args, flags } = await this.parse(Deploy);

    this.log(`Deploying ${args.service} to ${flags.env}`);

    if (flags.force) {
      this.log('Force mode enabled');
    }

    // Deployment logic
    this.log('Deployment complete!');
  }
}
```

### Hook Template (src/hooks/init.ts)

```typescript
import { Hook } from '@oclif/core';

const hook: Hook<'init'> = async function (options) {
  // Initialization logic
  process.stdout.write(`Initializing ${options.config.name}...\n`);
};

export default hook;
```

## Dependencies

```json
{
  "dependencies": {
    "@oclif/core": "^3.0.0",
    "@oclif/plugin-help": "^6.0.0",
    "@oclif/plugin-plugins": "^4.0.0"
  },
  "devDependencies": {
    "@oclif/test": "^3.0.0",
    "@types/node": "^20.0.0",
    "typescript": "^5.0.0",
    "ts-node": "^10.0.0",
    "mocha": "^10.0.0",
    "chai": "^4.0.0"
  }
}
```

## Workflow

1. **Validate inputs** - Check project name, topics structure
2. **Create directory structure** - Set up oclif project layout
3. **Generate package.json** - Configure oclif metadata
4. **Create base command** - Shared flag inheritance
5. **Generate commands** - Topic-organized commands
6. **Create hooks** - Lifecycle hooks
7. **Set up plugins** - Plugin manifest if enabled
8. **Create tests** - Command tests with @oclif/test

## Best Practices Applied

- Topic-based command organization
- Base command for shared functionality
- Hook system for lifecycle events
- Plugin architecture for extensibility
- Auto-generated help and documentation
- Mocha/Chai testing setup

## References

- oclif Documentation: https://oclif.io/
- oclif GitHub: https://github.com/oclif/oclif
- oclif Core: https://github.com/oclif/core

## Target Processes

- cli-application-bootstrap
- plugin-architecture-implementation
- cli-command-structure-design

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.

commander-js-scaffolder

509
from a5c-ai/babysitter

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

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.