cli-patterns — community cli-patterns, battery, community, ide skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Developer Agents needing structured command-line interface interactions using Commander.js Safe hosting for the non-technical

ADLenehan ADLenehan
[0]
[0]
Updated: 3/5/2026

Agent Capability Analysis

The cli-patterns skill by ADLenehan is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Perfect for Developer Agents needing structured command-line interface interactions using Commander.js

Core Value

Empowers agents to define and execute customized CLI commands with arguments and options, utilizing Commander.js for robust command structure and parsing, and supporting features like environment targeting and dry-run simulations

Capabilities Granted for cli-patterns

Defining custom CLI commands with Commander.js
Parsing command arguments and options for automated workflows
Implementing dry-run simulations for safe deployment testing

! Prerequisites & Limits

  • Requires Commander.js library integration
  • Limited to TypeScript environment
  • Dependent on specific directory structure for command organization
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

cli-patterns

Install cli-patterns, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

CLI Patterns

Command Structure

Use Commander.js for all CLI commands. Commands live in packages/cli/src/commands/.

Basic Command

typescript
1import { Command } from 'commander' 2 3export const deployCommand = new Command('deploy') 4 .description('Deploy an application to Battery') 5 .argument('<path>', 'Path to the application directory') 6 .option('-e, --env <environment>', 'Target environment', 'production') 7 .option('--dry-run', 'Show what would be deployed without deploying') 8 .action(async (path, options) => { 9 // Implementation 10 })

Command with Subcommands

typescript
1export const configCommand = new Command('config') 2 .description('Manage Battery configuration') 3 4configCommand 5 .command('set <key> <value>') 6 .description('Set a configuration value') 7 .action(async (key, value) => {}) 8 9configCommand 10 .command('get <key>') 11 .description('Get a configuration value') 12 .action(async (key) => {})

Output Formatting

Chalk for Colors

typescript
1import chalk from 'chalk' 2 3// Status messages 4console.log(chalk.green('✓'), 'Deployment successful') 5console.log(chalk.yellow('!'), 'Warning: No auth detected') 6console.log(chalk.red('✗'), 'Error: Invalid credentials') 7 8// Emphasis 9console.log(chalk.bold('Scanning...')) 10console.log(chalk.dim('Press Ctrl+C to cancel')) 11 12// URLs and paths 13console.log(chalk.cyan('https://app.battery.dev')) 14console.log(chalk.gray('./src/config.ts'))

Ora for Spinners

typescript
1import ora from 'ora' 2 3const spinner = ora('Scanning for credentials...').start() 4 5try { 6 const results = await scan(path) 7 spinner.succeed('Scan complete') 8} catch (error) { 9 spinner.fail('Scan failed') 10 throw error 11}

Tree Output

typescript
1function printTree(items: string[], indent = 0): void { 2 const prefix = ' '.repeat(indent) 3 items.forEach((item, i) => { 4 const isLast = i === items.length - 1 5 const branch = isLast ? '└──' : '├──' 6 console.log(`${prefix}${branch} ${item}`) 7 }) 8} 9 10// Output: 11// ├── Detected: Next.js 12// ├── Found credentials: 13// │ ├── SNOWFLAKE_PASSWORD in .env 14// │ └── SALESFORCE_TOKEN in lib/api.ts 15// └── Deploying...

Error Handling

Exit Codes

typescript
1export const ExitCode = { 2 Success: 0, 3 GeneralError: 1, 4 InvalidArgument: 2, 5 ConfigError: 3, 6 NetworkError: 4, 7 AuthError: 5, 8} as const 9 10process.exit(ExitCode.InvalidArgument)

Error Display

typescript
1import chalk from 'chalk' 2 3function handleError(error: Error): never { 4 console.error() 5 console.error(chalk.red('Error:'), error.message) 6 7 if (error.cause) { 8 console.error(chalk.dim('Cause:'), String(error.cause)) 9 } 10 11 if (process.env.DEBUG) { 12 console.error(chalk.dim(error.stack)) 13 } 14 15 process.exit(ExitCode.GeneralError) 16}

Graceful Shutdown

typescript
1process.on('SIGINT', () => { 2 console.log() 3 console.log(chalk.dim('Cancelled')) 4 process.exit(130) 5})

Interactive Prompts

Use @inquirer/prompts for user input.

Confirmation

typescript
1import { confirm } from '@inquirer/prompts' 2 3const proceed = await confirm({ 4 message: 'Deploy to production?', 5 default: false, 6})

Selection

typescript
1import { select } from '@inquirer/prompts' 2 3const environment = await select({ 4 message: 'Select environment', 5 choices: [ 6 { name: 'Production', value: 'production' }, 7 { name: 'Staging', value: 'staging' }, 8 { name: 'Development', value: 'development' }, 9 ], 10})

Text Input

typescript
1import { input } from '@inquirer/prompts' 2 3const projectName = await input({ 4 message: 'Project name', 5 default: path.basename(process.cwd()), 6 validate: (value) => { 7 if (!/^[a-z0-9-]+$/.test(value)) { 8 return 'Must be lowercase alphanumeric with hyphens' 9 } 10 return true 11 }, 12})

Password Input

typescript
1import { password } from '@inquirer/prompts' 2 3const token = await password({ 4 message: 'Enter your API token', 5 mask: '*', 6})

Configuration Files

Config Location

typescript
1import { homedir } from 'os' 2import { join } from 'path' 3 4const CONFIG_DIR = join(homedir(), '.battery') 5const CONFIG_FILE = join(CONFIG_DIR, 'config.json') 6const CREDENTIALS_FILE = join(CONFIG_DIR, 'credentials.json')

Config Schema

typescript
1interface BatteryConfig { 2 defaultOrg?: string 3 defaultEnvironment?: 'production' | 'staging' 4 telemetry?: boolean 5}

Patterns to Follow

  1. Always show progress - Use spinners for operations > 500ms
  2. Confirm destructive actions - Prompt before deleting or overwriting
  3. Support --json flag - For programmatic output
  4. Respect NO_COLOR - Disable colors when env var is set
  5. Use stderr for errors - Keep stdout clean for piping

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is cli-patterns?

Perfect for Developer Agents needing structured command-line interface interactions using Commander.js Safe hosting for the non-technical

How do I install cli-patterns?

Run the command: npx killer-skills add ADLenehan/battery. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for cli-patterns?

Key use cases include: Defining custom CLI commands with Commander.js, Parsing command arguments and options for automated workflows, Implementing dry-run simulations for safe deployment testing.

Which IDEs are compatible with cli-patterns?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for cli-patterns?

Requires Commander.js library integration. Limited to TypeScript environment. Dependent on specific directory structure for command organization.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add ADLenehan/battery. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use cli-patterns immediately in the current project.

Related Skills

Looking for an alternative to cli-patterns or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI