skills/cli-builder/SKILL.md
Build production-quality CLIs with language detection and a five-step approval-gated workflow. Use when wrapping an existing module or app. Don't use for GUI/TUI apps, web APIs, or one-off shell scripts.
npx skillsauth add luongnv89/skills cli-builderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build production-quality CLI tools for any module or application, in any language.
Reference files (read on demand, not upfront):
references/cli-libraries.md — read during Step 2 (Design) to recommend libraries and during Step 4 (Execute) for starter scaffoldsreferences/testing-patterns.md — read during Step 4 (Execute) when writing testsBefore creating/updating/deleting files in an existing repository, sync the current branch with remote:
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"
If the working tree is not clean, stash first, sync, then restore:
git stash push -u -m "pre-sync"
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
git stash pop
If origin is missing, pull is unavailable, or rebase/stash conflicts occur, stop and ask the user before continuing.
Before changing any file, check the current branch. Only create a new branch if on main or master — otherwise continue on the existing branch (the user likely set it up already or is resuming work):
current_branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$current_branch" = "main" ] || [ "$current_branch" = "master" ]; then
slug="$(echo "${CLI_NAME:-cli}" | tr '[:upper:] ' '[:lower:]-' | tr -cd 'a-z0-9-')"
ts="$(date +%Y%m%d-%H%M%S)"
git checkout -b "feat/cli-${slug}-${ts}"
fi
Understand the project before proposing anything.
Auto-detect language by checking for manifest files:
package.json / tsconfig.json -> JavaScript/TypeScriptpyproject.toml / setup.py / setup.cfg / requirements.txt -> Pythongo.mod -> GoCargo.toml -> Rustpom.xml / build.gradle / build.gradle.kts -> Java/KotlinGemfile / *.gemspec -> RubyIdentify existing CLI/entry points: check for bin fields, __main__.py, main.go, fn main(), existing arg parsing code, or scripts in package.json.
Understand module structure: public API, core functions, data types, dependencies.
Ask clarifying questions (only what cannot be inferred):
Present findings and wait for approval before proceeding.
Present a structured CLI design document:
Iterate until user approves:
No implementation before design approval.
Break implementation into three phases, each with granular tasks.
Phase 1 — Foundation (get a working CLI skeleton):
Phase 2 — Complete (full feature set):
Phase 3 — Polish (optional, confirm with user):
Each task includes:
Iterate the plan with user until approved.
No execution before plan approval.
Implement the approved plan task by task:
If tests fail, fix before moving to the next task. If a design issue is discovered during implementation, pause and discuss with user.
Deliver a final summary:
After running this skill on a Python module called mylib, the final deliverable looks like:
feat/cli-mylib-20260419-143200 branch created
Files created:
cli/main.py — entry point with argparse/click/typer wiring
cli/commands/run.py — "mylib run" subcommand
cli/commands/info.py — "mylib info" subcommand
tests/test_cli.py — CLI smoke tests (help, version, run)
pyproject.toml — updated with [project.scripts] entry point
Usage quick-start:
pip install -e .
mylib --help
mylib run --input data.csv --output results.json
mylib info --format json
Step Completion Report (Steps 4-5):
◆ Execute + Summarize (step 4-5 of 5 — mylib CLI)
··································································
Implementation: √ pass (3 commands, 2 files)
Test coverage: √ pass (8/8 tests passing)
Phase demos completed: √ pass (help, version, run verified)
Summary delivered: √ pass
Criteria: √ 4/4 met
____________________________
Result: PASS
--help works at every command level and --version is implementedNO_COLOR env var or --no-color flag is respectedAfter completing each major step, output a status report in this format:
◆ [Step Name] ([step N of M] — [context])
··································································
[Check 1]: √ pass
[Check 2]: √ pass (note if relevant)
[Check 3]: × fail — [reason]
[Check 4]: √ pass
[Criteria]: √ N/M met
____________________________
Result: PASS | FAIL | PARTIAL
Adapt the check names to match what the step actually validates. Use √ for pass, × for fail, and — to add brief context. The "Criteria" line summarizes how many acceptance criteria were met. The "Result" line gives the overall verdict.
Phase: Analyze (Step 1) — checks: Project analysis, Language detected, Entry points identified, Clarifying questions asked
Phase: Design (Step 2) — checks: Design approval, Command tree defined, I/O behavior specified, Example invocations provided
Phase: Plan (Step 3) — checks: Plan approval, Phases broken down, Tasks have goals and tests, Effort estimated
Phase: Execute + Summarize (Steps 4–5) — checks: Implementation, Test coverage, Phase demos completed, Summary delivered
| Situation | Action | |-----------|--------| | No clear module to wrap | Ask user what functionality the CLI should expose | | Multiple languages detected | Ask user which language to use, recommend the one with more CLI code | | Existing CLI found | Offer to extend/refactor rather than rebuild; audit existing CLI first | | Unknown framework requested | Research the framework, ask user for docs link if needed | | Tests fail after implementation | Fix before proceeding; never skip broken tests |
Every CLI built with this skill must include:
--help works at every level)--long-flag, -s short flag, -- to end optionsNO_COLOR env var or --no-color flag--version prints version and exitstools
Run Herdr loops for one open GitHub issue (resolve→review→fix) or an existing PR (review→lazy fixer) until CLEAN. Don't use for plain resolution without review, review-only/no-fix requests, backlog automation, or merging.
tools
Manage AI agent fleets in Herdr: split root + sub-agents into one tab as a tiled grid, message/wait/read via herdr CLI, steer any pane. Use for Herdr multi-agent fleets. Don't use for tmux, screen, or non-Herdr terminals.
development
Generate or update docs to match the code, citing each claim to path:line and asking on ambiguity; runbook docs also get a check-only validation script. Don't use for API-reference autogen (JSDoc/Sphinx), landing pages, or CLAUDE.md/AGENTS.md.
testing
Generate a diagram and route to the right engine — draw.io XML (precise, editable, C4, swimlanes) or Excalidraw JSON (hand-drawn, sketch, wireframes). One entry for flowcharts, architecture, ER, sequence, mind maps. Don't use for Mermaid or slides.