go-skills
π―Skillfrom llama-farm/llamafarm
Enforces Go best practices and idiomatic patterns for secure, maintainable LlamaFarm CLI development.
Installation
npx skills add https://github.com/llama-farm/llamafarm --skill go-skillsSkill Details
Shared Go best practices for LlamaFarm CLI. Covers idiomatic patterns, error handling, and testing.
Overview
# Go Skills for LlamaFarm CLI
Shared Go best practices for LlamaFarm CLI development. These guidelines ensure idiomatic, maintainable, and secure Go code.
Tech Stack
- Go 1.24+
- Cobra (CLI framework)
- Bubbletea (TUI framework)
- Lipgloss (terminal styling)
Directory Structure
```
cli/
cmd/ # Command implementations
config/ # Configuration types and loading
orchestrator/ # Service management
utils/ # Shared utilities
version/ # Version and upgrade handling
internal/ # Internal packages
tui/ # TUI components
buildinfo/ # Build information
```
Quick Reference
Error Handling
- Always wrap errors with context:
fmt.Errorf("operation failed: %w", err) - Use sentinel errors for expected conditions:
var ErrNotFound = errors.New("not found") - Check errors immediately after function calls
Concurrency
- Use
sync.Mutexfor shared state protection - Use
sync.RWMutexwhen reads dominate writes - Use channels for goroutine communication
- Always use
deferfor mutex unlocks
Testing
- Use table-driven tests for comprehensive coverage
- Use interfaces for mockability
- Test file names:
*_test.goin same package
Security
- Never log credentials or tokens
- Redact sensitive headers in debug logs
- Validate all external input
- Use
context.Contextfor cancellation
Checklist Files
| File | Description |
|------|-------------|
| [patterns.md](patterns.md) | Idiomatic Go patterns |
| [concurrency.md](concurrency.md) | Goroutines, channels, sync |
| [error-handling.md](error-handling.md) | Error wrapping, sentinels |
| [testing.md](testing.md) | Table-driven tests, mocks |
| [security.md](security.md) | Input validation, secure coding |
Go Proverbs to Remember
- "Don't communicate by sharing memory; share memory by communicating"
- "Errors are values"
- "A little copying is better than a little dependency"
- "Clear is better than clever"
- "Design the architecture, name the components, document the details"
Common Patterns in This Codebase
HTTP Client Interface
```go
type HTTPClient interface {
Do(req http.Request) (http.Response, error)
}
```
Process Management with Mutex
```go
type ProcessManager struct {
mu sync.RWMutex
processes map[string]*ProcessInfo
}
```
Cobra Command Pattern
```go
var myCmd = &cobra.Command{
Use: "mycommand",
Short: "Brief description",
RunE: func(cmd *cobra.Command, args []string) error {
// Implementation
return nil
},
}
```
Bubbletea Model Pattern
```go
type myModel struct {
// State fields
}
func (m myModel) Init() tea.Cmd { return nil }
func (m myModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { / ... / }
func (m myModel) View() string { return "" }
```
More from this repository10
Implements robust RAG document processing and retrieval using LlamaIndex, ChromaDB, and Celery for efficient, scalable AI document workflows.
Generates specialized Claude Code skills for each subsystem, creating shared language and subsystem-specific checklists to optimize AI code generation across the monorepo.
Manages shared Python utilities for LlamaFarm, focusing on HuggingFace model handling, GGUF file management, and cross-service consistency.
Configures secure Electron desktop application architecture with isolated processes, type-safe IPC, and cross-platform packaging for LlamaFarm.
Enforces strict TypeScript best practices for React and Electron frontend applications, ensuring type safety, immutability, and clean code patterns.
Provides comprehensive Go CLI development guidelines using Cobra, Bubbletea, and Lipgloss for creating robust, interactive command-line interfaces in LlamaFarm projects.
Automates git workflow by committing changes, pushing to GitHub, and opening a PR with intelligent checks and handling of edge cases.
Optimizes ML inference runtime with best practices for PyTorch, Transformers, and FastAPI, focusing on device management, model loading, and performance tuning.
Provides server-side best practices and code review guidelines for FastAPI, Celery, and Pydantic frameworks in Python.
Provides comprehensive Python best practices and code review guidelines for ensuring high-quality, secure, and maintainable code across LlamaFarm's Python components.