Skip to content
Back to skills

Cli Development

BSecurity

CLI tool design, argument parsing, interactive prompts, shell completions, cross-platform considerations, and distribution strategies.

  • 157 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
developmentpythonrustgoshellbashnodedockertestinggit

Works with

  • terminal
  • cli

Security analysis

B84/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 5, 2026

npx -y skills add irahardianto/antigravity-setup --skill cli-development --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cli Development?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cli Development
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/irahardianto-cli-development/badge)](https://www.skillsdirectory.com/skills/irahardianto-cli-development)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cli-development
description: >-
  CLI tool design, argument parsing, interactive prompts, shell completions,
  cross-platform considerations, and distribution strategies.
---

# CLI Development Principles

Guidelines for building fast, intuitive, cross-platform CLI tools.

## When to Invoke
- Designing CLI tool architecture
- Implementing command hierarchies and argument parsing
- Adding shell completions and interactive features
- Cross-platform distribution planning

## Architecture

### Command Hierarchy
```
app <command> [subcommand] [flags] [args]
app task create --priority high "Deploy fix"
app task list --status active --format json
```

### Design Principles
1. **Startup time < 100ms** — lazy-load expensive dependencies.
2. **Sensible defaults** — zero-config for common cases.
3. **Progressive disclosure** — simple interface, advanced flags for power users.
4. **Machine-readable output** — `--format json` for scripting.
5. **Exit codes** — 0 = success, 1 = error, 2 = usage error.

## Argument Parsing Libraries

| Language | Library | Notes |
|---|---|---|
| Go | `cobra` + `pflag` | Most popular, auto-completions |
| Rust | `clap` (derive) | Type-safe, auto-help |
| Python | `click` or `typer` | Decorator-based, typer for type hints |
| Node.js | `commander` or `yargs` | Mature, well-documented |

## Error Handling

1. **Helpful error messages** — what went wrong, why, how to fix:
   ```
   Error: config file not found at ~/.myapp/config.yaml
   Hint: run 'myapp init' to create a default config
   ```

2. **`--verbose` / `--debug`** flags for diagnostic output.
3. **Never show stack traces by default** — only with `--debug`.

## Shell Completions

Generate completions for bash, zsh, fish, PowerShell. Most CLI frameworks support this.

```bash
# Generate completions
myapp completion bash > /etc/bash_completion.d/myapp
myapp completion zsh > ~/.zsh/completions/_myapp
```

## Cross-Platform

1. **Path handling** — use `filepath.Join` (Go), `Path` (Python), not string concat.
2. **Line endings** — handle `\r\n` on Windows.
3. **Color support** — detect terminal capabilities, respect `NO_COLOR` env var.
4. **Unicode** — test with non-ASCII filenames and input.

## Distribution

| Method | Best For |
|---|---|
| Go/Rust binary | Single binary, no runtime dependency |
| `pip install` / `npm install -g` | Language ecosystem users |
| Homebrew formula | macOS/Linux users |
| Docker image | Containerized environments |
| GitHub Releases | Universal, with checksums |

## Testing

> For universal testing principles, see `.agents/rules/testing-strategy.md`. Below: language-specific patterns only.

1. **Unit test command logic** — separate from CLI framework.
2. **Integration tests** — run actual CLI commands, assert exit codes and output.
3. **Golden file tests** — snapshot expected output for complex commands.

## Related
- Command Execution Principles @.agents/rules/command-execution-principles.md
- Error Handling Principles .agents/rules/error-handling-principles.md

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.