Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add spf13/go-skills --skill cobra-vipergit clone --depth 1 https://github.com/spf13/go-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/spf13/go-skills/cobra-viper)<a href="https://agentmods.dev/skills/spf13/go-skills/cobra-viper"><img src="https://agentmods.dev/badge/skills/spf13/go-skills/cobra-viper/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/spf13/go-skills/cobra-viper"><img src="https://agentmods.dev/badge/skills/spf13/go-skills/cobra-viper.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00104 | $0.05252 |
| Opus 5.5 | $0.00042 | $0.02101 |
| Sonnet 5.5 | $0.00021 | $0.01050 |
| Haiku 4.5 | $0.00010 | $0.00525 |
Grade A, and why
cobra-viper scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
Copies of this mod
1 near-identical copy found in the catalogue:
- cobra-viper — 100% identical, 64 lines differ
How it starts
The opening of the file, as written. The whole thing — 507 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Go CLI Architecture: Cobra & Viper
Idiomatic patterns and best practices for building robust, configuration-driven command-line interfaces using Cobra and Viper.
When to Activate
- Writing a new CLI application in Go
- Adding commands, subcommands, or flags to an existing Cobra application
- Integrating Viper for configuration file, environment variable, or flag management
- Reviewing or refactoring CLI code that uses Cobra and/or Viper
- Designing the command structure or configuration schema for a CLI tool
- Testing CLI commands
Core Philosophy
The Command-First Architecture
Treat your application binary as a router for commands. The CLI framework (Cobra) should solely handle flags, arguments, and routing. Your core business logic should remain completely unaware of the CLI layer, making it highly testable and reusable.
Unified Configuration
Configuration should be environment-aware and unified. Viper acts as the single source of truth, merging defaults, config files, environment variables, and command-line flags into a cohesive state before passing it to the application logic.
Commands Are Built, Not Declared
Construct the command tree with factory functions (NewRootCmd()), not package-level var declarations. Globals make commands untestable (state leaks between test runs) and unusable as a library. The only global in a well-built CLI is main.go calling the factory.
CLI Package Organization
Anti-Pattern: Hiding all your commands and core logic deep inside an internal/ directory tree, or shoving everything into main.go.
Discoverable, Flat Structures
Command routing and business logic should live in standard, logically named packages. The cmd/ package handles the CLI surface area, while other top-level packages handle the domain logic.
mycli/
├── main.go # Minimal entry point: strictly calls cmd.Execute()
├── cmd/ # The Cobra routing layer
│ ├── root.go # Root command factory, global flags, Viper setup
│ ├── serve.go # The 'serve' subcommand
│ └── build.go # The 'build' subcommand
├── engine/ # Core business logic (name based on your domain)
│ ├── server.go
│ └── compiler.go
├── go.mod
└── go.sum
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday Changed · +15 lines ba8c2a42d6af
- 13d ago Changed · +45 lines 835fb38f07f5
- 2mo ago First seen · 447 lines · 104 tokens per session scan A e215454171a0
cobra-viper is a skill published in the GitHub repository spf13/go-skills (697 stars, last pushed yesterday), licensed MIT. It adds 104 tokens to every session and 5,252 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
cobra-viper compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| cobra-viperspf13/go-skills | Skill | 697 | yesterday | MIT | A | 104 | Claude Code |
| golang-testingsamber/cc-skills-golang | Skill | 3.8k | 5d ago | MIT | A | 115 | Claude Code |
| golang-uber-fxsamber/cc-skills-golang | Skill | 3.8k | 5d ago | MIT | A | 122 | Claude Code |
| golang-samber-oopssamber/cc-skills-golang | Skill | 3.8k | 5d ago | MIT | A | 74 | Claude Code |
| ax-go-agent-optimizeax-llm/ax | Skill | 3.0k | today | Apache-2.0 | A | 51 | Claude Code, Codex |
| golang-error-handlingsamber/cc-skills-golang | Skill | 3.8k | 5d ago | MIT | A | 144 | Claude Code |
| gmeasureonsi/gomega | Skill | 2.4k | 28d ago | MIT | A | 129 | Claude Code |