跳到正文
TakoAPI
返回技能列表

agentcli-go

由 gh-xj 提供

Coding Agents & IDEs
314下载量由 clawskills.sh 提供
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

agentcli-go framework reference for building Go CLI tools.

描述

该技能的功能

agentcli-go is a shared Go library that provides scaffolding, command wiring, config loading, and lifecycle hooks for building CLI tools. It exposes a standard project layout, a cobra wrapper (cobrax), and a config precedence system (configx). The module is pre-1.0 and hosted at github.com/gh-xj/agentcli-go.

Bundles cobra setup, zerolog initialization, config precedence logic, and scaffolding into one reusable module so the same patterns don't need to be wired from scratch in each project.

何时使用

  • Scaffolding a new Go CLI project with standard directory layout
  • Adding a typed subcommand to an existing CLI tool using a preset
  • Loading config from a file, environment variables, and flags with defined precedence
  • Running preflight and postflight hooks around a command's main logic
  • Diagnosing a CLI project's structure with the doctor check

示例工作流

输入

User asks: scaffold a new Go CLI tool named my-tool with a sync command

智能体
  1. 1

    Run agentcli new --name my-tool --module github.com/me/my-tool to generate the project skeleton

  2. 2

    Review generated files: main.go, cmd/root.go, internal/app/, internal/config/, Taskfile.yml

  3. 3

    Run agentcli add command --name sync --preset file-sync to add the sync subcommand

  4. 4

    Wire configx.Load in internal/config/load.go with defaults, env prefix, and flag overrides

  5. 5

    Run task ci to confirm lint, tests, build, and smoke checks all pass

输出

A fully structured Go CLI project with the sync command wired and CI passing

安装

clawhub install gh-xj/agentcli-go

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接