goctl for go-zero CLI

goctl generates go-zero service and client code from API descriptions so an agent can start with a consistent project scaffold.

  • 33,427 ★ on the repository
  • Last commit
  • MIT
CLI

Extended access

Why this level

  • The generator creates and changes source files in the selected project directory.
All reasons and checks

zeromicro/go-zero

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/goctl-for-go-zero

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The generator creates and changes source files in the selected project directory.

This is third-party code. Review the repository files before installing.

What it does

The team describes service routes, requests and responses in an `.api` file. From that contract, goctl creates directories for handlers, types and application logic. Its source lives in the go-zero repository; RPC generation also uses `.proto` files. An agent with terminal access calls goctl directly. Clients limited to MCP tools can use the separate mcp-zero adapter. Developers review the generated files, implement request handling and run tests. The ai-context and zero-skills guides describe this workflow and go-zero patterns.

Who it is for. Go service authors using go-zero and beginning agent development from API specifications.

Good fit when

  • An agreed HTTP contract is ready for go-zero source generation from an `.api` file.
  • A Java or Dart client uses the API already described for the server.
  • Request or response changes call for regenerated types and a review of file differences.
  • A developer starts a new API description from a template and fills in routes, requests and responses.

Not a fit when

  • The project does not use go-zero conventions.
  • The generator must implement all business rules.
  • Existing manual changes would be overwritten without diff review.

Example request

Prepare a test-service API specification and a goctl generation plan with separate diff review.

Limitations

Installation requires Go, and the directory containing the goctl binary must be on the agent’s `PATH`. The generator reads an `.api` or `.proto` contract; it cannot recover omitted request requirements. Developers implement application logic after generation and validate it with tests; generated handlers do not finish the service. When regenerating an existing project, review created and modified files so that needed manual changes are retained.

How to disable. Stop invoking the generator and uninstall its binary. Generated source remains in the project.

FAQ

How do I generate a Go service from `.api`?

For the example file, run `goctl api go -api greet.api -dir greet`. The `greet` directory will contain service source, including handlers and request types.

How do I create an API-description template?

Run `goctl api -o greet.api`. Edit the generated file with routes and data types, then pass it to the server or client generator.

What follows generation?

Implement request handling in the service directory, then run `go mod tidy`, `go build ./...` and `go test ./...`. Resolve build and test failures before starting the service.

How do I generate a Java client?

The same example uses `goctl api java -api greet.api -dir greet`. Client code is generated from the `greet.api` contract for the application developer.

How do I verify installation?

Run `goctl --version` in the agent’s environment.

Discussion

No questions or reviews yet.

CLI tools

A terminal coding agent in Go: GLM, DeepSeek and local Ollama models, 59 built-in tools and MCP

CLIBroad access110Repository stars
Official

A short Vercel Labs skill that finds or installs the Zero compiler and loads instructions matched to its version, so the agent edits through the graph

SkillBroad access5.4KRepository stars

A CLI that keeps RFCs, ADRs and work items as TOML in your repo and stops an agent from closing work until checks pass

CLIExtended access277Repository stars

Terminal coding agent in Rust: four permission modes, checkpoints, subagents, skills, hooks, MCP and local models

CLIBroad access157Repository stars

ZCF

ZCF - Zero-Config Code Flow

A CLI that sets up Claude Code and Codex in one run: workflows, agents, skills, MCP and a provider choice

CLIExtended access6.1KRepository stars

An MCP server and CLI in Go: the agent keeps an index of code and database schema in the repository, versions it in Git and reads it whole before each task

MCP serverBroad access1.9KRepository stars

README in short

The README example maps generated files to their roles: routes live in `internal/handler`, while request logic is implemented in `internal/logic`.

README badge

Report a problem