xiaohongshu
xiaohongshu
golang-expert
Expert Go/Golang development guidance enforcing best practices, functional programming principles, KISS, DRY, and idiomatic patterns. Use when: (1) Writing new Go code, (2) Reviewing Go code for quality issues, (3) Refactoring Go code, (4) Designing Go architecture with interfaces and DI, (5) Wri...
Full skill instructions
Expert guidance for writing clean, idiomatic, maintainable Go code.
// BAD - over-engineered
type ProcessorFactory interface {
CreateProcessor(config Config) Processor
}
// GOOD - direct and simple
func Process(data []byte) (Result, error) {
// Direct implementation
}
// BAD - duplicated logic
func ParseUserDate(s string) time.Time { /*...*/ }
func ParseOrderDate(s string) time.Time { /*...*/ } // Same code!
// GOOD - single source of truth
func ParseDate(s string) (time.Time, error) {
return time.Parse(time.RFC3339, s)
}
const when possible// BAD - global state
var logger *Logger
func SetLogger(l *Logger) { logger = l }
// GOOD - dependency injection
type Service struct {
logger Logger
}
func NewService(logger Logger) *Service {
return &Service{logger: logger}
}
// Small, focused interfaces (Interface Segregation)
type Reader interface { Read(p []byte) (n int, err error) }
type Writer interface { Write(p []byte) (n int, err error) }
// Compose when needed
type ReadWriter interface {
Reader
Writer
}
// Accept interfaces, return structs
func Process(r Reader) *Result { /*...*/ }
// Wrap errors with context
if err != nil {
return fmt.Errorf("process user %d: %w", id, err)
}
// Sentinel errors for expected conditions
var ErrNotFound = errors.New("not found")
// Check with errors.Is/As
if errors.Is(err, ErrNotFound) { /*...*/ }
func TestParse(t *testing.T) {
tests := []struct {
name string
input string
want Result
wantErr bool
}{
{"valid input", "abc", Result{Value: "abc"}, false},
{"empty input", "", Result{}, true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Parse(tt.input)
if (err != nil) != tt.wantErr {
t.Errorf("Parse() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("Parse() = %v, want %v", got, tt.want)
}
})
}
}
// Always use context for cancellation
func Process(ctx context.Context) error {
select {
case <-ctx.Done():
return ctx.Err()
case result := <-work():
return handle(result)
}
}
// Use errgroup for parallel work
g, ctx := errgroup.WithContext(ctx)
for _, item := range items {
item := item // capture loop variable
g.Go(func() error { return process(ctx, item) })
}
return g.Wait()
Load these references as needed:
| Topic | File | When to Use |
|---|---|---|
| Functional Patterns | functional-patterns.md | DI, immutability, pure functions |
| KISS & DRY | kiss-dry.md | Simplification, code deduplication |
| Interface Design | interface-design.md | API design, interface segregation |
| Testing | testing.md | Tests, mocks, benchmarks |
| Error Handling | error-handling.md | Error patterns, wrapping, types |
| Concurrency | concurrency.md | Goroutines, channels, sync |
| Performance | performance.md | Profiling, optimization |
| Code Review | code-review-checklist.md | Review checklist |
When reviewing Go code:
When refactoring:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience