go-style-guide
БесплатноБез исполняемых скриптовНе проверенReview Go code for adherence to Go Style Guide. Use when the user requests a code review of completed work, pull requests, or feature branches in Go projects…
Об этом скилле
Go Style Guide Reviewer
Review Go code against comprehensive style guide, focusing on critical bugs and important maintainability issues.
This guide assumes Go 1.25+ and does not consider backwards compatibility. All patterns use modern Go best practices.
Reference Files
Load references based on code patterns found during review:
| Code Pattern | Reference File |
|---|---|
go func(), sync.Mutex, sync., channels, atomic |
references/concurrency.md |
err, error, panic, Must functions |
references/errors.md |
interface, embedding, receivers, func New, init() |
references/api-design.md |
slice/map return, slices.Clone, maps.Clone |
references/api-design.md |
_test.go, t., b. |
references/testing.md |
| naming, comments, logging | references/style.md |
Quick reference: references/review-checklist.md - critical patterns with code examples
Note: "Copying at boundaries" lives in api-design.md but relates to concurrency safety - check both when ownership/encapsulation is the concern.
Quick Style Reference
Basic rules that don't need a file lookup:
- Package names: lowercase, no underscores, singular (
net/urlnotnet/urls) - Receiver names: 1-2 letters, consistent across all methods (
func (c *Client) Connect()) - Error strings: lowercase, no punctuation (
errors.New("connection failed")) - Variable names: short for small scopes (
i,v), longer for large scopes (requestTimeout)
Review Process
Follow this 3-phase workflow for systematic code review:
Phase 1: Scope Identification
Determine what code to review based on the user's request:
Pull Request / Branch Review:
# Get all changed files in branch
git diff --name-only main...HEAD | grep '\.go$'
# Get diff with context
git diff main...HEAD
Specific Files:
# User specifies file(s) directly
# Read the files using the Read tool
Recent Work:
# Review recent commits
git log --oneline -n 10
git diff HEAD~5..HEAD
Output: List of Go files and changes to review.
Phase 2: Code Analysis
Review the code systematically using the bundled references:
Start with critical issues (load
references/review-checklist.mdfor quick patterns):- Unhandled errors
- Type assertions without check
- Panics in production code
- Fire-and-forget goroutines
- Mutex races and missing defers
- Nil pointer dereferences
Check important patterns:
- Error handling (wrapping, naming, handling once)
- Boundary safety (copying slices/maps)
- Struct design (embedding, initialization)
- Concurrency lifecycle (goroutine management)
- Exit handling (os.Exit only in main)
Consult topic files as needed (see Reference Files table above):
- For detailed explanations of specific patterns
- When encountering unfamiliar idioms
- To verify best practices for specific scenarios
Grep patterns for architectural issues:
# Find panic usage (context-dependent - init/main vs library)
rg 'panic\(' --type go
# Find goroutine launches (check lifecycle management)
rg '\bgo\s+' --type go
# Find os.Exit or log.Fatal (should only be in main)
rg '(os\.Exit|log\.Fatal)' --type go
# Find global var declarations (check for mutable state)
rg '^var\s+\w+\s*=' --type go
Phase 3: Report Findings
Structure the review with Critical and Important issues only (skip Minor issues per user preference).
Format:
## Code Review Summary
[1-2 sentence overview of code quality and adherence]
**Note**: This review focuses on architectural and semantic issues that require human judgment. For syntax, formatting, and common bugs (unhandled errors, type assertions, etc.), ensure `golangci-lint` is run separately.
## Critical Issues
[Issues that could cause bugs, panics, or data races - MUST fix]
### [Issue Title]
**Location**: `file.go:123` or `functionName()`
**Severity**: Critical
**Current Code**:
```go
[problematic code snippet]
Issue: [What's wrong and why it's critical]
Recommended:
[corrected code]
Guideline: [Reference to style guide section, e.g., "Error Handling > Type Assertions"]
Important Issues
[Issues affecting maintainability, performance, or style - Should fix]
[Use same format as Critical Issues]
Positive Observations
[Acknowledge good practices: proper error wrapping, clean concurrency patterns, good test structure]
Recommendations
- [Prioritized action items]
- [Suggest running golangci-lint skill if not already done]
## Optional: Automated Linting Integration
Before or after manual review, suggest running automated linters for complementary coverage:
**If golangci-lint skill is available**:
"Consider running the `golangci-lint` skill for automated static analysis. Say 'run golangci-lint' to execute."
**Manual linting**:
```bash
# Run staticc
Установить go-style-guide в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл go-style-guide?
Review Go code for adherence to Go Style Guide. Use when the user requests a code review of completed work, pull requests, or feature branches in Go projects. Focuses on critical bugs, race conditions, and important maintainability issues. Trigger phrases include "review this Go code", "check against style guide", "review my PR", or "review the work done so far".
Как установить скилл go-style-guide?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл go-style-guide запускает скрипты?
Нет, скилл состоит только из инструкций (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