Golang Spf13 Cobra (Grade A) logo

Golang Spf13 Cobra (Grade A)Security-tested development skill for Claude AI. Grade A. Golang CLI command tree library using spf13/cobra — cobra.Command, RunE vs Run, PersistentPreRunE hook chain, Args validators (NoArgs, ExactAr

(0)
Daniel NikulshynReviewed by Daniel Nikulshyn·Updated July 2026

Overview

Golang CLI command tree library using spf13/cobra. It provides a command/subcommand tree, flag parsing, args validation, shell completion generation, and documentation generation. This skill is designed for Go CLI engineers building command trees that feel native to the Unix shell. It covers cobra.Command, RunE vs Run, PersistentPreRunE hook chain, Args validators, persistent vs local flags, command groups, ValidArgsFunction, RegisterFlagCompletionFunc, ShellCompDirective, usage/help template customization, man-page and markdown doc generation, and testing with SetArgs/SetOut/SetErr.

Key features

  • cobra.Command
  • RunE vs Run
  • PersistentPreRunE hook chain
  • Args validators (NoArgs, ExactArgs, MatchAll, custom)
  • persistent vs local flags
  • command groups

Pricing

Model
Free
Category
Skills
Rating
No reviews yet

Use cases

Building a new CLI from scratch

Follow command tree setup, hook wiring, and flag sections sequentially to create a new CLI application

Extending an existing CLI

Read the current command tree first, then apply changes consistent with the existing structure to add subcommands, flags, or completions

Auditing an existing CLI

Check the Common Mistakes table, verify RunE usage, OutOrStdout(), hook chain ordering, and args validation to ensure best practices are followed

Pros & Cons

Pros

  • De facto standard for Go CLI applications
  • Provides command/subcommand tree, flag parsing, args validation, shell completion generation, and documentation generation
  • Can be used independently of configuration layering libraries like viper

Cons

  • Does not handle configuration layering
  • Not exhaustive, requires additional resources for more information

Reviews

Sign in to leave a review.

No reviews yet. Be the first!

Q&A

What is the license of Golang Spf13 Cobra?

The license of Golang Spf13 Cobra is MIT.

Asked by Vikram Rao · Apr 14, 2026

Is Cobra suitable for configuration layering?

No, Cobra does not handle configuration layering, which is instead handled by libraries like viper.

Asked by Hasan Demir · Apr 12, 2026

What are the key features of Cobra?

The key features of Cobra include cobra.Command, RunE vs Run, PersistentPreRunE hook chain, Args validators, persistent vs local flags, and command groups.

Asked by Fumiko Sato · Feb 20, 2026

What is Golang Spf13 Cobra?

Golang Spf13 Cobra is a Golang CLI command tree library using spf13/cobra, providing a command/subcommand tree, flag parsing, args validation, shell completion generation, and documentation generation.

Asked by Vincenzo Greco · Jan 17, 2026

Ask a question

Skills alternatives

Using Git Worktrees (Grade A) logo
Using Git Worktrees (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktre

(0)
Free
Ga4 Bigquery Schema (Grade A) logo
Ga4 Bigquery Schema (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. GA4 BigQuery Export Schema Reference — complete field reference, nested structures, query patterns, and performance tips

(0)
Free
Meta Capi (Grade A) logo
Meta Capi (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Meta Conversions API (CAPI) Setup Reference — architecture, event types, customer information hashing, deduplication, implementation examples, AEM

(0)
Free
Callees (Grade A) logo
Callees (Grade A)Skills

Security-tested development skill for Claude AI. Grade A. Lista o que uma funcao/metodo chama (call graph direto)

(0)
Free
Test Module Name (Grade A) logo
Test Module Name (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Name Haskell test modules after the module under test with a Spec suffix in the same namespace. Use when writing or reviewing Haskell test module

(0)
Free
Board Of Directors (Grade A) logo
Board Of Directors (Grade A)Skills

Security-tested data-ai skill for Claude AI. Grade A. Simulate a 5-member expert board deliberation for major decisions. Use when evaluating plans, architecture choices, feature designs, or any decisi

(0)
Free
Advpl Mvc Avancado (Grade A) logo
Advpl Mvc Avancado (Grade A)Skills

Security-tested development skill for Claude AI. Grade A. MVC avançado via PE (Pontos de Entrada) — adicionar grids customizadas em telas MVC padrão (CNTA300/MATA070/MATA440/MATA460/FINA040 via *STRU)

(0)
Free
D
Docs Writer (Grade A)Skills

Security-tested devops skill for Claude AI. Grade A. **WORKFLOW SKILL** — Maintains repository documentation accuracy and freshness across the docs site, agent files, and changelog. WHEN: "update docs

(0)
Free