Enterprise CLI patterns using oclif framework with TypeScript. Use when building oclif CLIs, creating plugins, implementing commands with flags/args, adding auto-documentation, testing CLI commands, or when user mentions oclif, enterprise CLI, TypeScript CLI, plugin system, or CLI testing.
/plugin marketplace add vanman2024/cli-builder/plugin install cli-builder@cli-builderThis skill is limited to using the following tools:
examples/basic-cli-example.mdexamples/enterprise-cli-example.mdexamples/plugin-cli-example.mdexamples/quick-reference.mdscripts/create-command.shscripts/create-plugin.shscripts/generate-docs.shscripts/validate-command.shscripts/validate-plugin.shscripts/validate-tests.shtemplates/base-command.tstemplates/command-advanced.tstemplates/command-async.tstemplates/command-basic.tstemplates/command-with-config.tstemplates/package.jsontemplates/plugin-command.tstemplates/plugin-hooks.tstemplates/plugin-manifest.jsontemplates/plugin-package.jsonProvides comprehensive patterns for building production-grade CLIs with oclif framework.
Use templates:
templates/command-basic.ts - Simple command with flagstemplates/command-advanced.ts - Complex command with validationtemplates/command-async.ts - Async operationstemplates/base-command.ts - Custom base classKey patterns:
Flags objectArgs objectCommon flags:
Flags.string({ description, required, default })Flags.boolean({ description, allowNo })Flags.integer({ description, min, max })Flags.custom<T>({ parse: async (input) => T })Flags.string({ multiple: true })Best practices:
Definition:
static args = {
name: Args.string({ description: 'Name', required: true }),
file: Args.file({ description: 'File path', exists: true })
}
Access in run():
const { args } = await this.parse(MyCommand)
Use templates:
templates/plugin-package.json - Plugin package.jsontemplates/plugin-command.ts - Plugin command structuretemplates/plugin-hooks.ts - Hook implementationsPlugin structure:
my-plugin/
├── package.json (oclif configuration)
├── src/
│ ├── commands/ (plugin commands)
│ └── hooks/ (lifecycle hooks)
├── test/ (plugin tests)
└── README.md
Use templates:
templates/test-command.ts - Command test templatetemplates/test-helpers.ts - Test utilitiestemplates/test-setup.ts - Test configurationTesting approach:
Generated automatically:
--help flagUse scripts:
scripts/generate-docs.sh - Generate all documentationscripts/update-readme.sh - Update README with commands# Use template
./scripts/create-command.sh my-command basic
# Results in: src/commands/my-command.ts
# Use template
./scripts/create-plugin.sh my-plugin
# Results in: plugin directory structure
# Use test helpers
npm test
# or with coverage
npm run test:coverage
Available validators:
scripts/validate-command.sh - Check command structurescripts/validate-plugin.sh - Verify plugin structurescripts/validate-tests.sh - Ensure test coveragecommand-basic.ts - Simple command patterncommand-advanced.ts - Full-featured commandcommand-async.ts - Async/await patternsbase-command.ts - Custom base classcommand-with-config.ts - Configuration managementplugin-package.json - Plugin package.jsonplugin-command.ts - Plugin commandplugin-hooks.ts - Hook implementationsplugin-manifest.json - Plugin manifesttest-command.ts - Command unit testtest-helpers.ts - Test utilitiestest-setup.ts - Test configurationtest-integration.ts - Integration testtsconfig.json - TypeScript configpackage.json - oclif package.json.eslintrc.json - ESLint configSee examples/ for complete working examples:
examples/basic-cli/ - Simple CLI with commandsexamples/plugin-cli/ - CLI with plugin supportexamples/enterprise-cli/ - Full enterprise setupif (!valid) {
this.error('Invalid input', { exit: 1 })
}
const spinner = ux.action.start('Processing')
// ... work
ux.action.stop()
const answer = await ux.prompt('Continue?')
ux.table(data, { columns: [...] })
Create reusable custom flag parsers for complex validation.
Implement hooks for: init, prerun, postrun, command_not_found.
Organize commands into topics (e.g., mycli topic:command).
Use @oclif/plugin-update for automatic CLI updates.
Integrate analytics to track command usage.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.