cli-wrapper
Wraps any external CLI so the AI harness can invoke it without context bloat. Captures --help output, documents every subcommand/flag in a compact digest…
by Andersonlimahw★ 19 GitHub stars
Install cli-wrapper in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
CLI Wrapper — Multi-Harness Ecosystem
Bridge between AI harness and external CLIs. Captures, documents, optimizes. Claude Code = single source of truth. Other CLIs = symlinks.
Ecosystem
claude (canonical) ← symlinks → codex, agy, opencode, gemini
All wrapper skills/agents live in Claude's space. Other harnesses access via symlink.
Setup one command: /cli-wrapper:cli-wrapper-setup
Why
Raw CLI help output floods context. A single docker --help = ~3KB. Wrapped digest = ~300 bytes. 10x savings per invocation. Multiply by every CLI the harness calls.
Quick Start
/cli-wrapper:cli-wrapper-setup — one-shot ecosystem setup (symlinks, configs, verify)
/cli-wrapper:cli-wrapper-setup --verify — audit existing setup
/cli-wrapper wrap <cli-name> — capture CLI help + build digest
/cli-wrapper invoke <cli-name> <args> — run command, return compact output
/cli-wrapper audit <cli-name> — show token savings for this CLI
/cli-wrapper audit all — ecosystem-wide savings report
/cli-wrapper list — list all wrapped CLIs
/cli-wrapper unwrap <cli-name> — remove wrapper, restore raw access
CLI-Specific Wrappers
Each major AI CLI has its own dedicated wrapper skill + agent:
/claude-cli invoke|explain|audit|wrap — Claude Code CLI
/gemini-cli invoke|explain|audit|wrap — Gemini CLI
/codex-cli invoke|explain|audit|wrap — Codex CLI (OpenAI)
/opencode-cli invoke|explain|audit|wrap — OpenCode CLI
/agy-cli invoke|explain|audit|wrap — Agy CLI (Antigravity)
These auto-delegate to the respective wrapper agent for complex operations.
Workflow
1. Wrap a CLI (discovery)
Claude will:
- Run
<cli> --help(and<cli> <subcommand> --helprecursively) - Parse flag types, defaults, required vs optional
- Build a compact digest — only what the harness needs to know
- Save digest to
.claude/cli-wrappers/<cli-name>.json - Report token savings: raw vs wrapped
2. Invoke via wrapper
Instead of raw CLI calls, the harness uses the wrapper interface:
/cli-wrapper invoke docker ps --filter status=running
The wrapper:
- Validates flags against the digest (catches typos early)
- Runs the command
- Post-processes output (dedup, truncate, format)
- Returns only essential output to context
- Logs token metrics
3. Audit savings
/cli-wrapper audit docker
Returns:
CLI WRAPPER AUDIT — docker
===========================
Wrapped: 2026-06-15
Commands: 27 subcommands indexed
Help size: 3.2KB raw → 0.3KB digest (90% savings)
Invocations: 12
Tokens saved: ~18,400
Avg savings: ~1,533 tokens/call
Digest Format
Each wrapped CLI produces a machine-readable digest:
{
"name": "docker",
"version": "27.3.1",
"wrapped_at": "2026-06-15T10:30:00Z",
"subcommands": {
"ps": {
"description": "List containers",
"flags": {
"--all": { "type": "bool", "description": "Show all containers" },
"--filter": { "type": "string", "description": "Filter output", "repeatable": true },
"--format": { "type": "string", "description": "Go template" },
"--quiet": { "type": "bool", "description": "Only IDs" }
}
},
"build": {
"description": "Build image from Dockerfile",
"flags": {
"--tag": { "type": "string", "description": "Name:tag", "repeatable": true },
"--file": { "type": "string", "description": "Dockerfile path" },
"--build-arg": { "type": "string", "description": "Build-time var", "repeatable": true },
"--no-cache": { "type": "bool", "description": "Don't use cache" },
"--platform": { "type": "string", "description": "Target platform" }
}
}
},
"global_flags": {
"--config": { "type": "string", "description": "Config file location" },
"--context": { "type": "string", "description": "Docker context" },
"--debug": { "type": "bool", "description": "Debug mode" },
"--host": { "type": "string", "description": "Daemon socket" },
"--log-level": { "type": "string", "description": "Log level", "choices": ["debug", "info", "warn", "error"] }
},
"stats": {
"help_raw_bytes": 3247,
"digest_bytes": 312,
"savings_pct": 90.4
}
}
Token Savings — How It Works
| Phase | Without Wrapper | With Wrapper |
|---|---|---|
| Discovery | Run cmd --help each session → 3KB tokens |
Load digest → 0.3KB tokens |
| Validation | Harness guesses flags → retries | Digest validates → first try |
| Output | Raw output → possibly 10KB+ | Post-processed → essential only |
| Documentation | Harness re-discovers each time | Digest persists across sessions |
Supported CLI Patterns
Works with any CLI that supports --help:
- Posix-style:
command --help,command subcommand --help - Subcommand trees:
git,docker,kubectl,aws,gcloud - **S
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- agents/agy-cli.md
- agents/claude-cli.md
- agents/codex-cli.md
- agents/gemini-cli.md
- agents/opencode-cli.md
- plugin.json
- skills/agy-cli/SKILL.md
- skills/claude-cli/SKILL.md
- skills/cli-wrapper-setup/SKILL.md
- skills/codex-cli/SKILL.md
- skills/gemini-cli/SKILL.md
- skills/opencode-cli/SKILL.md
- templates/symlink-map.json
FAQ
What does the cli-wrapper skill do?
Wraps any external CLI so the AI harness can invoke it without context bloat. Captures --help output, documents every subcommand/flag in a compact digest, saves token metrics (raw vs wrapped), and exposes a standardized interface (invoke, explain, audit). Use before calling an unfamiliar CLI or when the harness needs to interact with a CLI repeatedly.
How do I install the cli-wrapper skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the cli-wrapper skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
patterns
AnthropicFind patterns worth sharing from recent PRs and repo history, both repeats to fix and good practices worth spreading. Use when a champion wants to know what…
copilot-cli-quickstart
GitHubUse this skill when someone wants to learn GitHub Copilot CLI from scratch. Offers interactive step-by-step tutorials with separate Developer and…
vardoger-analyze
GitHubUse when the user asks to personalize the GitHub Copilot CLI assistant, adapt Copilot to their style, use vardoger, or analyze their Copilot CLI conversation…
policy-lookup
AnthropicFind and explain company policies in plain language. Trigger with "what's our PTO policy", "can I work remotely from another country", "how do expenses work"…