Go Gin Init Skill logo

Go Gin Init Skill

Community
jiushiwon
go-gin-init-skill

Go 项目一键初始化技能。面向零基础小白,提供环境探测、自动安装、完整 Web 骨架生成、SSE 流式框架、JWT 鉴权、统一响应封装、文件上传接口、一键启动/重启脚本、Swagger 文档,内置 MySQL(默认)/ PostgreSQL 数据库选择。用户只需说"帮我搭一个 Go 项目"即可一条命令完成从零到跑的完整链路。触发词:"Go 脚手架"、"Go 一键生成"、"初始化 Go 项目"、"Go 快速开始"、"go init"、"搭建 Go 服务"、"Go Web 骨架"、"Go 开箱即用"、"Go 零基础"、"Go 小白"、"帮我搭一个 Go"、"新建 Go"、"create go project"、"go starter"。

Overview

Publisherjiushiwon
Repositorywg-skills
Skill namego-gin-init-skill
Stars
123
Forks
38
Bundled files
28
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 28 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by jiushiwon on GitHub. Read the source before you install it.

Installation

Install the Go Gin Init Skill AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/go/go-gin-init-skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jiushiwon/wg-skills.git /tmp/wg-skills
mkdir -p .claude/skills
cp -r /tmp/wg-skills/vibeCoding/backend/go/go-gin-init-skill .claude/skills/go-gin-init-skill
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Go Gin Init Skill in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Go Gin Init Skill on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Go Gin Init Skill is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Go Init Skill

面向完全不懂编程的小白,一键生成标准化、开箱即用的 Go Web 服务骨架。

4 语言 init-skill 横向对比

维度springboot-init(Java)fastapi-init(Python)go-gin-init(Go)nodejs-init(Node.js)
框架Spring Boot 3FastAPI + uvicornGinExpress
启动方式mvn spring-boot:runuvicorn main:app**`./restart.sh [devprod]`**
默认数据库MySQLMySQL / PostgreSQLMySQL(可选 PostgreSQL)MySQL
ORMMyBatis-PlusSQLAlchemyGORMSequelize
鉴权JWT + Spring SecurityJWT + OAuth2JWT + 中间件JWT + Passport
SSEWebFlux SSEStreamingResponseGin SSESSE
Swaggerspringdoc-openapiFastAPI 自带swaggo/gin-swaggerswagger-jsdoc

不重复造轮子:统一响应信封、错误码、JWT 规范与各 init-skill 内置的统一契约层对齐,模板已内置于本 skill(references/api-contract-template.md、references/project-guide-template.md);关系型 DB 配置引用 database-design-skill;前端联动规范引用 frontend-request-skill。本 skill 在它们之上增加「小白友好」的完整封装。

依赖

  • init-skill 内置契约层:响应信封 { code, message, data }、错误码(-1001 校验 / -2000 系统)、JWT Bearer、api-contract、project-guide 规范已内置本 skill
  • database-design-skill:MySQL / PostgreSQL 选型规则、表前缀 wg、连接参数
  • frontend-request-skill:前端请求层规范,确保后端生成的接口契约可直接被前端消费

核心能力清单(11 项)

#能力说明
1环境探测自动检测 Go 版本(>= 1.20)、GolangCI-Lint、操作系统类型
2自动安装初始化 go.mod、安装依赖、go build 检查
3一键启动/重启`./restart.sh [dev
4开发模式./restart.sh dev 热重载(air),日志 logs/dev.log
5生产模式./restart.sh prod 后台多 worker,日志 logs/app.log
6SSE 流式内置 gin-sse,示例端点 /api/sse/chat
7文件上传内置 /api/upload 单文件与 /api/uploads 多文件上传
8统一响应中间件自动包装 { code, message, data }
9全局异常BusinessException / 校验错误 / 兜底错误处理
10JWT 鉴权golang-jwt/v5:注册 / 登录 / 刷新令牌 / 当前用户注入
11安全头内置 X-Frame-Options / X-Content-Type-Options 等基础安全头

生成流程

第一步:询问用户(只问 3 个问题)

1. 项目名叫什么?(默认 my-go-app)
2. 用哪个数据库?
   A. MySQL(默认,推荐)
   B. PostgreSQL
   C. 暂时不用数据库
3. 是否需要 Redis?(默认不需要)

不做:不问技术细节、不问版本号、不问目录结构——全部自动选最佳实践。

第二步:环境探测

按 references/env-setup.md 流程执行:

  1. 检测 Go 是否安装 / 版本(需 >= 1.20)
  2. 检测 GOPATH / GOROOT 是否可用
  3. 检测操作系统(Linux / macOS / Windows)
  4. 若未安装:给出明确的中文提示 + 下载链接
  5. 若已安装但版本过低:给出升级指引

第三步:生成项目骨架

按 references/skeleton.md 的目录结构与代码模板,现场生成全部文件。维护者可用本 skill 根目录的 scripts/generate_project.go 作为 canonical 生成器参考,确保所有文件一次生成、编码正确(.bat 为 UTF-8 with BOM + CRLF)。

生成顺序:

  1. 创建目录结构
  2. 初始化 go.mod(go mod init)
  3. 写入依赖与配置(.env.example、.env、.gitignore)
  4. 写入核心模块(main.go、config.go、database.go、response.go、exceptions.go、middleware.go)
  5. 写入业务模块(models → handlers → services → routes)
  6. 写入启动脚本(restart.sh / restart.bat,dev/prod 双模式)
  7. 写入 Docker 配置(Dockerfile + docker-compose.yml / docker-compose.pg.yml,按需启用)
  8. 写入强制交付物(api-contract.md + docs/project-guide.md)
  9. 写入项目说明(README.md)

第四步:自动安装与启动

生成完成后:

  1. 安装 Go 依赖(go mod tidy)
  2. 从 .env.example 复制生成 .env(如不存在)
  3. 安装 air 热重载(go install github.com/air-verse/air@latest)
  4. 编译检查(go build -o bin/server .)
  5. 检测数据库是否可用,有 Docker 则自动启动数据库容器
  6. 提示用户运行 ./restart.sh [dev|prod] 或 restart.bat [dev|prod] 一键启动

第五步:交付清单

向用户汇报完整交付物:

[OK] 项目 {{project}} 生成完毕!

📁 生成的文件(约 20 个):
  - 核心模块:main.go, config.go, database.go, response.go, exceptions.go, middleware.go
  - API 路由:health / auth / users / sse / upload
  - 启动脚本:restart.sh, restart.bat(dev/prod 双模式)
  - 数据库:MySQL(已配置 docker-compose.yml,可选 PG / 无数据库)
  - 文档:api-contract.md, docs/project-guide.md

🚀 启动方式:
  开发模式:  ./restart.sh dev        (热重载,日志 logs/dev.log)
  生产模式:  ./restart.sh prod       (后台多 worker,日志 logs/app.log)
  默认:      ./restart.sh            (同 dev)

📖 接口文档:
  Swagger UI:  http://localhost:8080/swagger/index.html
  API Docs:   http://localhost:8080/docs

🔌 SSE 示例:
  curl http://localhost:8080/api/sse/chat

📎 上传示例:
  curl -F "file=@test.png" http://localhost:8080/api/upload

🔑 默认账号:
  注册接口:POST /api/auth/register
  登录接口:POST /api/auth/login

[WARNING] 安全提醒:
  请编辑 .env 文件修改 JWT_SECRET(搜索 change-me)
  生产环境务必使用随机密钥(至少 256 位)!

生成项目的目录结构

参见 references/skeleton.md 的「目录结构」小节。核心约定:

  • 路由前缀:/api
  • 认证路由:/api/auth/*
  • SSE 路由:/api/sse/*
  • 上传路由:/api/upload、/api/uploads
  • 表前缀:wg(可在 .env 中修改)
  • 应用端口:8080
  • Swagger:/swagger/index.html、/docs
  • 健康检查:GET /api/health

引用索引

文件内容
scripts/generate_project.gocanonical 项目生成器:从 skeleton.md / startup-scripts.md 提取模板并生成完整项目
references/skeleton.md精简目录结构 + 核心文件代码模板(main/config/database/middleware/handlers/services/models)
references/env-setup.md环境探测流程、自动安装逻辑、常见问题排错
references/sse-guide.mdSSE 流式框架集成方案、示例端点、客户端对接
references/db-guide.md数据库选型、MySQL/PG 连接配置、Docker 启动命令
references/db-schema-guide.md数据库表设计规范(表名、字段、索引、软删除等)
references/middleware-guide.md中间件链(安全头→日志→CORS→鉴权→校验→响应→异常)
references/startup-scripts.mdrestart.sh / restart.bat 脚本模板(dev/prod 双模式,一条命令完成拉代码、装依赖、安全重启、日志输出)
references/api-contract-template.md生成项目根目录 api-contract.md 的模板,含 health/auth/users/sse/upload 全量接口
references/project-guide-template.md生成项目 docs/project-guide.md 的模板,含栈说明、启动方式、拓展指南
references/frontend-integration.md与 frontend-request-skill 的联动:响应信封、错误码、Token、SSE、上传对接

强制交付物

生成项目时必须同时落地两份文档,模板已内置本 skill:

文档位置说明
项目指南docs/project-guide.md按本 skill references/project-guide-template.md 生成,栈特定段填入本 skill 内容
接口契约api-contract.md以本 skill references/api-contract-template.md 为起点,含 health/auth/users/sse/upload 全量接口

红线(不可绕过)

  1. 不生成无契约的骨架:不重复生成无契约规范的骨架代码,本 skill 生成的是包含完整契约层(响应信封/错误码/JWT/api-contract)的版本。
  2. 不硬编码版本号:Go / Gin / 依赖版本一律现场查询官方源最新稳定版。
  3. 不跳过环境探测:生成前必须先检查用户环境,无法安装则给出明确提示。
  4. 不强制安装系统级数据库:若本机有 Docker,生成逻辑可自动拉起开发数据库容器(可选);否则提供 references/db-guide.md 中的 Docker 命令,由用户自行启动。
  5. 不替用户提交 git。
  6. 默认值必须安全:.env.example 对 JWT_SECRET / CORS / APP_DEBUG 有醒目警告,安全头中间件强制开启。
  7. 所有注释、文档用中文:目标用户是中文小白,不要英文注释。
  8. 接口契约必须和 frontend-request-skill 对齐:响应信封、错误码、字段命名前后端一致。
  9. .env 与 .gitignore 必须随脚手架一起生成,且 .env 中的配置必须被服务加载:config.go 通过 godotenv 读取 .env 全部配置,禁止在代码中硬编码端口、数据库密码、JWT 密钥等运行时可变参数。
  10. 密码与签名按场景选型:用户密码只存 bcrypt 哈希(cost 12)或 Argon2id,禁止 MD5 / SHA1 / SHA256 裸哈希与可逆加密;JWT 固定 HS256 验签(jwt.WithValidMethods([]string{"HS256"})),HS256 密钥不少于 32 字节,缺失或过短拒绝启动。细则见 crypto-scenario-skill。

触发关键词清单

Go 脚手架、Go 一键生成、初始化 Go 项目、Go 快速开始、
go init、搭建 Go 服务、Go Web 骨架、Go 开箱即用、
Go 零基础、Go 小白、帮我搭一个 Go、新建 Go、
create go project、go starter

相关技能

  • go-auth-module-skill:在生成的项目上叠加 RBAC + 组织架构模块(用户、角色、菜单、部门、岗位、租户、数据权限)
  • crypto-scenario-skill:加密算法按场景选型(密码哈希 / 支付验签 / JWT 签名 / 敏感字段)

不做

  • 不生成无契约规范的骨架(本 skill 包含完整契约层、SSE、上传、一键脚本、环境探测)
  • 不询问技术细节(Gin vs Echo、ORM 选择、目录结构等——全部自动选最佳实践)
  • 不安装系统级依赖(如 MySQL Server),只提供 Docker 启动命令
  • 不在 SKILL.md 锁定版本号
  • 不替用户提交 git
  • 不加未请求的中间件(如 Redis、Celery——除非用户明确说要)

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Go Gin Init Skill AI skill do?

Go 项目一键初始化技能。面向零基础小白,提供环境探测、自动安装、完整 Web 骨架生成、SSE 流式框架、JWT 鉴权、统一响应封装、文件上传接口、一键启动/重启脚本、Swagger 文档,内置 MySQL(默认)/ PostgreSQL 数据库选择。用户只需说"帮我搭一个 Go 项目"即可一条命令完成从零到跑的完整链路。触发词:"Go 脚手架"、"Go 一键生成"、"初始化 Go 项目"、"Go 快速开始"、"go init"、"搭建 Go 服务"、"Go Web 骨架"、"Go 开箱即用"、"Go 零基础"、"Go 小白"、"帮我搭一个 Go"、"新建 Go"、"create go project"、"go starter"。

Why use Go Gin Init Skill on TypingMind?

Because you install it once and use it with any model. Go Gin Init Skill is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Go Gin Init Skill in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/jiushiwon/wg-skills/tree/main/vibeCoding/backend/go/go-gin-init-skill. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Go Gin Init Skill?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Go Gin Init Skill?

As many as you like. As long as a model supports skills, you can use Go Gin Init Skill with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Go Gin Init Skill AI skill free?

Yes. It is published on GitHub by jiushiwon under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇