Go cli
My personal pi harness configuration.
npx -y skills add nyquistwilder/personal-pi --skill go-cliAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Greenfield Go CLI workflow for command shape, flags, environment integration, stdin/stdout/stderr discipline, exit codes, shell-friendly UX, Cobra or stdlib flag choices, and CLI tests.
SKILL.md
2.2 KB, as published. Nobody here has run it
Go CLI
Rule
Build CLIs that are predictable for humans and scripts. Keep parsing and process exit at the edge; put core behavior in testable packages.
Hard Stops
Ask before:
- Adding Cobra, changing public flags/subcommands, changing output formats, or changing exit codes.
- Performing destructive filesystem/network/database actions.
- Reading secrets, writing shell completions into user directories, or modifying global config.
- Introducing interactive prompts for automation-oriented commands.
Defaults
- Use stdlib
flagfor simple single-command tools. - Use
spf13/cobraonly for public multi-command CLIs, nested help, completions, or long-term command growth. - Keep
maintiny: callrun(ctx, args, stdin, stdout, stderr) intor equivalent. - Write requested machine-readable output to stdout; diagnostics and progress to stderr.
- Use stable, documented exit codes:
0success,1generic failure,2usage error unless the project defines more. - Make environment variables explicit and documented.
Testing
Test command behavior without os.Exit in tests. Pass explicit args and buffers. Use real
subprocess tests only for installed binary behavior, signals, or shell integration. Assert
stdout, stderr, exit code, config/env precedence, and side effects.
Workflow
- Define command contract: name, args, flags, env vars, stdin/stdout/stderr, exit codes.
- Choose stdlib
flagor Cobra based on real complexity. - Keep business logic out of command parsing.
- Add tests for success, usage errors, failure paths, and output stability.
- Run targeted tests,
go test ./...,go vet, lint, andjust check.
Antipatterns
- Calling
os.Exitdeep in business logic. - Logging to stdout or printing requested data to stderr.
- Hidden env vars, machine-local config defaults, or prompts in scripts.
- Cobra for a one-flag internal tool.
Completion
Report command contract, dependency choice, flags/env vars, exit codes, tests, and validation results.