agentleFS
a-kaibua-kaibu/skills/go-cli-builder/SKILL.md

go-cli-builder

Skill0 starsChanged 6 months agoMITView on GitHub

Use when building a Go CLI tool as a releasable command binary.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. dedene/skills★ 14same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when building a Go CLI tool as a releasable command binary.

    line 9
  2. Very specific:

    Put the CLI entrypoint at the repository root as main.go.

    line 13
  3. Very specific:

    Keep main.go thin: configure process-wide logging, call the command package, translate known command errors to exit codes, log unexpected …

    line 14
  4. Very specific:

    Put command behavior outside main.go, typically under packages such as internal.

    line 15
  5. Distinctive:

    Prefer standard Go project conventions before adding framework-specific structure.

    line 16
  6. Distinctive:

    Write tests for pure-function parts.

    line 17
  7. Very specific:

    Use aqua as the package manager.

    line 18
  8. Very specific:

    Run go test ./... after every code change.

    line 22
  9. Very specific:

    Run golangci-lint run ./...

    line 23
  10. Very specific:

    Create .github/workflows/release.yaml and run GoReleaser when a version tag is pushed.

    line 77
  11. Very specific:

    After creating the workflow, run pinact run --update -min-age 3 to update to current packages.

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Go CLI Builder

Use this skill when building a Go CLI tool as a releasable command binary.

Project Shape

  • Put the CLI entrypoint at the repository root as main.go.
  • Keep main.go thin: configure process-wide logging, call the command package, translate known command errors to exit codes, log unexpected errors, and exit.
  • Put command behavior outside main.go, typically under packages such as internal.
  • Prefer standard Go project conventions before adding framework-specific structure.
  • Write tests for pure-function parts.
  • Use aqua as the package manager. Initialize it with aqua init, run aqua g -i suzuki-shunsuke/pinact golangci/golangci-lint, then run aqua i.

Test/Lint

  • Run go test ./... after every code change.
  • Run golangci-lint run ./... and golangci-lint fmt ./... after every code change.

Version Information

Embed the release version through the package-level Version variable in main.go. Refer to this implementation:

var Version string

func getVersion() string {
	if Version != "" {
		return Version
	}

	if info, ok := debug.ReadBuildInfo(); ok {
		if info.Main.Version != "(devel)" {
			return info.Main.Version
		}

		if v, ok := getVCSBuildVersion(info); ok {
			return v
		}
	}

	return "(unset)"
}

func getVCSBuildVersion(info *debug.BuildInfo) (string, bool) {
	var (
		revision string
		dirty    string
	)

	for _, v := range info.Settings {
		switch v.Key {
		case "vcs.revision":
			revision = v.Value
		case "vcs.modified":
			if v.Value == "true" {
				dirty = " (dirty)"
			}
		}
	}

	if revision == "" {
		return "", false
	}

	return revision + dirty, true
}

Release

Create .github/workflows/release.yaml and run GoReleaser when a version tag is pushed. After creating the workflow, run pinact run --update -min-age 3 to update to current packages.

name: Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
        with:
          fetch-depth: 0

      - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
        with:
          go-version-file: go.mod
          cache: true

      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
        with:
          distribution: goreleaser
          version: '~> v2'
          args: release --clean
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.