alex123098/my-dotfiles/go-style
Claude Code and agent skill by alex123098/my-dotfiles
- community
Checking that the SKILL.md file is still in the repository.
Go code style, naming conventions, struct/interface design, and project layout. Use when writing or reviewing Go code to ensure idiomatic formatting, naming, type design, and directory organization.
Install
npx vskill@latest install alex123098/my-dotfiles/go-styleSKILL.md
When to Use
Use when writing, reviewing, or refactoring Go code. Covers formatting conventions, identifier naming (MixedCaps, acronyms, stutter avoidance), struct/interface design (small interfaces, composition, "accept interfaces return structs"), and project layout (cmd/, internal/, pkg/ conventions). Not for error handling patterns or concurrency design.
Procedure
- Naming: Use MixedCaps (not snake_case, not ALL_CAPS). Package names are lowercase, singular, no stutter (
http.Clientnothttp.HTTPClient). Exported = UpperCamelCase, unexported = lowerCamelCase. Acronyms: all caps or all lower (HTTPServer,urlParser). Boolean fields useis/has/canprefix (isReady), getters keep the prefix (IsReady()). Error vars:Errprefix. Error types:Errorsuffix. Constructors:New()for single-type packages,NewTypeName()for multi-type. Enum iota 0 = Unknown sentinel. Error strings: fully lowercase including acronyms, no trailing punctuation. - Code Style: No rigid line limit, break at ~120+ at semantic boundaries. Function calls with 4+ args use one-per-line. Use
:=for non-zero values,varfor zero-value init. Always initialize slices and maps (never nil). Use early return for errors/edge cases — keep happy path flat. Dropelsewhenifbody has return/break/continue. Extract complex conditions into named booleans. Preferswitchover long if-else chains. Functions should be short, focused, ≤4 params — use options struct beyond that. Parameter order: ctx first, inputs, output destinations. - Struct/Interface Design: Keep interfaces small (1-3 methods). Compose small interfaces into larger ones via embedding. 'Accept interfaces, return structs' — consumers define interfaces where they need them. Prefer pointer receivers for methods that mutate and when nil is meaningful; value receivers for small, immutable types. Use field names in composite literals ([
srv := &http.Server{Addr: ":8080"}]). Implement compile-time interface checks withvar _ Interface = (*Type)(nil). - Project Layout: All
mainpackages incmd/{name}with minimal logic (parse flags, wire, callRun()). Business logic ininternal/(private) orpkg/(only if external consumers). Flat structure for small projects; layers only when justified. Follow 12-Factor App for services: config via env vars, logs to stdout, stateless processes. Module name matches repo URL (github.com/user/repo), lowercase with hyphens.
Pitfalls
- Don't stutter — package name is already at call site (
json.Decodernotjson.JSONDecoder). - Don't use
Getprefix on getters (user.Name()notuser.GetName()). - Don't use plural package names (
urlnoturls). - Don't over-structure small projects — a 100-line CLI doesn't need layers.
- Don't store context in structs — pass explicitly as first parameter.
Verification
- Running
gofmt -s -w .passes cleanly. go vet ./...produces no output.- All exported names are intentionally exported (not accidental via UpperCamelCase).
- Package names are singular and lowercased.
- No
Getprefix on getter methods.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpi/.pi/agent/skills/go-style/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alex123098/my-dotfiles/go-style)