go-quality
БесплатноБез исполняемых скриптовНе проверенGo code quality with golangci-lint, staticcheck, and go vet. Covers linting, formatting, and best practices. USE WHEN: user works with "Go", "Golang", "Gin"…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Go Quality - Quick Reference
When NOT to Use This Skill
- SonarQube setup - Use
sonarqubeskill - Security scanning - Use
go-securityskill - Testing - Use Go testing skills
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:gofor comprehensive documentation.
Tool Overview
| Tool | Focus | Included In |
|---|---|---|
| go fmt | Formatting | Go toolchain |
| go vet | Bug detection | Go toolchain |
| staticcheck | Advanced analysis | golangci-lint |
| golangci-lint | Meta-linter | Standalone |
| gofumpt | Stricter formatting | golangci-lint |
Recommendation: Use golangci-lint - it runs 100+ linters in parallel.
golangci-lint Setup
Installation
# Binary installation (recommended)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.0
# Go install
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# macOS
brew install golangci-lint
.golangci.yml
run:
timeout: 5m
tests: true
go: "1.22"
linters:
enable:
# Bugs
- bodyclose
- durationcheck
- errcheck
- exportloopref
- gosec
- nilerr
- sqlclosecheck
# Performance
- prealloc
# Style
- gofumpt
- goimports
- misspell
# Complexity
- cyclop
- gocognit
- gocyclo
- funlen
- nestif
# Best Practices
- goconst
- gocritic
- godot
- ineffassign
- revive
- staticcheck
- unconvert
- unparam
- unused
linters-settings:
cyclop:
max-complexity: 10
gocognit:
min-complexity: 15
gocyclo:
min-complexity: 10
funlen:
lines: 60
statements: 40
nestif:
min-complexity: 4
goconst:
min-len: 3
min-occurrences: 3
gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks:
- hugeParam
revive:
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-naming
- name: error-return
- name: error-strings
- name: exported
- name: increment-decrement
- name: indent-error-flow
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: var-declaration
- name: var-naming
issues:
exclude-rules:
# Exclude some linters from tests
- path: _test\.go
linters:
- funlen
- gocognit
# Exclude generated files
- path: \.pb\.go
linters:
- all
max-same-issues: 0
max-issues-per-linter: 0
Commands
# Run all linters
golangci-lint run
# Run on specific path
golangci-lint run ./pkg/...
# Fix auto-fixable issues
golangci-lint run --fix
# Show enabled linters
golangci-lint linters
# Run specific linter
golangci-lint run --enable=gosec --disable-all
# Verbose output
golangci-lint run -v
Built-in Go Tools
go fmt / gofmt
# Format file
go fmt ./...
# Check without changing
gofmt -l .
# Simplify code
gofmt -s -w .
go vet
# Run vet
go vet ./...
# Specific checks
go vet -printf ./...
gofumpt (Stricter Formatting)
# Install
go install mvdan.cc/gofumpt@latest
# Format
gofumpt -w .
Common Linter Errors
errcheck - Unhandled Errors
// BAD - Error ignored
file, _ := os.Open("file.txt")
// GOOD - Error handled
file, err := os.Open("file.txt")
if err != nil {
return fmt.Errorf("failed to open file: %w", err)
}
defer file.Close()
bodyclose - Unclosed Response Body
// BAD - Body not closed
resp, err := http.Get(url)
if err != nil {
return err
}
data, _ := io.ReadAll(resp.Body)
// GOOD - Body closed
resp, err := http.Get(url)
if err != nil {
return err
}
defer resp.Body.Close()
data, err := io.ReadAll(resp.Body)
gosec - Security Issues
// BAD - Hardcoded credentials (G101)
const password = "secret123"
// GOOD - Environment variable
password := os.Getenv("DB_PASSWORD")
if password == "" {
return errors.New("DB_PASSWORD not set")
}
ineffassign - Ineffective Assignment
// BAD - Assignment overwritten
x := 5
x = 10 // Previous value never used
// GOOD - Remove or use
x := 10
cyclop/gocyclo - High Complexity
// BAD - Complex function
func process(data Data) error {
if data.Type == "A" {
if data.Status == "active" {
if data.Value > 0 {
// deep nesting
}
}
}
// ... many more conditions
}
// GOOD - Extract and simplify
func process(data Data) error {
if !data.isValid() {
return ErrInvalidData
}
switch data.Type {
case "A":
return processTypeA(data)
case "B":
return processTypeB(data)
default:
return ErrUnknown
Установить go-quality в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobBashFAQ
Что делает скилл go-quality?
Go code quality with golangci-lint, staticcheck, and go vet. Covers linting, formatting, and best practices. USE WHEN: user works with "Go", "Golang", "Gin", "Fiber", "Echo", asks about "golangci-lint", "staticcheck", "go vet", "Go linting", "Go best practices" DO NOT USE FOR: SonarQube - use `sonarqube` skill, testing - use Go test skills, security - use `go-security` skill
Как установить скилл go-quality?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл go-quality запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic