golang-cli
Build Reliable Go Command-Line Applications
Go command-line projects need consistent commands, configuration, output, shutdown, and testing patterns. This skill applies practical Cobra and Viper guidance with reusable Go examples.
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "golang-cli" from https://skillstore.io/skills/samber-golang-cli.md and its manifest at https://skillstore.io/api/skills/samber-golang-cli/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“golang-cli”。 Design a deploy command with required environment and tag flags.
预期结果:
- A command layout with declarative argument validation.
- Required environment and tag flags with mutual-exclusion rules.
- Viper bindings and completion values for supported environments.
正在使用“golang-cli”。 Review a list command that mixes logs with pipeable output.
预期结果:
A review that moves records to stdout, diagnostics to stderr, and recommends selectable table, plain, and JSON formats.
正在使用“golang-cli”。 Add graceful shutdown to a server subcommand.
预期结果:
A design using signal-aware context cancellation, SIGINT and SIGTERM support, a shutdown timeout, and distinct handling for normal server closure.
安全审计
安全All 94 static findings are false positives caused by Go syntax, Markdown formatting, Cobra identifiers, completion documentation, and benign build examples. No malicious behavior, prompt injection, data exfiltration, unsafe command execution, or covert system access was found.
风险因素
⚡ 包含脚本 (12)
⚙️ 外部命令 (50)
📁 文件系统访问 (4)
🌐 网络访问 (1)
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/samber-golang-cli/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/samber-golang-cli?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/samber-golang-cli?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-cli/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/samber-golang-cli.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
samber. (2026). golang-cli security audit report (audit version 1) [Author version 1.3.0]. Skillstore. https://skillstore.io/skills/samber-golang-cli/audits/1BibTeX 引用
@techreport{samber-samber-golang-cli-2026,
author = {samber},
title = {golang-cli security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/samber-golang-cli/audits/1},
note = {Author version 1.3.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-cli security audit report (audit version 1)"
version: "1.3.0"
type: report
authors:
- name: "samber"
date-released: "2026-09-06"
url: "https://skillstore.io/skills/samber-golang-cli/audits/1"
identifiers:
- type: other
value: "skillstore:samber-golang-cli:audit:1"
description: "Skillstore immutable audit report identifier"
Skillstore 评分
评分依据 证据置信度: 中你能构建什么
Start a Go CLI
Create a maintainable Cobra command tree with flags, configuration, output rules, and a minimal entry point.
Extend an Existing Tool
Add subcommands, configuration sources, shell completion, or machine-readable output while preserving established project structure.
Review CLI Behavior
Check exit codes, signal handling, output streams, argument validation, and command tests for predictable automation.
试试这些提示
Create a Cobra command named [command]. Add [arguments] and [flags]. Keep main minimal and return errors from command handlers.
Add Viper configuration to this CLI. Use prefix [prefix], optional file [path], flag bindings, defaults, and clear precedence.
Review this command for scripting. Separate stdout and stderr, add table and JSON output, define exit codes, and add shell completion.
Refactor this server command for production. Add context cancellation, SIGINT and SIGTERM handling, timed shutdown, typed errors, and command-level tests.
最佳实践
- Read the existing command tree before changing structure or shared behavior.
- Bind configurable flags explicitly and document the precedence of every configuration source.
- Test commands through Cobra interfaces so arguments, output, and errors remain observable.
避免
- Do not call process exit functions inside command handlers because deferred cleanup will not run.
- Do not write logs or diagnostics to stdout because they corrupt piped output.
- Do not require a configuration file when defaults and environment variables can provide valid settings.