Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/hellopoisonx-golang-cli
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/golang-cli
Tools it pre-approves 10
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
ReadEditWriteGlobGrepBash(go:*)Bash(golangci-lint:*)Bash(git:*)AgentAskUserQuestion
What's inside
- Skill 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.
- License
- MIT
- Compatibility
- Designed for Claude Code or similar AI coding agents, and for projects using Golang.
- Allowed tools
- Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(golangci-lint:*), Bash(git:*), Agent, AskUserQuestion
- Metadata
- author: samber · version: 1.2.0
- Instructions
- 188 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (14)
- SKILL.md
- args.go · assets/examples/
- cli_test.go · assets/examples/
- completion.go · assets/examples/
- config.go · assets/examples/
- exit_codes.go · assets/examples/
- flags.go · assets/examples/
- main.go · assets/examples/
- output.go · assets/examples/
- root.go · assets/examples/
- serve.go · assets/examples/
- signal.go · assets/examples/
- version.go · assets/examples/
- evals.json · evals/
SKILL.md (first lines)
**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
```From hellopoisonx/aim, MIT.
More from hellopoisonx/aim
- 0.534score
golang-code-style
samber
Golang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt.
SkillCFreshness: C★ 5Claude Code +9 - 0.534score
golang-benchmark
samber
Golang benchmarking, profiling, and performance measurement.
SkillCFreshness: C★ 5Claude Code - 0.534score
golang-concurrency
samber
Golang concurrency patterns.
SkillCFreshness: C★ 5Claude Code +9 - 0.534score
golang-context
samber
Idiomatic context.Context usage in Golang — propagation through API boundaries, cancellation, timeouts and deadlines, request-scoped values…
SkillCFreshness: C★ 5Claude Code +9 - 0.534score
golang-continuous-integration
samber
CI/CD pipeline configuration using GitHub Actions for Golang projects — testing, linting, SAST, security scanning, code coverage, Dependabot, Renovate…
SkillCFreshness: C★ 5Claude Code - 0.526score
aim-dev-tool
hellopoisonx
AIM 开发测试工具(dev-tool)。Python CLI,覆盖 gateway 全部 REST 端点与 WebSocket 帧协议,支持多 profile 多用户并行测试、并发压测。当需要调试 REST/WS 接口、运行集成测试、压力测试、或新增命令时使用。
SkillCFreshness: C★ 5Claude Code +9 - 0.524score
aim-docker-datastore
hellopoisonx
AIM 本地 Docker 数据存储运维 Skill。Use when the user asks to inspect, connect to, query, debug, or verify Docker Compose Kafka, Redis, or PostgreSQL in this project…
SkillCFreshness: C★ 5Claude Code +9 - 0.523score
aim-repo-mapping
hellopoisonx
aim 仓库导航 Skill。用于快速判断需求应该落到哪个业务域、哪个控制器、哪个工作流或哪个配置文件;当需求入口不清晰、需要先找模块边界、接口总览、运行入口或改动影响面时使用。
SkillCFreshness: C★ 5Claude Code +9 - 0.523score
aim-database-migration
hellopoisonx
AIM 数据库迁移规范与 Docker Compose 集成。当修改 migration SQL 文件、新增迁移、修改 docker-compose.yaml 的 migrate 服务、或排查迁移失败时使用。
SkillCFreshness: C★ 5Claude Code +9 - 0.523score
aim-ws-token-management
hellopoisonx
WebSocket 连接 Token 生命周期管理。覆盖 Token 过期导致 WS 断连的排查与修复、JWT TTL 配置链路、WSClient 自动刷新机制、压测长跑场景下的 Token 续期策略。
SkillCFreshness: C★ 5Claude Code +9 - 0.520score
aim-proto-domain
hellopoisonx
aim 的 Protobuf 协议域。定义跨端/跨服务线缆协议。对应 `shared/proto` 目录。
SkillCFreshness: C★ 5Claude Code +9 - 0.520score
aim-shared-domain
hellopoisonx
aim 的进程内共享包域。对应 `app/shared` 模块。
SkillCFreshness: C★ 5Claude Code +9
Signals
- Stars
- 5
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- May 26, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- Version
- 1.2.0
- License
- MIT
- Repository
- github.com/hellopoisonx/aim
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from samber
- 0.563score
golang-design-patterns
samber
Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown…
SkillBFreshness: B★ 2Claude Code +9 - 0.563score
golang-performance
samber
Golang performance optimization patterns and methodology - if X bottleneck, then apply Y.
SkillBFreshness: B★ 2Claude Code - 0.563score
golang-security
samber
Security best practices and vulnerability prevention for Golang.
SkillBFreshness: B★ 2Claude Code - 0.563score
golang-testing
samber
Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak…
SkillBFreshness: B★ 2Claude Code +9 - 0.563score
golang-documentation
samber
Comprehensive documentation guide for Golang projects, covering godoc comments, README, CONTRIBUTING, CHANGELOG, Go Playground, Example tests, API docs, and…
SkillBFreshness: B★ 2Claude Code - 0.534score
golang-benchmark
samber
Golang benchmarking, profiling, and performance measurement.
SkillCFreshness: C★ 5Claude Code
Cite this page
golang-cli skill. Agent Mart. https://agentmart.dev/skills/hellopoisonx-golang-cli (last updated 2026-10-24)