Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build, refactor, test, and review Cobra-based Go applications with intentional command trees, fresh constructors, suggestions, typed boundaries, scoped flags, local or remote configuration, explicit precedence, safe live reload, context propagation, stable streams, shell completion, and generated documentation. Use for Cobra or Viper CLI architecture and implementation.
.claude/skills/hashgraph-online-go-cobra-applications/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 35% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 32% | 0% |
| case-03 | ✓→✓ | = Same ✓ | -6% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 23% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 47% | 0% |
Keep Cobra and Viper at the application edge. Construct a fresh command tree per execution and translate CLI state into typed application calls.
| Task | Load | |---|---| | Build or restructure a Cobra application | guidelines.md, workflows/build-cobra-command-tree.md | | Apply command-tree, flag, config, and testing rules | references/cobra-applications/rules.md | | Use constructors and focused implementation examples | references/cobra-applications/examples.md | | Inject services or resolve configuration | references/cobra-applications/patterns.md | | Review a Cobra/Viper application | references/cobra-applications/checklist.md | | Understand architecture, completion, and docs | references/cobra-applications/knowledge.md |
init-driven application wiring.Guidance is transformed and paraphrased from Ricardo Gerardi, Powerful Command-Line Applications in Go (Pragmatic Bookshelf, 2021), especially Chapter 7. Examples are original adaptations.
Book: https://pragprog.com/titles/rggo/powerful-command-line-applications-in-go/
The book's 2021 generator flow is historical. Verify current APIs and tooling against https://cobra.dev/ and https://github.com/spf13/viper before use.
Suggestion, remote configuration, and live-reload guidance also incorporates transformed material from Marian Montagnino, Building Modern CLI Applications in Go (Packt, 2023), especially Chapter 4.
Parser-boundary guidance also incorporates transformed material from Inanc Gumus, Go by Example: Programmer's Guide to Idiomatic and Testable Programs (Manning, 2025), Chapter 4.
Other measured skills in the registry, with their headline benchmark lift.