بنقرة واحدة
go-code
Go code quality standards, idioms, and YAGNI/KISS development principles.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Go code quality standards, idioms, and YAGNI/KISS development principles.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Fetch PR review comments, triage against codebase, apply fixes, generate reply report.
Verify answers by checking sources, contradictions, and confidence level.
Run, discover, or review Makefile targets. Use for build automation.
Extract readable web content, removing navigation/ads to save tokens.
Fetch Jira tickets as clean markdown using native ADF format.
5-element persona framework template for creating Claude Code agents
استنادا إلى تصنيف SOC المهني
| name | go-code |
| description | Go code quality standards, idioms, and YAGNI/KISS development principles. |
| argument-hint | |
| allowed-tools | |
| model | haiku |
go fmt after changes, use goimportsUserService, GetUser, ErrNotFoundHTTP, ID, URLRequirements:
%w for context: fmt.Errorf("operation failed: %w", err)var ErrNotFound = errors.New("not found")errors.Is() / errors.As()func (s *Service) GetUser(ctx context.Context, id int) (*User, error) {
user, err := s.repo.FindByID(ctx, id)
if err != nil {
return nil, fmt.Errorf("failed to get user: %w", err)
}
return user, nil
}
ctx context.Contextpackage user with Service, Repository, Handlerpackage services with all servicestests := []struct {
name string
a, b int
want int
}{
{"positive", 1, 2, 3},
{"negative", -1, -2, -3},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := Add(tt.a, tt.b)
if got != tt.want {
t.Errorf("Add(%d, %d) = %d; want %d", tt.a, tt.b, got, tt.want)
}
})
}
| Pattern | Example | Fix |
|---|---|---|
| Global State | var defaultX = ... | Immutable init() only |
| Naked Goroutines | go func(){}() | Context cancellation |
| Ignored Errors | result, _ := op() | Handle or document |
| Defer in Loops | defer in for | Manual cleanup |
| String Concat | s += s2 in loops | strings.Builder |
| Large Interfaces | >3 methods | Split or rethink |
| Over-engineering | Factory for simple constructor | Direct New() |
sync.Pool: Use for hot paths; always Reset() before Put().
Zero-alloc: Pre-allocate slices (make([]T, 0, cap)), use strings.Builder, prefer []byte.
Profile: go test -cpuprofile=cpu.prof -bench=. → go tool pprof → optimize → repeat.
type Server struct {
host string
port int
timeout time.Duration
}
type Option func(*Server)
func WithPort(port int) Option {
return func(s *Server) { s.port = port }
}
func NewServer(opts ...Option) *Server {
s := &Server{
host: "localhost",
port: 8080,
timeout: 30 * time.Second,
}
for _, opt := range opts {
opt(s)
}
return s
}
// Usage
srv := NewServer(WithPort(3000))