cli-building

Build command-line interfaces with async-first design, composable commands, and proper output formatting. Use when creating CLI tools, commands, or interactive terminal applications.

8 stars

Best use case

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

Build command-line interfaces with async-first design, composable commands, and proper output formatting. Use when creating CLI tools, commands, or interactive terminal applications.

Teams using cli-building 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/cli-building/SKILL.md --create-dirs "https://raw.githubusercontent.com/siviter-xyz/dot-agent/main/skills/cli-building/SKILL.md"

Manual Installation

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

How cli-building Compares

Feature / Agentcli-buildingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build command-line interfaces with async-first design, composable commands, and proper output formatting. Use when creating CLI tools, commands, or interactive terminal applications.

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

# CLI Building

Guidelines for building command-line interfaces with modern patterns and best practices.

## When to Use

- Creating new CLI tools or commands
- Building interactive terminal applications
- Adding commands to existing projects
- Implementing command-line interfaces
- Working with CLI frameworks

## Core Principles

- **Async-first**: All I/O operations should be async/await, avoid blocking operations
- **Composable commands**: Commands should be modular and reusable, use command composition
- **Strategy pattern**: Use strategy pattern for branching workflows or task-based commands
- **Output formatting**: Proper formatting with unicode symbols and color support

## Framework Selection

### TypeScript/JavaScript

**stricli** (`@bloomberg/stricli`, recommended for modern async-first CLIs):
- Built for async/await from ground up
- Type-safe command definitions with full type inference
- Lazy loading for startup performance
- Zero dependencies

**oclif** (alternative):
- Mature framework with extensive features
- Plugin system
- Good for complex CLIs

### Python

**cyclopts** (recommended for async-first):
- Modern async-first CLI framework
- Type-safe with excellent async support
- Clean API design

**typer** (when fully async support available):
- Based on Python type hints
- Clean and intuitive
- Good for simple to medium complexity CLIs

## Command Architecture

### Composable Commands

Design commands as reusable modules:
- Shared command utilities
- Command middleware
- Reusable command modules
- Command composition patterns

### Strategy Pattern

Use strategy pattern for:
- Workflow branching
- Task-based commands
- Dynamic command routing
- Conditional command execution

## Output Formatting

- **No emojis**: Do not use emojis unless explicitly directed
- **Unicode symbols**: Use unicode symbols (✓, ✗, →, ⚠) for status indicators
- **Color support**: Use color libraries, never hardcoded ANSI codes
- **NO_COLOR**: Always respect `NO_COLOR` environment variable
- **Formatting**: Use formatting for better readability (bold, dim, etc.)

## Async Patterns

### Async-First Design

All I/O should be async:
- File operations: use async file APIs
- Network requests: use async HTTP clients
- Process execution: use async process APIs
- Database operations: use async database clients

### Error Handling

Handle async errors properly:
- Use try/catch with await
- Handle promise rejections
- Provide clear error messages
- Exit with appropriate codes

## Command Structure

### Basic Command

```typescript
// stricli example
import { createCli } from '@bloomberg/stricli';

async function myCommand() {
  // Async implementation
}

const cli = createCli({
  name: 'my-cli',
  commands: {
    'my-command': myCommand
  }
});

cli.run();
```

```python
# cyclopts example
from cyclopts import App

app = App()

@app.default
async def my_command():
    # Async implementation
    pass

if __name__ == '__main__':
    app()
```

## Best Practices

1. **Async by default**: All operations should be async
2. **Composable design**: Build reusable command modules
3. **Strategy pattern**: Use for workflow branching
4. **Proper formatting**: Unicode symbols and color with NO_COLOR support
5. **Error handling**: Clear error messages and exit codes
6. **Type safety**: Use TypeScript types or Python type hints
7. **Testing**: Test commands in isolation

## References

For detailed guidance, see:
- `references/async-patterns.md` - Async/await best practices
- `references/composable-commands.md` - Command composition patterns
- `references/strategy-pattern.md` - Strategy pattern for workflows
- `references/output-formatting.md` - Output formatting guidelines
- `references/frameworks.md` - Framework comparisons and selection

Related Skills

typescript

8
from siviter-xyz/dot-agent

TypeScript standards and best practices with modern tooling. Use when working with TypeScript or TypeScript React files.

software-engineer

8
from siviter-xyz/dot-agent

Core software engineering principles for code style, documentation, and development workflow. Applies when editing code, working in software repositories, or performing software development tasks.

semantic-git

8
from siviter-xyz/dot-agent

Manage Git commits using conventional commit format with atomic staging. Always generate plain git commands before running them and offer to let the user run them manually.

python

8
from siviter-xyz/dot-agent

Python development guidelines and best practices. Use when working with Python code.

psi

8
from siviter-xyz/dot-agent

Plan-spec-implement workflow for structured development. Only use when explicitly directed by user or when mentioned in project AGENTS.md file. Generates ephemeral plans in ~/.dot-agent/, applies specs to project docs, then implements test-first.

media-processing

8
from siviter-xyz/dot-agent

Media processing utilities for images, audio, and video using FFmpeg and ImageMagick. Use when working with media conversion, optimization, or batch processing tasks.

frontend-engineer

8
from siviter-xyz/dot-agent

Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.

create-skill

8
from siviter-xyz/dot-agent

Guide for creating effective skills following best practices. Use when creating or updating skills that extend agent capabilities.

create-agents-md

8
from siviter-xyz/dot-agent

Create AGENTS.md files for project-specific inline rules. Use when adding small, project-specific instructions that should be committed in repos.

context-engineering

8
from siviter-xyz/dot-agent

Master context engineering for AI agent systems. Use when designing agent architectures, debugging context failures, optimizing token usage, implementing memory systems, building multi-agent coordination, evaluating agent performance, or developing LLM-powered pipelines. Covers context fundamentals, degradation patterns, optimization techniques, compression strategies, memory architectures, multi-agent patterns, evaluation, tool design, and project development.

code-review

8
from siviter-xyz/dot-agent

Code review practices emphasizing technical rigor, evidence-based claims, and verification. Use when receiving code review feedback, completing tasks requiring review, or before making completion claims.

backend-engineer

8
from siviter-xyz/dot-agent

Build robust backend systems with modern technologies (Node.js, Python, Go, Rust), frameworks (NestJS, FastAPI, Django), databases (PostgreSQL, MongoDB, Redis), APIs (REST, GraphQL, gRPC), authentication (OAuth 2.1, JWT), testing strategies, security best practices (OWASP Top 10), performance optimization, scalability patterns (microservices, caching, sharding), DevOps practices (Docker, Kubernetes, CI/CD), and monitoring. Use when designing APIs, implementing authentication, optimizing database queries, setting up CI/CD pipelines, handling security vulnerabilities, building microservices, or developing production-ready backend systems.