Token导航 LogoToken导航TokenDH.com
开发规范需要联网github未标认证来源可访问许可证需确认审计通过

go-dev-guidelinesGo 开发指南

Agent Skill

go-dev-guidelines 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

336

周安装

14

GitHub Stars

261

下载量

112
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:go-dev-guidelines(Go 开发指南)
来源仓库:https://github.com/jumppad-labs/jumppad
仓库路径:skills/go-dev-guidelines
安装命令:
npx skills add https://github.com/jumppad-labs/jumppad --skill go-dev-guidelines
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/jumppad-labs/jumppad --skill go-dev-guidelines

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 可结合来源仓库、安装命令和原始 README 核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 注意该技能归类为开发规范,但当前描述未体现具体规范内容。

SKILL.md

Go Development Guidelines

Overview

This skill provides comprehensive guidelines for idiomatic Go development with a Test-Driven Development (TDD) approach. Follow these patterns when writing Go code, creating tests, organizing projects, or refactoring existing code.

Quick Start Checklists

New Go Feature Checklist

When implementing a new feature in an existing Go project:

  1. Define interface - Create small, focused interface in appropriate package
  2. Write tests first - Create *_test.go file with testify/require tests
  3. Generate mocks - Use mockery to generate mocks in mocks/ subfolder
  4. Implement logic - Write the implementation to satisfy tests
  5. Handle errors - Ensure all errors are explicitly handled
  6. Add integration tests - Test the feature end-to-end if applicable
  7. Run go vet & gofmt - Ensure code meets Go standards
  8. Update documentation - Add godoc comments for exported types/functions

New Go Service/Package Checklist

When creating a new Go service or package from scratch:

  1. Setup project structure - Use standard Go layout (/cmd, /internal, /pkg)
  2. Initialize module - Run go mod init with appropriate module path
  3. Define core interfaces - Start with small, focused interfaces
  4. Write tests first - Follow TDD approach for all business logic
  5. Implement with DI - Use dependency injection for testability
  6. Add logging - Include structured logging for observability
  7. Configure graceful shutdown - Implement proper cleanup for services
  8. Document package - Add package-level godoc and README

Core Principles

Follow these seven core principles for all Go development:

1. Follow Test-Driven Development (TDD)

Write tests before implementation. Tests should be easy to read and favor verbosity over abstraction.

2. Use testify/require for Unit Tests

All unit tests must use github.com/stretchr/testify/require for assertions.

3. Use Mockery for Mocks

Generate mocks using mockery. Mocks must be localized in a mocks/ subfolder next to the interface being mocked.

4. Never Use Table-Driven Tests

Avoid table-driven tests. Write explicit test functions for each scenario.

5. Never Mix Positive and Negative Tests

Keep positive (success) and negative (error) test cases in separate test functions.

6. Handle All Errors Explicitly

Never ignore errors. Always handle them explicitly or return them to the caller.

7. Prefer Small, Focused Interfaces

Design interfaces with few methods. Use composition over large interfaces.

8. Use any Instead of interface{}

For generic types, prefer any over interface{} (Go 1.18+).

Standard Go Directory Structure

project-root/
├── cmd/                  # Main applications
│   └── myapp/
│       └── main.go
├── internal/             # Private application code
│   ├── handler/          # HTTP handlers
│   │   ├── handler.go
│   │   ├── handler_test.go
│   │   └── mocks/        # Mocks for handler interfaces
│   ├── service/          # Business logic
│   │   ├── service.go
│   │   ├── service_test.go
│   │   └── mocks/
│   └── repository/       # Data access
│       ├── repository.go
│       ├── repository_test.go
│       └── mocks/
├── pkg/                  # Public library code
│   └── client/
│       ├── client.go
│       ├── client_test.go
│       └── mocks/
├── api/                  # API definitions (OpenAPI, protobuf)
├── configs/              # Configuration files
├── go.mod
├── go.sum
└── README.md

Quick Reference

Common Test Patterns

// Unit test with mock
func TestServiceCreate(t *testing.T) {
    mockRepo := mocks.NewRepository(t)
    mockRepo.On("Save", mock.Anything).Return(nil)

    svc := NewService(mockRepo)
    err := svc.Create(context.Background(), data)

    require.NoError(t, err)
    mockRepo.AssertExpectations(t)
}

// Separate negative test
func TestServiceCreate_RepoError(t *testing.T) {
    mockRepo := mocks.NewRepository(t)
    mockRepo.On("Save", mock.Anything).Return(errors.New("db error"))

    svc := NewService(mockRepo)
    err := svc.Create(context.Background(), data)

    require.Error(t, err)
    require.Contains(t, err.Error(), "db error")
}

Naming Conventions

  • Packages: Short, lowercase, no underscores (handler, service)
  • Files: Lowercase with underscores (user_service.go, user_service_test.go)
  • Types: PascalCase (UserService, HTTPHandler)
  • Functions/Methods: PascalCase for exported, camelCase for unexported
  • Interfaces: Often end with -er suffix (Reader, Writer, UserRepository)

Navigation Table

Use this table to find detailed guidance for specific tasks:

If You Need To...See This Resource
Set up a new Go project structureProject Structure
Understand Go naming conventionsNaming Conventions
Write tests with TDD, testify/require, and mockeryTesting Guide
Organize packages, interfaces, and dependenciesCode Organization
Handle errors idiomaticallyError Handling
Work with goroutines, channels, and contextConcurrency Patterns
Manage dependencies and go.modDependencies
See complete working examplesComplete Examples

Resources

This skill includes detailed reference documentation in the references/ directory. Claude will load these resources as needed when working on specific tasks.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.6%
按下载量换算37

Claude

33.19%
按下载量换算37

Cursor

20.36%
按下载量换算23

Gemini CLI

10.15%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills