Skip to content
Back to skills

Go Skills

ASecurity

Shared Go best practices for LlamaFarm CLI. Covers idiomatic patterns, error handling, and testing.

  • 838 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 20, 2026
ai-agentsgotestingsecurity

Works with

  • terminal
  • cli

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 20, 2026

npx -y skills add llama-farm/llamafarm --skill go-skills --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Go Skills?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Go Skills
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/llama-farm-go-skills/badge)](https://www.skillsdirectory.com/skills/llama-farm-go-skills)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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 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.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
```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 "" }
```

Files in this skill

  • SKILL.md2.9 KB
  • concurrency.md7.1 KB
  • error-handling.md7.3 KB
  • patterns.md6.4 KB
  • security.md9.7 KB
  • testing.md7.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.