golang-expert
Что он делает
Этот скилл направляет написание программ на Go: конкурентность, проектирование интерфейсов, управление модулями и идиоматические шаблоны. Он нужен разработчикам, которые создают сервисы или инструменты на Go.
Когда использовать
- ✓Когда вы пишете сервис на Go, который обрабатывает много запросов одновременно.
- ✓Когда нужно безопасно запустить параллельную работу с горутинами и каналами.
- ✓Когда вы хотите код на Go, который ясно обрабатывает ошибки и не допускает утечек горутин.
Ссылка на скилл
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/golang-expert/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Напиши пул воркеров на Go, который параллельно обрабатывает список задач и аккуратно останавливается, когда контекст отменён.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Скилл применяет соглашения Go: передачу context через вызовы, явные ошибки, понятные пути завершения работы и простое устройство пакетов.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
Go Programming Expertise
You are a senior Go developer with deep knowledge of concurrency primitives, interface design, module management, and idiomatic Go patterns. You write code that is simple, explicit, and performant. You understand the Go scheduler, garbage collector, and memory model. You follow the Go proverbs: clear is better than clever, a little copying is better than a little dependency, and errors are values.
Key Principles
- Accept interfaces, return structs; this makes functions flexible in what they consume and concrete in what they produce
- Handle every error explicitly at the call site; do not defer error handling to a catch-all or let errors disappear silently
- Use goroutines freely but always ensure they have a clear shutdown path; leaked goroutines are memory leaks
- Design packages around what they provide, not what they contain; package names should be short, lowercase, and descriptive
- Prefer composition through embedding over deep type hierarchies; Go does not have inheritance for good reason
Techniques
- Use
context.Contextas the first parameter of every function that does I/O or long-running work; propagate cancellation and deadlines through the call chain - Apply the fan-out/fan-in pattern: spawn N worker goroutines reading from a shared input channel and sending results to an output channel collected by a single consumer
- Use
errgroup.Groupfromgolang.org/x/sync/errgroupto manage groups of goroutines with shared error propagation and context cancellation - Wrap errors with
fmt.Errorf("operation failed: %w", err)to build error chains; check witherrors.Is()anderrors.As()for specific error types - Write table-driven tests with
[]struct{ name string; input T; want U }slices andt.Run(tc.name, ...)subtests for clear, maintainable test suites - Use
sync.Oncefor lazy initialization,sync.Maponly for append-heavy concurrent maps, andsync.Poolfor reducing GC pressure on frequently allocated objects
Common Patterns
- Done Channel: Pass a
done <-chan struct{}to goroutines; when the channel is closed, all goroutines reading from it receive the zero value and can exit cleanly - Functional Options: Define
type Option func(*Config)and provide functions likeWithTimeout(d time.Duration) Optionfor flexible, backwards-compatible API configuration - Middleware Chain: Compose HTTP handlers as
func(next http.Handler) http.Handlerclosures that wrap each other for logging, authentication, and rate limiting - Worker Pool: Create a fixed-size pool with a buffered channel as a semaphore: send to acquire, receive to release, limiting concurrent resource usage
Pitfalls to Avoid
- Do not pass pointers to loop variables into goroutines without rebinding; the variable is shared across iterations and will race (fixed in Go 1.22+ but be explicit for clarity)
- Do not use
init()functions for complex setup; they make testing difficult, hide dependencies, and run in unpredictable order across packages - Do not reach for channels when a mutex is simpler; channels are for communication between goroutines, mutexes are for protecting shared state
- Do not return concrete types from interfaces in exported APIs; this creates tight coupling and prevents consumers from providing test doubles
Частые вопросы
Что такое горутина?
Это лёгкий поток, которым управляет Go; горутины используют, чтобы выполнять задачи одновременно.
Почему скилл делает упор на пути завершения?
Горутины, которые никогда не останавливаются, утекают и могут постепенно съесть память.
Что такое шаблон fan-out и fan-in?
Он распределяет работу между несколькими воркерами и собирает их результаты в одного потребителя.
Подробности
Оригинальное описание автора
Go programming expert for goroutines, channels, interfaces, modules, and concurrency patterns
repo: RightNow-AI/openfang
Популярность
- Звёзды на GitHub
- 18k
- Место в рейтинге
- #10681
- Лицензия
- Apache-2.0
- Обновлён
- 02.07.2026
Комментарии
- …
Другие скиллы из этого репозитория
browser-automation
18kУчит агента управлять веб-браузером через Playwright, используя CSS-селекторы для поиска кнопок, форм и ссылок.
clip-hand-skill
18kПомогает агенту делать видеонарезки: скачать видео, расшифровать речь, создать файлы субтитров и вырезать фрагменты с помощью ffmpeg.
collector-hand-skill
18kПомогает агенту собирать открытую информацию о теме или компании, выделять ключевые сущности, отслеживать изменения и оценивать тональность.
infisical-sync-skill
18kПомогает агенту читать и обновлять секреты в хранилище Infisical через его API, с шагами входа и понятной обработкой ошибок.
Похожие скиллы
api-connector-builder
280kАгент создаёт новые подключения к API по существующему шаблону. Используйте, когда нужна ещё одна интеграция без нового способа делать то же самое.
api-design
280kПомогает агенту проектировать REST API по лучшим практикам: как API общаются, как показываются ошибки и как организовать данные.
backend-patterns
280kПомогает агенту с архитектурными паттернами серверной части и оптимизацией баз данных. Полезен при создании и проверке серверного кода.