mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
- Move planning-templates to .claude/workflows/cli-templates/planning-roles/ - Move tech-stack-templates to .claude/workflows/cli-templates/tech-stacks/ - Update tools-implementation-guide.md with comprehensive template documentation - Add planning role templates section with 10 specialized roles - Add tech stack templates section with 6 technology-specific templates - Simplify template quick reference map with consolidated base path structure 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3.2 KiB
3.2 KiB
name, description
| name | description |
|---|---|
| go-dev | Go core development principles for clean, efficient, and idiomatic code |
Go Development Guidelines
You are now operating under Go core development principles. Focus on essential Go idioms and practices without dictating project structure.
Core Go Principles
Essential Language Guidelines
- Simplicity: Write simple, readable code over clever solutions
- Naming: Use clear, descriptive names following Go conventions
- Error Handling: Handle errors explicitly, don't ignore them
- Interfaces: Keep interfaces small and focused
// Core principle: Clear error handling
func GetUser(id string) (*User, error) {
if id == "" {
return nil, errors.New("user ID cannot be empty")
}
user, err := database.FindUser(id)
if err != nil {
return nil, fmt.Errorf("failed to get user %s: %w", id, err)
}
return user, nil
}
// Core principle: Small, focused interfaces
type UserReader interface {
GetUser(id string) (*User, error)
}
Idiomatic Go Patterns
- Zero Values: Design types to be useful in their zero state
- Receiver Types: Use pointer receivers for methods that modify the receiver
- Package Names: Use short, clear package names without underscores
- Goroutines: Use goroutines and channels for concurrent operations
Essential Error Handling
- Explicit Errors: Always handle errors explicitly
- Error Wrapping: Use
fmt.Errorfwith%wverb to wrap errors - Custom Errors: Create specific error types when appropriate
- Early Returns: Use early returns to avoid deep nesting
// Core principle: Error wrapping and context
func ProcessUserData(userID string) error {
user, err := GetUser(userID)
if err != nil {
return fmt.Errorf("processing user data: %w", err)
}
if err := validateUser(user); err != nil {
return fmt.Errorf("user validation failed: %w", err)
}
return nil
}
Concurrency Guidelines
- Channel Communication: Use channels to communicate between goroutines
- Context: Use context.Context for cancellation and timeouts
- Worker Pools: Implement worker pools for bounded concurrency
- Race Detection: Run tests with
-raceflag regularly
Testing Essentials
- Table-Driven Tests: Use table-driven tests for multiple test cases
- Test Names: Use descriptive test function names
- Mocking: Use interfaces for dependency injection and mocking
- Benchmarks: Write benchmarks for performance-critical code
Performance Guidelines
- Profiling: Use Go's built-in profiling tools
- Memory Management: Understand Go's garbage collector behavior
- Slice/Map Operations: Be aware of capacity vs length for slices
- String Operations: Use strings.Builder for efficient string concatenation
Code Quality Essentials
- Go fmt: Always format code with
gofmtorgoimports - Go vet: Run
go vetto catch common mistakes - Linting: Use golangci-lint for comprehensive code analysis
- Documentation: Write clear package and function documentation
Apply these core Go principles to write clean, efficient, and maintainable Go code following language idioms and best practices.