/go-skills
Shared Go best practices for LlamaFarm CLI. Covers idiomatic patterns, error handling, and testing.
$ npx -y skills add llama-farm/llamafarm --skill go-skills --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/go-skills
Context preview
The summary Claude sees to decide when to auto-load this skill.
Shared Go best practices for LlamaFarm CLI. Covers idiomatic patterns, error handling, and testing.
SKILL.md
go-skills.SKILL.mdname: go-skills
description: Shared Go best practices for LlamaFarm CLI. Covers idiomatic patterns, error handling, and testing.
allowed-tools: Read, Grep, Glob
user-invocable: false
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 informationQuick 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.Mutex` for shared state protection
- Use `sync.RWMutex` when reads dominate writes
- Use channels for goroutine communication
- Always use `defer` for mutex unlocks
Testing
- Use table-driven tests for comprehensive coverage
- Use interfaces for mockability
- Test file names: `*_test.go` in same package
Security
- Never log credentials or tokens
- Redact sensitive headers in debug logs
- Validate all external input
- Use `context.Context` for 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
1. "Don't communicate by sharing memory; share memory by communicating" 2. "Errors are values" 3. "A little copying is better than a little dependency" 4. "Clear is better than clever" 5. "Design the architecture, name the components, document the details"
Common Patterns in This Codebase
HTTP Client Interface
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)
}Process Management with Mutex
type ProcessManager struct {
mu sync.RWMutex
processes map[string]*ProcessInfo
}Cobra Command Pattern
var myCmd = &cobra.Command{
Use: "mycommand",
Short: "Brief description",
RunE: func(cmd *cobra.Command, args []string) error {
// Implementation
return nil
},
}Bubbletea Model Pattern
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 "" }Read more
name: go-skills description: Shared Go best practices for LlamaFarm CLI. Covers idiomatic patterns, error handling, and testing. allowed-tools: Read, Grep, Glob user-invocable: false
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 informationQuick 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.Mutex` for shared state protection
- Use `sync.RWMutex` when reads dominate writes
- Use channels for goroutine communication
- Always use `defer` for mutex unlocks
Testing
- Use table-driven tests for comprehensive coverage
- Use interfaces for mockability
- Test file names: `*_test.go` in same package
Security
- Never log credentials or tokens
- Redact sensitive headers in debug logs
- Validate all external input
- Use `context.Context` for 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
1. "Don't communicate by sharing memory; share memory by communicating" 2. "Errors are values" 3. "A little copying is better than a little dependency" 4. "Clear is better than clever" 5. "Design the architecture, name the components, document the details"
Common Patterns in This Codebase
HTTP Client Interface
type HTTPClient interface {
Do(req *http.Request) (*http.Response, error)
}Process Management with Mutex
type ProcessManager struct {
mu sync.RWMutex
processes map[string]*ProcessInfo
}Cobra Command Pattern
var myCmd = &cobra.Command{
Use: "mycommand",
Short: "Brief description",
RunE: func(cmd *cobra.Command, args []string) error {
// Implementation
return nil
},
}Bubbletea Model Pattern
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 "" }Enterprise AI capabilities on your own hardware. No cloud required. LlamaFarm is an open-source AI platform that runs entirely on your hardware.
Repo: llama-farm/llamafarm
Other skills on llamafarm.
- /cli-skills
CLI best practices for LlamaFarm. Covers Cobra, Bubbletea, Lipgloss patterns for Go CLI development.
Open skill - /code-review
Comprehensive code review for diffs. Analyzes changed code for security vulnerabilities, anti-patterns, and quality issues. Auto-detects domain (frontend/backend) from file paths.
Open skill - /commit-push-pr
Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.
Open skill - /common-skills
Best practices for the Common utilities package in LlamaFarm. Covers HuggingFace Hub integration, GGUF model management, and shared utilities.
Open skill - /config-skills
Configuration module patterns for LlamaFarm. Covers Pydantic v2 models, JSONSchema generation, YAML processing, and validation.
Open skill - /designer-skills
Designer subsystem patterns for LlamaFarm. Covers React 18, TanStack Query, TailwindCSS, and Radix UI.
Open skill

