本文最后更新于 2026年5月19日。
Installation
在项目目录下通过如下命令安装:
GO111MODULE=on GOPROXY=https://goproxy.cn/,direct go get -u github.com/zeromicro/go-zero
AI 原生开发
go-zero 团队构建了完整的 AI 工具生态,让 Claude、GitHub Copilot、Cursor 生成符合 go-zero 规范的代码。
三大核心项目
ai-context – AI 的工作流程指南
zero-skills – 模式库和示例
mcp-zero – 基于 MCP 的代码生成工具
快速配置
GitHub Copilot
git submodule add https://github.com/zeromicro/ai-context.git .github/ai-context
ln -s ai-context/00-instructions.md .github/copilot-instructions.md # macOS/Linux
# Windows: mklink .github\copilot-instructions.md .github\ai-context\00-instructions.md
git submodule update --remote .github/ai-context # 更新
Cursor
git submodule add https://github.com/zeromicro/ai-context.git .cursorrules
git submodule update --remote .cursorrules # 更新
Windsurf
git submodule add https://github.com/zeromicro/ai-context.git .windsurfrules
git submodule update --remote .windsurfrules # 更新
Claude Desktop
git clone https://github.com/zeromicro/mcp-zero.git && cd mcp-zero && go build
# 配置: ~/Library/Application Support/Claude/claude_desktop_config.json
# 或: claude mcp add --transport stdio mcp-zero --env GOCTL_PATH=/path/to/goctl -- /path/to/mcp-zero
协同工作原理
AI 助手通过三个工具协同配合:
- ai-context – 工作流程指导
- zero-skills – 实现模式
- mcp-zero – 实时代码生成
示例:创建新的 REST API → AI 读取 ai-context 了解工作流 → 调用 mcp-zero 生成代码 → 参考 zero-skills 实现模式 → 生成符合规范的代码 ✅