golang-cli

REVIEW · 67
Registry indexed

Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI uni

Verified installs0
Stars3.0K
Version1.0.0
Quality82/100 · Strong
Trust67/100 · Sandbox only
Audit82/100 · Needs review

Supply asset profile

Coding and developer agents

Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.

Browse track

Scenario

GitHub automation

I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.

Agent fit

Claude Code + OpenAI Agents + CLI

Codex, Claude Code, Cursor, CLI, or custom agents.

Install

Ready

npx skills add samber/cc-skills-golang --skill golang-cli

Maintenance

fresh

2d since push

Risk

Needs review

Dependency or permission surface needs review

GitHub quality

3.0K

82/100 Quality · 75/100 Trust

Coverage tags

CodingGitHub automationresearchagent-skill

Review notes

Dependency or permission surface needs review · Permission surface may require sandboxing

Agent adoption scorecard

Trust, audit, and install readiness at a glance

These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.

Quality

Strong
82

Solid option that is likely worth shortlisting for production workflows.

Trust

Sandbox only
67

Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.

Audit

Needs review
82

A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.

OpenAgentSkill Trust Score v5

Human review before install

Run only in a sandbox and compare close alternatives before using it for real work.

CodexClaude CodeCursorOpenAgentSkill CLI

Stars

3.0K GitHub stars

Repo activity

3.0K stars, 197 forks

Maintenance

2d since push

License

MIT

Install

npx skills add samber/cc-skills-golang --skill golang-cli

Install safety

standard package or runtime install path

Permission surface

secrets or environment access, shell or command execution

Agent outcomes

No agent outcome data yet

Docs

Strong README/SKILL.md context

Risk summary

Review before production

  • Quality score needs review
  • Permission surface needs review: secrets or environment access, shell or command execution
  • Dependency/runtime risk: command execution surface, credential or environment access
  • Permission surface: secrets or environment access, shell or command execution

Install readiness

Install path available

  • Install path is available
  • Repository evidence is available
  • License is declared
  • No Agent Proven outcome evidence yet

Agent-readable metadata

Machine-readable decision data for this skill.

Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.

Open JSON

Suited tasks

  • GitHub automation workflows
  • Claude Code teams
  • teams that value GitHub adoption signals
  • Inspect repository metadata

Suited agents

CodexClaude CodeCursorOpenAgentSkill CLIOpenAI AgentsCLI

Install decision

Command
npx skills add samber/cc-skills-golang --skill golang-cli
Policy
review
Human review
yes

Trust and risk

Trust
67/100
Audit
82/100
Risk level
Needs review

Outcome loop

Endpoint
/api/agent/outcome
Event ID
resolve
Outcomes
5

Install command

npx skills add samber/cc-skills-golang --skill golang-cli

Do not use when

  • teams that need a vendor-supported SLA
  • high-compliance environments without internal security review
  • No major risk signals from current metadata
  • High-risk permission hints: Shell or command execution, Secrets or environment access
  • Dependency or permission surface needs review

Agent safety v2

38/100 · Avoid automatic install

Experimentalreview

Sparse or mixed signals. Useful for discovery, but not for autonomous installation.

Test manually in an isolated workspace and compare against safer alternatives.

Resolve via API

high

Shell or command execution

Skill metadata references terminal, CLI, shell, subprocess, or command execution workflows.

medium

Network access

Skill likely fetches remote pages, APIs, repositories, or external services.

medium

Filesystem access

Skill may read or write project files, documents, generated artifacts, or local workspace state.

high

Secrets or environment access

Skill metadata references credentials, tokens, environment variables, or secret-bearing workflows.

  • High-risk permission hints: Shell or command execution, Secrets or environment access
  • Dependency or permission surface needs review

Install targets

Install this skill in your agent workflow

Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.

skill install

OpenAgentSkill CLI

Resolve policy, run the source installer safely, and report a verified install receipt.

$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install samber-golang-cli

Agent resolve plan

Let an agent verify fit before installing.

The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.

Open text plan

Agent should check

  • Task fit and alternatives from Resolve API.
  • Audit score, trust score, and safety policy warnings.
  • Install target compatibility for Codex, Claude Code, Cursor, or CLI.

Copy prompt

Task: Use golang-cli in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20golang-cli%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/samber-golang-cli/install
Install command: npx skills add samber/cc-skills-golang --skill golang-cli
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.

Agent handoff

Give an agent the install path, not another directory page.

Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.

Open install API

Agent prompt

Use golang-cli for this task. Review https://www.openagentskill.com/api/skills/samber-golang-cli/install, then install with: npx skills add samber/cc-skills-golang --skill golang-cli

Registry metadata

Agent-readable profile for automatic skill selection.

This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.

Open manifest

Agent fit

95/100

GitHub automation

Platforms

Claude Code, OpenAI Agents

Audit report

Needs review · 82/100

A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.

View audit reportView eval report

Agent decision cockpit

Primary pick for GitHub automation

Use this as a leading candidate, then validate the README and install path in your own agent stack.

95
Readiness
Adopt
Stage

Role in stack

Primary pick

Primary fit

GitHub automation

Trust label

Production-ready

Install path

Command ready

Use when

  • GitHub automation workflows
  • Claude Code teams
  • teams that value GitHub adoption signals

Evidence

  • 3,010 GitHub stars
  • recent repository activity
  • install command or GitHub repo available
  • 82/100 quality profile
  • 6 OpenAgentSkill engagement events

review first

  • No major risk signals from current metadata

Implementation path

  1. 1Install it in a sandbox agent and run one GitHub automation task end to end.
  2. 2Compare output quality, latency, and failure behavior against at least one alternative.
  3. 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.

Trust profile

Sandbox only

Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.

67
OpenAgentSkill Trust Score

GitHub adoption

PASS

3.0K GitHub stars

Stars/forks activity

INFO

3.0K stars, 197 forks; issue activity unavailable in current metadata

Recent maintenance

PASS

2d since push

License clarity

PASS

MIT

Good signals

  • AI review approved
  • Install path is available
  • Repository evidence is available
  • Recently maintained repository
  • Meaningful GitHub adoption signal
  • Install command has no obvious high-risk pattern
  • Outcome loop is ready but needs first real agent run

Review before install

  • Quality score needs review
  • Permission surface needs review: secrets or environment access, shell or command execution
  • Dependency/runtime risk: command execution surface, credential or environment access
  • Permission surface: secrets or environment access, shell or command execution
  • No real agent outcome reports yet
  • Human review required before unattended installation

Recommended action

Run only in a sandbox and compare close alternatives before using it for real work.

Quality profile

Strong candidate for agent workflows

Solid option that is likely worth shortlisting for production workflows.

82
GitHub stars
3.0K
Freshness
2d ago
Install ready
Yes
License
MIT

Workflow fit

Use this skill in these scenarios

Workflow fit

Add it to a complete workflow

Alternative shortlist

Compare before you install

Similar skills that may fit this task.

Compare all

Overview

--- name: golang-cli description: "Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool — especially for command structure, flag handling, configuration layering, version embedding, exit codes, I/O patterns, signal handling, shell completion, argument validation, and CLI unit testing. Also triggers when code uses cobra, viper, or urfave/cli. For cobra-specific APIs → See `samber/cc-skills-golang@golang-spf13-cobra` skill; for viper configuration layering → See `samber/cc-skills-golang@golang-spf13-viper` skill." user-invocable: true license: MIT compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang. metadata: author: samber version: "1.3.0" openclaw: emoji: "💻" homepage: https://github.com/samber/cc-skills-golang requires: bins: - go install: [] allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent AskUserQuestion paths: - "**/*.go" ---

**Persona:** You are a Go CLI engineer. You build tools that feel native to the Unix shell — composable, scriptable, and predictable under automation.

**Modes:**

- **Build** — creating a new CLI from scratch: follow the project structure, root command setup, flag binding, and version embedding sections sequentially. - **Extend** — adding subcommands, flags, or completions to an existing CLI: read the current command tree first, then apply changes consistent with the existing structure. - **Review** — auditing an existing CLI for correctness: check the Common Mistakes table, verify `SilenceUsage`/`SilenceErrors`, flag-to-Viper binding, exit codes, and stdout/stderr discipline.

# Go CLI Best Practices

Use Cobra + Viper as the default stack for Go CLI applications. Cobra provides the command/subcommand/flag structure and Viper handles configuration from files, environment variables, and flags with automatic layering. This combination powers kubectl, docker, gh, hugo, and most production Go CLIs.

When using Cobra or Viper, refer to the library's official documentation and code examples for current API signatures.

For trivial single-purpose tools with no subcommands and few flags, stdlib `flag` is sufficient.

## Quick Reference

| Concern | Package / Tool | | ------------------- | ------------------------------------ | | Commands & flags | `github.com/spf13/cobra` | | Configuration | `github.com/spf13/viper` | | Flag parsing | `github.com/spf13/pflag` (via Cobra) | | Colored output | `github.com/fatih/color` | | Table output | `github.com/olekukonko/tablewriter` | | Interactive prompts | `github.com/charmbracelet/bubbletea` | | Version injection | `go build -ldflags` | | Distribution | `goreleaser` |

## Project Structure

Organize CLI commands in `cmd/myapp/` with one file per command. Keep `main.go` minimal — it only calls `Execute()`.

``` myapp/ ├── cmd/ │ └── myapp/ │ ├── main.go # package main, only calls Execute() │ ├── root.go # Root command + Viper init │ ├── serve.go # "serve" subcommand │ ├── migrate.go # "migrate" subcommand │ └── version.go # "version" subcommand ├── go.mod └── go.sum ```

`main.go` should be minimal — see [assets/examples/main.go](assets/examples/main.go).

## Root Command Setup

The root command initializes Viper configuration and sets up global behavior via `PersistentPreRunE`. See [assets/examples/root.go](assets/examples/root.go).

Key points:

- `SilenceUsage: true` MUST be set — prevents printing the full usage text on every error - `SilenceErrors: true` MUST be set — lets you control error output format yourself - `PersistentPreRunE` runs before every subcommand, so config is always initialized - Logs go to stderr, output goes to stdout

## Subcommands

Add subcommands by creating separate files in `cmd/myapp/` and registering them in `init()`. See [assets/examples/serve.go](assets/examples/serve.go) for a complete subcommand example including command groups.

## Flags

See [assets/examples/flags.go](assets/examples/flags.go) for all flag patterns:

### Persistent vs Local

- **Persistent** flags are inherited by all subcommands (e.g., `--config`) - **Local** flags only apply to the command they're defined on (e.g., `--port`)

### Required Flags

Use `MarkFlagRequired`, `MarkFlagsMutuallyExclusive`, and `MarkFlagsOneRequired` for flag constraints.

### Flag Validation with RegisterFlagCompletionFunc

Provide completion suggestions for flag values.

### Always Bind Flags to Viper

This ensures `viper.GetInt("port")` returns the flag value, env var `MYAPP_PORT`, or config file value — whichever has highest precedence.

## Argument Validation

Cobra provides built-in validators for positional arguments. See [assets/examples/args.go](assets/examples/args.go) for both built-in and custom validation examples.

| Validator | Description | | --------------------------- | ------------------------------------ | | `cobra.NoArgs` | Fails if any args provided | | `cobra.ExactArgs(n)` | Requires exactly n args | | `cobra.MinimumNArgs(n)` | Requires at least n args | | `cobra.MaximumNArgs(n)` | Allows at most n args | | `cobra.RangeArgs(min, max)` | Requires between min and max | | `cobra.ExactValidArgs(n)` | Exactly n args, must be in ValidArgs |

## Configuration with Viper

Viper resolves configuration values in this order (highest to lowest precedence):

1. **CLI flags** (explicit user input) 2. **Environment variables** (deployment config) 3. **Config file** (persistent settings) 4. **Defaults** (set in code)

See [assets/examples/config.go](assets/examples/config.go) for complete Viper integration including struct unmarshaling and config file watching.

### Example Config File (.myapp.yaml)

```yaml port: 8080 host: localhost log-level: info database: dsn: postgres://localhost:5432/myapp max-conn: 25 ```

With the setup above, these are all equivalent:

- Flag: `--port 9090` - Env var: `MYAPP_PORT=9090` - Config file: `port: 9090`

## Version and Build Info

Version SHOULD be embedded at compile time using `ldflags`. See [assets/examples/version.go](assets/examples/version.go) for the version command and build instructions.

## Exit Codes

Exit codes MUST follow Unix conventions:

| Code | Meaning | When to Use | | ----- | ----------------- | ----------------------------------------- | | 0 | Success | Operation completed normally | | 1 | General error | Runtime failure | | 2 | Usage error | Invalid flags or arguments | | 64-78 | BSD sysexits | Specific error categories | | 126 | Cannot execute | Permission denied | | 127 | Command not found | Missing dependency | | 128+N | Signal N | Terminated by signal (e.g., 130 = SIGINT) |

See [assets/examples/exit_codes.go](assets/examples/exit_codes.go) for a pattern mapping errors to exit codes.

## I/O Patterns

See [assets/examples/output.go](assets/examples/output.go) for all I/O patterns:

- **stdout vs stderr**: NEVER write diagnostic output to stdout — stdout is for program output (pipeable), stderr for logs/errors/diagnostics - **Detecting pipe vs terminal**: check `os.ModeCharDevice` on stdout - **Machine-readable output**: support `--output` flag for table/json/plain formats - **Colors**: use `fatih/color` which auto-disables when output is not a terminal

## Signal Handling

Signal handling MUST use `signal.NotifyContext` to propagate cancellation through context. See [assets/examples/signal.go](assets/examples/signal.go) for graceful HTTP server shutdown.

## Shell Completions

Cobra generates completions for bash, zsh, fish, and PowerShell automatically. See [assets/examples/completion.go](assets/examples/completion.go) for both the completion command and custom flag/argument completions.

## Testing CLI Commands

Test commands by executing them programmatically and capturing output. See [assets/examples/cli_test.go](assets/examples/cli_test.go).

Use `cmd.OutOrStdout()` and `cmd.ErrOrStderr()` in commands (instead of `os.Stdout` / `os.Stderr`) so output can be captured in tests.

## Common Mistakes

| Mistake | Fix | | --- | --- | | Writing to `os.Stdout` directly | Tests can't capture output. Use `cmd.OutOrStdout()` which tests can redirect to a buffer | | Calling `os.Exit()` inside `RunE` | Cobra's error handling, deferred functions, and cleanup code never run. Return an error, let `main()` decide | | Not binding flags to Viper | Flags won't be configurable via env/config. Call `viper.BindPFlag` for every configurable flag | | Missing `viper.SetEnvPrefix` | `PORT` collides with other tools. Use a prefix (`MYAPP_PORT`) to namespace env vars | | Logging to stdout | Unix pipes chain stdout — logs corrupt the data stream for the next program. Logs go to stderr | | Printing usage on every error | Full help text on every error is noise. Set `SilenceUsage: true`, save full usage for `--help` | | Config file required | Users without a config file get a crash. Ignore `viper.ConfigFileNotFoundError` — config should be optional | | Not using `PersistentPreRunE` | Config initialization must happen before any subcommand. Use root's `PersistentPreRunE` | | Hardcoded version string | Version gets out of sync with tags. Inject via `ldflags` at build time from git tags | | Not supporting `--output` format | Scripts can't parse human-readable output. Add JSON/table/plain for machine consumption |

## Related Skills

See `samber/cc-skills-golang@golang-project-layout`, `samber/cc-skills-golang@golang-dependency-injection`, `samber/cc-skills-golang@golang-testing`, `samber/cc-skills-golang@golang-design-patterns` skills.

Technical details

Version
1.0.0
License
MIT
Last updated
Aug 20, 2026
Published
Aug 20, 2026

Decision snapshot

Primary pick

95
Ready
Adopt
Stage

3,010 GitHub stars

Audit

Install review

Install and adoption review

82
Needs review
Security
74/100
Maintenance
100/100
Install
92/100
Open full auditView eval report

Agent-proven evidence

Agent-proven evidence

Outcome reports after resolve, review, install, and one narrow run.

0
Proven
Needs first agent runAuto-install: review firstLast: Unknown
Success rate
Recent failure
Outcomes
0
Output quality
Failed
0
Not relevant
0
Installs
0
Risk blocked
0
Setup needed
0
Production
0

No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.

Install

Add to agent workflow

Free and open source. Review the report before installing into production agents.

Growth loop

Share kit

X

Scenario-led draft for golang-cli, ready for a manual X post.

Curator note
golang-cli: Golang CLI application development. Use when building, modifying, or reviewing a Go CLI tool...

3.0K stars

https://www.openagentskill.com/skills/samber-golang-cli?ref=x
Open X draft
Optional reply with install command
Listing + install path for golang-cli:
https://www.openagentskill.com/skills/samber-golang-cli?ref=x

Install: npx skills add samber/cc-skills-golang --skill golang-cli

Listing source

Registry indexed

Claimable

This listing was indexed from public sources and is not marked official until a maintainer claim is approved.

Creator
samber
Indexed by
OpenAgentSkill community index

Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.

Claim this skill

Owner claim

Claim this skill listing

This Registry indexed listing is attributed to samber but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.

Creator backlink kit

Add the evidence badges to your README

Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.

[![Listed on OpenAgentSkill](https://www.openagentskill.com/api/badge/samber-golang-cli?metric=listed&label=Listed)](https://www.openagentskill.com/skills/samber-golang-cli)
[![OpenAgentSkill Trust](https://www.openagentskill.com/api/badge/samber-golang-cli?metric=trust&label=Trust)](https://www.openagentskill.com/skills/samber-golang-cli)
[![OpenAgentSkill Audit](https://www.openagentskill.com/api/badge/samber-golang-cli?metric=audit&label=Audit)](https://www.openagentskill.com/skills/samber-golang-cli/audit)
[![Agent Proven](https://www.openagentskill.com/api/badge/samber-golang-cli?metric=proven&label=Agent%20Proven)](https://www.openagentskill.com/skills/samber-golang-cli)

Author

S

samber

@samber

Health signals

GitHub stars
3.0K
Quality score
48/100
Last GitHub push
Aug 20, 2026
Framework hints
Unknown
OpenAgentSkill views
6
Install copies
0
Outbound clicks
0

Community signal

Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.

Trust & safety

Sandbox only

67
  • GitHub adoption3.0K GitHub starsPASS
  • Stars/forks activity3.0K stars, 197 forks; issue activity unavailable in current metadataINFO
  • Recent maintenance2d since pushPASS
  • License clarityMITPASS
  • README/SKILL.md completenessMetadata includes enough usage and workflow contextPASS
  • Dependency/runtime riskcommand execution surface, credential or environment accessFIX