.claude/skills/go-dev-guidelines/SKILL.md
This skill should be used when writing, refactoring, or testing Go code. It provides idiomatic Go development patterns, TDD-based workflows, project structure conventions, and testing best practices using testify/require and mockery. Activate this skill when creating new Go features, services, packages, tests, or when setting up new Go projects.
npx skillsauth add jumppad-labs/jumppad go-dev-guidelinesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
When implementing a new feature in an existing Go project:
*_test.go file with testify/require testsmocks/ subfolderWhen creating a new Go service or package from scratch:
/cmd, /internal, /pkg)go mod init with appropriate module pathFollow these seven core principles for all Go development:
Write tests before implementation. Tests should be easy to read and favor verbosity over abstraction.
All unit tests must use github.com/stretchr/testify/require for assertions.
Generate mocks using mockery. Mocks must be localized in a mocks/ subfolder next to the interface being mocked.
Avoid table-driven tests. Write explicit test functions for each scenario.
Keep positive (success) and negative (error) test cases in separate test functions.
Never ignore errors. Always handle them explicitly or return them to the caller.
Design interfaces with few methods. Use composition over large interfaces.
any Instead of interface{}For generic types, prefer any over interface{} (Go 1.18+).
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
// 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")
}
handler, service)user_service.go, user_service_test.go)UserService, HTTPHandler)-er suffix (Reader, Writer, UserRepository)Use this table to find detailed guidance for specific tasks:
| If You Need To... | See This Resource | |-------------------|-------------------| | Set up a new Go project structure | Project Structure | | Understand Go naming conventions | Naming Conventions | | Write tests with TDD, testify/require, and mockery | Testing Guide | | Organize packages, interfaces, and dependencies | Code Organization | | Handle errors idiomatically | Error Handling | | Work with goroutines, channels, and context | Concurrency Patterns | | Manage dependencies and go.mod | Dependencies | | See complete working examples | Complete Examples |
This skill includes detailed reference documentation in the references/ directory. Claude will load these resources as needed when working on specific tasks.
tools
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.
development
Create detailed implementation plans through an interactive process with research, code snippets, and structured deliverables. Use this skill when planning significant features, refactoring tasks, or complex implementations that require thorough analysis and structured documentation. The skill guides through context gathering, research, design decisions, and generates comprehensive plans with test strategies and success criteria.
development
Load comprehensive GitHub issue information including title, description, comments, labels, assignees, milestones, and related items (linked PRs and cross-references). This skill should be used when planning to fix an issue, when detailed issue context is needed for implementation work, or when a plan command needs to understand the full scope of an issue.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.