Agent Skills › poteto/noodle › go-best-practices

go-best-practices

GitHub

提供生产级 Go 代码的最佳实践规范,涵盖生命周期管理、并发处理、配置加载、测试策略及 CI 集成。适用于编写、审查和重构 Go 代码场景。

.agents/skills/go-best-practices/SKILL.md poteto/noodle

Trigger Scenarios

Go code review Go refactoring go best practices

Install

npx skills add poteto/noodle --skill go-best-practices -g -y
More Options

Non-standard path

npx skills add https://github.com/poteto/noodle/tree/main/.agents/skills/go-best-practices -g -y

Use without installing

npx skills use poteto/noodle@go-best-practices

指定 Agent (Claude Code)

npx skills add poteto/noodle --skill go-best-practices -a claude-code -g -y

安装 repo 全部 skill

npx skills add poteto/noodle --all -g -y

预览 repo 内 skill

npx skills add poteto/noodle --list

SKILL.md

Frontmatter
{
    "name": "go-best-practices",
    "description": "Production Go patterns — lifecycle, concurrency, config, testing, CI. Use when writing, reviewing, or refactoring Go code. Triggers on Go code review, Go refactoring, or 'go best practices'."
}

Go Best Practices

Pattern When to apply
Minimal main New binaries
Single bootstrap App wiring across modes
Ordered shutdown Long-running processes
Non-blocking fanout Channel-based event systems
Concurrency testing Any goroutine code
Layered config Multi-source configuration
Cross-platform paths File/config path resolution
Secure debug logging HTTP client instrumentation
Golden test matrices Rendering / output components
Focused linters CI pipeline setup

Read references/patterns.md for code examples.

Rules

  1. main.go is a stub. Call cmd.Execute() and nothing else. Gate diagnostics (pprof) behind env vars.

  2. One bootstrap path. All modes (interactive, headless, test) share the same initialization function. Two paths will drift.

  3. Ordered shutdown. Cancel dependents before their dependencies, then run independent cleanup in parallel under a timeout context. WaitGroup the parallel phase.

  4. Never block the sender. Non-blocking channel sends with an explicit drop policy. Log drops at debug level. Document the policy.

  5. Test concurrency mechanically. testing/synctest for deterministic timing, goleak.VerifyNone for leak detection, dedicated regression tests for timer/channel deadlocks.

  6. Explicit config precedence. Global → project → flags. Walk up from CWD to discover project configs, reverse so closest wins, deep-merge.

  7. Centralize platform paths. One function per concern. Resolution order: env override → XDG → platform default → fallback.

  8. Redact secrets in debug logs. Wrap http.RoundTripper. Filter headers matching authorization, api-key, token, secret. Gate on debug level to skip allocation in prod.

  9. Golden tests over matrices. Cross dimensions (layout × theme × size) as parallel subtests. Sweep continuous ranges to catch off-by-one bugs.

  10. Focused linters, not all linters. Enable what catches real bugs (bodyclose, noctx, tparallel). Disable noisy defaults. Add project-specific checks as scripts. Always -race in tests.

Version History

  • 82d2921 Current 2026-11-19 21:08

Same Skill Collection

.agents/skills/adversarial-review/SKILL.md
.agents/skills/ast-grep/SKILL.md
.agents/skills/brain/SKILL.md
.agents/skills/codex/SKILL.md
.agents/skills/commit/SKILL.md
.agents/skills/debugging/SKILL.md
.agents/skills/execute/SKILL.md
.agents/skills/find-skills/SKILL.md
.agents/skills/frontend-design/SKILL.md
.agents/skills/interaction-design/SKILL.md
.agents/skills/make-interfaces-feel-better/SKILL.md
.agents/skills/meditate/SKILL.md
.agents/skills/noodle/SKILL.md
.agents/skills/oops/SKILL.md
.agents/skills/plan/SKILL.md
.agents/skills/quality/SKILL.md
.agents/skills/react-best-practices/SKILL.md
.agents/skills/refine/SKILL.md
.agents/skills/reflect/SKILL.md
.agents/skills/review/SKILL.md
.agents/skills/ruminate/SKILL.md
.agents/skills/schedule/SKILL.md
.agents/skills/skill-creator/SKILL.md
.agents/skills/testing/SKILL.md
.agents/skills/todo/SKILL.md
.agents/skills/unslop/SKILL.md
.agents/skills/worktree/SKILL.md
examples/minimal/.agents/skills/execute/SKILL.md
examples/minimal/.agents/skills/schedule/SKILL.md
examples/multi-skill/.agents/skills/execute/SKILL.md
examples/multi-skill/.agents/skills/schedule/SKILL.md
skills/skill-creator/SKILL.md
.agents/skills/ts-best-practices/SKILL.md
examples/multi-skill/.agents/skills/deploy/SKILL.md
examples/multi-skill/.agents/skills/test/SKILL.md

Metadata

Files
0
Version
82d2921
Hash
21c459bf
Indexed
2026-11-19 21:08

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-20 00:33
浙ICP备14020137号-1