PickSkill
← Back

golang-best-practices

Comprehensive Go/Golang development best practices covering project structure, error handling, concurrency, testing, performance optimization, and code quality. Use this skill when writing Go code, refactoring Go projects, setting up new Go applications, implementing Go patterns, optimizing Go performance, or reviewing Go codebases. Triggers include Go file extensions (.go), mentions of goroutines/channels, Go modules, or requests for Go-specific guidance.

README.md
Rendered from GitHub raw
View raw ↗

Golang Best Practices & FX Skills 📚

Go Version License Last Updated

A comprehensive collection of Golang best practices and Uber FX dependency injection skills

English | 中文


中文

📖 简介

本技能包提供了一套完整的 Golang 开发最佳实践和 Uber FX 依赖注入框架的实战指南,适合从入门到高级的各个层次开发者。

🎯 包含内容

核心技能文档

文档 说明 难度 适用场景
SKILL.md Golang 最佳实践完整指南 ⭐⭐⭐ 所有 Go 项目
fx-basic-integration.md FX 依赖注入基础集成指南 ⭐⭐ 入门级 FX 项目
fx-advanced-guide.md FX 高级实战技能 ⭐⭐⭐⭐ 中大型企业项目
fx-simplified-architecture.md FX 简化架构实战(Handler 自管理路由) ⭐⭐⭐ MVP 快速开发

参考资料

🚀 快速开始

1. 克隆仓库

git clone https://github.com/difyz9/golang-best-practices.git
cd golang-best-practices

2. 选择适合你的技能文档

新手入门路线:

SKILL.md → fx-basic-integration.md → fx-simplified-architecture.md

进阶路线:

SKILL.md → fx-basic-integration.md → fx-advanced-guide.md → references/

快速开发路线:

fx-simplified-architecture.md (Handler 自管理模式)

📁 项目结构

golang-best-practices/
├── README.md                          # 本文件
├── SKILL.md                           # Golang 最佳实践核心文档
├── fx-basic-integration.md            # FX 基础集成指南
├── fx-advanced-guide.md               # FX 高级实战指南
├── fx-simplified-architecture.md      # FX 简化架构指南
├── references/                 # 详细参考资料
│   ├── fx-architecture.md
│   ├── patterns.md
│   ├── stdlib.md
│   └── tools.md
├── examples/                   # 代码示例(可选)
│   ├── basic-fx/
│   ├── advanced-fx/
│   └── simplified-fx/
└── .gitignore

💡 使用方式

方式 1: 作为学习资料

直接阅读 Markdown 文档,按照示例代码进行实践。

方式 2: 作为 Claude/Copilot Skill

将文档内容作为 AI 助手的技能包:

Claude Desktop:

{
  "mcpServers": {
    "golang-skills": {
      "command": "cat",
      "args": ["/path/to/golang-best-practices/SKILL.md"]
    }
  }
}

GitHub Copilot: 将仓库添加到 .claude/skills/.copilot/skills/ 目录。

方式 3: Git Submodule

在你的项目中作为子模块引用:

git submodule add https://github.com/difyz9/golang-best-practices.git docs/skills

🎓 学习路径建议

阶段 1: 基础 (1-2 周)

  • 阅读 SKILL.md 的项目结构、错误处理、并发章节
  • 学习 fx-basic-integration.md 的 FX 基础概念
  • 实践一个简单的 Gin + FX 项目

阶段 2: 进阶 (2-4 周)

  • 深入学习 fx-advanced-guide.md 的分层架构
  • 掌握 Handler/Service/Repository 三层设计
  • 实践路由模块化管理

阶段 3: 实战 (持续)

  • 参考 fx-simplified-architecture.md 实现快速迭代项目
  • 学习 references/ 中的设计模式
  • 优化现有项目架构

🔧 技术栈

🤝 贡献

欢迎提交 PR 改进文档!请遵循以下步骤:

  1. Fork 本仓库
  2. 创建特性分支 (git checkout -b feature/amazing-skill)
  3. 提交更改 (git commit -m 'Add some amazing skill')
  4. 推送到分支 (git push origin feature/amazing-skill)
  5. 创建 Pull Request

📜 许可证

本项目采用 Apache 2.0 许可证 - 详见 LICENSE 文件

🙏 致谢

  • 源码参考: yangjian102621/geekai
  • Uber FX 团队提供的优秀依赖注入框架
  • Go 社区的所有贡献者

📮 联系方式


English

📖 Introduction

This skill pack provides a comprehensive guide to Golang development best practices and Uber FX dependency injection framework, suitable for developers at all levels.

🎯 Contents

Core Skill Documents

Document Description Difficulty Use Case
SKILL.md Complete Golang Best Practices ⭐⭐⭐ All Go Projects
fx-basic-integration.md FX Basic Integration Guide ⭐⭐ Entry-level FX Projects
fx-advanced-guide.md FX Advanced Skills ⭐⭐⭐⭐ Enterprise Projects
fx-simplified-architecture.md FX Simplified Architecture (Self-Managed Routes) ⭐⭐⭐ MVP Fast Development

References

🚀 Quick Start

1. Clone Repository

git clone https://github.com/difyz9/golang-best-practices.git
cd golang-best-practices

2. Choose Your Learning Path

Beginner Path:

SKILL.md → fx-basic-integration.md → fx-simplified-architecture.md

Advanced Path:

SKILL.md → fx-basic-integration.md → fx-advanced-guide.md → references/

Fast Development Path:

fx-simplified-architecture.md (Handler Self-Managed Pattern)

💡 Usage

Method 1: Learning Material

Read Markdown documents directly and practice with example code.

Method 2: As Claude/Copilot Skill

Use documents as AI assistant skill pack.

Method 3: Git Submodule

Reference as submodule in your project:

git submodule add https://github.com/difyz9/golang-best-practices.git docs/skills

📜 License

Apache 2.0 License - see LICENSE file

🙏 Acknowledgments