internal/skills/content/go-guide/SKILL.md
Go language guardrails, patterns, and best practices for AI-assisted development. Use when working with Go files (.go), go.mod, or when the user mentions Go/Golang. Provides project structure conventions, error handling patterns, testing standards, and concurrency guidelines specific to this project's coding standards.
npx skillsauth add ar4mirez/samuel go-guideInstall 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.
Applies to: Go 1.21+, Microservices, APIs, CLIs
go.mod)go mod tidy before committinggo.modgofmt / goimports before every commitgo vet and golangci-lint before committinguserservice not user_service)PascalCase | Unexported: camelCaseif err != nil { return err }fmt.Errorf("fetch user: %w", err)_ unless justified with commentcontext.Context for cancellation and timeoutssync.WaitGroup for goroutine coordinationselect with default to avoid blockingio.Reader, io.Writer from stdlib when applicablemyproject/
├── cmd/ # Main applications
│ └── api/
│ └── main.go # Entry point
├── internal/ # Private application code
│ ├── domain/ # Business logic
│ ├── service/ # Application services
│ ├── repository/ # Data access
│ └── http/ # HTTP handlers
├── pkg/ # Public libraries (reusable)
├── api/ # OpenAPI/Protobuf specs
├── go.mod
├── go.sum
└── README.md
internal/ for private code (not importable by other projects)pkg/ only for truly reusable librariescmd/ for executables (one per subdirectory)func GetUser(id string) (*User, error) {
user, err := db.FindUserByID(id)
if err != nil {
return nil, fmt.Errorf("get user %s: %w", id, err)
}
return user, nil
}
type NotFoundError struct {
Resource string
ID string
}
func (e *NotFoundError) Error() string {
return fmt.Sprintf("%s with ID %s not found", e.Resource, e.ID)
}
// Check with errors.As
var notFound *NotFoundError
if errors.As(err, ¬Found) {
// Handle not found
}
*_test.go (same package)func TestFunctionName(t *testing.T)t.Helper() in test helperst.Run("name", func(t *testing.T) {...})func BenchmarkFunction(b *testing.B)func TestCalculate(t *testing.T) {
tests := []struct {
name string
a, b int
expected int
wantErr bool
}{
{"positive numbers", 2, 3, 5, false},
{"negative numbers", -2, -3, -5, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := Calculate(tt.a, tt.b)
if tt.wantErr {
if err == nil {
t.Error("expected error, got nil")
}
return
}
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if result != tt.expected {
t.Errorf("got %d, want %d", result, tt.expected)
}
})
}
}
go fmt ./... # Format code
go vet ./... # Detect suspicious constructs
go test ./... # Run all tests
go test -cover ./... # With coverage
go test -race ./... # Race detector
go build ./cmd/api # Build
go mod tidy # Clean dependencies
golangci-lint run # Comprehensive lint
# .golangci.yml
linters:
enable:
- gofmt
- govet
- staticcheck
- ineffassign
- misspell
- gosec # Security
- errcheck # Unchecked errors
- gocyclo # Cyclomatic complexity
- dupl # Code duplication
linters-settings:
gocyclo:
min-complexity: 10
dupl:
threshold: 100
For detailed patterns and examples, see:
development
Zig language guardrails, patterns, and best practices for AI-assisted development. Use when working with Zig files (.zig), build.zig, or when the user mentions Zig. Provides comptime patterns, allocator conventions, C interop guidelines, and testing standards specific to this project's coding standards.
tools
WordPress framework guardrails, patterns, and best practices for AI-assisted development. Use when working with WordPress projects, or when the user mentions WordPress. Provides theme development, plugin architecture, REST API, blocks, and security guidelines.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs. Use when testing web apps, automating browser interactions, or debugging frontend issues.
tools
Suite of tools for creating elaborate, multi-component web applications using modern frontend technologies (React, Tailwind CSS, shadcn/ui). Use for complex projects requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX pages.