go-best-practices
Installation
SKILL.md
Go Best Practices
Guides layout design, package structures, and code reviews.
Core Rules
- Architecture: Do not use a
pkg/directory. Keep package structures flat unless complexity requires nested packages. Put private logic ininternal/and entrypoints incmd/. - Style: Read
references/style_cheatsheet.mdbefore editing. Usereferences/senior_review_checklist.mdfor reviews. Prefer Go generics ([T any]) tointerface{}. - Concurrency: Every goroutine needs a defined exit trigger via context or wait group. Use
errgroupfor parallel operations.
Work Processes
1. Audit and Analysis
- Check the file layout. Suggest moving files out of
pkg/if present. - Review code structure against
style_cheatsheet.md. - Verify that errors are handled, contexts are passed first, and mutexes are not copied.