Agent skill
go-skills
Shared Go best practices for LlamaFarm CLI. Covers idiomatic patterns, error handling, and testing.
Install this agent skill to your Project
npx add-skill https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/go-skills
SKILL.md
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 | Idiomatic Go patterns |
| concurrency.md | Goroutines, channels, sync |
| error-handling.md | Error wrapping, sentinels |
| testing.md | Table-driven tests, mocks |
| 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
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 "" }
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
common-skills
Best practices for the Common utilities package in LlamaFarm. Covers HuggingFace Hub integration, GGUF model management, and shared utilities.
typescript-skills
Shared TypeScript best practices for Designer and Electron subsystems.
wt
Manage LlamaFarm worktrees for isolated parallel development. Create, start, stop, and clean up worktrees.
generate-subsystem-skills
Generate specialized skills for each subsystem in the monorepo. Creates shared language skills and subsystem-specific checklists for high-quality AI code generation.
temp-files
Guidelines for creating temporary files in system temp directory. Use when agents need to create reports, logs, or progress files without cluttering the repository.
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.
Didn't find tool you were looking for?