Develops command-line tools with Commander, Click, and cobra: argument parsing, subcommands, help text, and distribution.
Agentic Workflow: Read -> Reason -> Act (cli-tool-development)
You are cli-tool-development (devtools) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — devtools context for cli-tool-development
- Domain: Develops command-line tools with Commander, Click, and cobra: argument parsing, subcommands, help text, and distribution.
- cli-scaffolding: Scaffold CLI tools in Node, Python, and Go. —
npm install commander
- cli-verification: Test and verify CLI behavior. —
node bin/mycli.js --help
- Check
knowledge and prerequisites: node.js, python, click, commander
2. Reason — think for cli-tool-development
- For
cli-scaffolding: Scaffold CLI tools in Node, Python, and Go. — decide which checks to run
- For
cli-verification: Test and verify CLI behavior. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with cli-tool-development tools
- Tools:
Glob, Grep, Read, Bash, Cobra-cli (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
cli-tool-development:37fdb1e2
CLI Tool Development
Build polished command-line tools.
When to Use
- Internal developer tooling and automation
- Wrappers around APIs and services
- Scripts that need args, flags, and subcommands
- Tools distributed to other teams or users
Commands
# Node with Commander
npm init -y
npm install commander
node bin/mycli.js --help
# Python with Click
pip install click
python -m mycli --help
# Go with Cobra
go install github.com/spf13/cobra-cli@latest
cobra-cli init mycli
cobra-cli add serve
go run ./cmd/mycli --help
# Global install for dev
npm link
Python Click Example
import click
@click.command()
@click.option("--name", default="World", help="Who to greet")
@click.option("--verbose", is_flag=True)
def greet(name, verbose):
"""Greet someone."""
if verbose:
click.echo("verbose mode")
click.echo(f"Hello, {name}!")
if __name__ == "__main__":
greet()
Best Practices
- Always provide --help and --version
- Exit with non-zero codes and messages on stderr for errors
- Make flags idempotent and composable for piping
- Test with golden fixtures and snapshot tests
- Support CI environments (no TTY, no color when piped)
- Document each flag; the help text is the docs
Capabilities
cli-scaffolding
Scaffold CLI tools in Node, Python, and Go.
Parameters:
language (string): node, python, or go
name (string): CLI name
Commands:
npm install commander
npm init -y && npm pkg set bin="./bin/mycli.js"
python -m pip install click
go install github.com/spf13/cobra-cli@latest
cobra-cli init mycli
Examples:
- cobra-cli add serve
- npm install oclif
- pip install typer
cli-verification
Test and verify CLI behavior.
Parameters:
args (string): CLI arguments
stdin (string): Piped input to test stdin handling
Commands:
node bin/mycli.js --help
python -m mycli --version
go run ./cmd/mycli --help
npm link
echo "test input" | mycli parse
Examples:
- mycli --help | head -40
- mycli greet --name World
- mycli --version
References
1---2name: "cli-tool-development"3description: "Develops command-line tools with Commander, Click, and cobra: argument parsing, subcommands, help text, and distribution. Use when working with cli scaffolding, cli verification or when the user mentions cli scaffolding, cli verification."4license: "MIT"5compatibility: "Requires node.js, python, click, commander, ink."6metadata:7 source: https://skillmd.com/skills/opknock/cli-tool-development8 author: Kdesk9 version: 2.0.010 category: devtools11allowed-tools: "Glob Grep Read Bash(cobra-cli:*) Bash(echo:*) Bash(go:*) Bash(node:*) Bash(npm:*) Bash(python:*)"12---1314Develops command-line tools with Commander, Click, and cobra: argument parsing, subcommands, help text, and distribution.1516## Agentic Workflow: Read -> Reason -> Act (cli-tool-development)1718You are **cli-tool-development** (devtools) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — devtools context for `cli-tool-development`21- Domain: Develops command-line tools with Commander, Click, and cobra: argument parsing, subcommands, help text, and distribution.22- **cli-scaffolding**: Scaffold CLI tools in Node, Python, and Go. — `npm install commander`23- **cli-verification**: Test and verify CLI behavior. — `node bin/mycli.js --help`24- Check `knowledge` and `prerequisites: node.js, python, click, commander`2526### 2. Reason — think for `cli-tool-development`27- For `cli-scaffolding`: Scaffold CLI tools in Node, Python, and Go. — decide which checks to run28- For `cli-verification`: Test and verify CLI behavior. — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `cli-tool-development` tools32- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Cobra-cli` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `cli-tool-development:37fdb1e2`3536# CLI Tool Development3738Build polished command-line tools.3940## When to Use4142- Internal developer tooling and automation43- Wrappers around APIs and services44- Scripts that need args, flags, and subcommands45- Tools distributed to other teams or users4647## Commands4849```bash50# Node with Commander51npm init -y52npm install commander53node bin/mycli.js --help5455# Python with Click56pip install click57python -m mycli --help5859# Go with Cobra60go install github.com/spf13/cobra-cli@latest61cobra-cli init mycli62cobra-cli add serve63go run ./cmd/mycli --help6465# Global install for dev66npm link67```6869## Python Click Example7071```python72import click7374@click.command()75@click.option("--name", default="World", help="Who to greet")76@click.option("--verbose", is_flag=True)77def greet(name, verbose):78 """Greet someone."""79 if verbose:80 click.echo("verbose mode")81 click.echo(f"Hello, {name}!")8283if __name__ == "__main__":84 greet()85```8687## Best Practices8889- Always provide --help and --version90- Exit with non-zero codes and messages on stderr for errors91- Make flags idempotent and composable for piping92- Test with golden fixtures and snapshot tests93- Support CI environments (no TTY, no color when piped)94- Document each flag; the help text is the docs9596## Capabilities9798### cli-scaffolding99Scaffold CLI tools in Node, Python, and Go.100101**Parameters:**102- `language` (string): node, python, or go103- `name` (string): CLI name104105**Commands:**106- `npm install commander`107- `npm init -y && npm pkg set bin="./bin/mycli.js"`108- `python -m pip install click`109- `go install github.com/spf13/cobra-cli@latest`110- `cobra-cli init mycli`111112**Examples:**113- cobra-cli add serve114- npm install oclif115- pip install typer116117### cli-verification118Test and verify CLI behavior.119120**Parameters:**121- `args` (string): CLI arguments122- `stdin` (string): Piped input to test stdin handling123124**Commands:**125- `node bin/mycli.js --help`126- `python -m mycli --version`127- `go run ./cmd/mycli --help`128- `npm link`129- `echo "test input" | mycli parse`130131**Examples:**132- mycli --help | head -40133- mycli greet --name World134- mycli --version135136## References137- [Commander.js Docs](https://github.com/tj/commander.js)138- [Click Docs](https://click.palletsprojects.com)139- [Cobra Docs](https://cobra.dev)