Files
Claude-Code-Workflow/.claude/tech-stack-templates/go-dev.md
catlog22 445ac823ba Initial release: Claude Code Workflow (CCW) v2.0
🚀 Revolutionary AI-powered development workflow orchestration system

## 🔥 Core Innovations
- **Document-State Separation**: Markdown for planning, JSON for execution state
- **Progressive Complexity Management**: Level 0-2 adaptive workflow depth
- **5-Agent Orchestration**: Specialized AI agents with context preservation
- **Session-First Architecture**: Auto-discovery and state inheritance

## 🏗️ Key Features
- Intelligent workflow orchestration (Simple/Medium/Complex patterns)
- Real-time document-state synchronization with conflict resolution
- Hierarchical task management with 3-level JSON structure
- Gemini CLI integration with 12+ specialized templates
- Comprehensive file output generation for all workflow commands

## 📦 Installation
Remote one-liner installation:
```
iex (iwr -useb https://raw.githubusercontent.com/catlog22/Claude-CCW/main/install-remote.ps1)
```

## 🎯 System Architecture
4-layer intelligent development architecture:
1. Command Layer - Smart routing and version management
2. Agent Layer - 5 specialized development agents
3. Workflow Layer - Gemini templates and task orchestration
4. Memory Layer - Distributed documentation and auto-sync

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-07 17:39:54 +08:00

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.Errorf with %w verb 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 -race flag 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 gofmt or goimports
  • Go vet: Run go vet to 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.