golang-idiomatic-patterns
Go (Golang) 原生工程惯用法:错误链包装、Context 生命周期、Goroutine 泄漏防御与表驱动测试。
Skill by 2428424081cn
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/2428424081cn-golang-idiomatic-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/golang-idiomatic-patterns
What's inside
- Skill name
golang-idiomatic-patterns- Description
- Go (Golang) 原生工程惯用法:错误链包装、Context 生命周期、Goroutine 泄漏防御与表驱动测试。
- License
- MIT
- Instructions
- 32 lines in SKILL.md · view on GitHub
Files (2)
- SKILL.md
- skill.json
SKILL.md (first lines)
# Go (Golang) 官方原生工程化规范
## 1. 错误包装与解构铁律
- **必须使用 `%w` 包装上下文**:`fmt.Errorf("find user id=%d: %w", id, err)`。
- **判断特定哨兵错误**:必须使用 `errors.Is(err, sql.ErrNoRows)`,严禁 `err == sql.ErrNoRows`。
- **类型断言自定义错误**:必须使用 `errors.As(err, &customErr)`。
## 2. Context 传递与生命周期
- 函数的第一个参数始终为 `ctx context.Context`。
- 绝不在结构体内部存储 Context,必须随方法调用链传递。
- 所有的外部网络调用、DB 查询必须接收并响应 `ctx.Done()`。
## 3. 并发安全与 Goroutine 泄漏防护
- **启动 Goroutine 前必须明确其退出机制**(通过 Context 取消或 Channel 关闭信号)。
- **Channel 必须由发送方(Producer)关闭**,严禁接收方关闭。
```go
func ProcessItems(ctx context.Context, items []Item) error {
g, ctx := errgroup.WithContext(ctx)
g.SetLimit(10) // 严格限制最大并发工作协程数
for _, item := range items {
item := item // 防止闭包变量逃逸共享
g.Go(func() error {
return doWork(ctx, item)
})
}
return g.Wait()
}
```From 2428424081cn/Skill-mcp, MIT.
More from 2428424081cn/Skill-mcp
- 0.544score
agy-customizations
2428424081cn
Comprehensive guide and reference for the Antigravity Customization System.
SkillBFreshness: B★ 1Claude Code +9 - 0.544score
permissioned-github
2428424081cn
Guidelines for interacting with GitHub and request permissions from the user when commands fail due to restrictions in the agent environment.
SkillBFreshness: B★ 1Claude Code +9 - 0.541score
graphql-schema-design
2428424081cn
GraphQL API 设计准则:Relay 游标分页、DataLoader 批量防 N+1 查询与 Schema 优雅演进。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
architecture-decision-records
2428424081cn
架构决策记录 (ADR) 标准规范:技术选型、架构权衡论证与变更生命周期管理。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
nestjs-prisma-drizzle
2428424081cn
NestJS 模块化依赖注入架构与 Prisma / Drizzle ORM 端到端类型安全后端规范。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
spring-boot-clean-architecture
2428424081cn
Spring Boot 3 / Java 企业级 DDD 领域驱动设计与六边形 (Hexagonal) 干净架构规范。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
llm-prompt-injection-defense
2428424081cn
大模型 Prompt 注入防御与越狱防护准则:非可信数据定界隔离、系统提示词防嗅探与输入清洗。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
prompt-ab-testing
2428424081cn
大模型 Prompt 提示词 A/B 测试与版本迭代指南。提供提示词量化评估指标与防御性提示词设计。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
structured-output-json-schema
2428424081cn
大模型严格结构化输出 JSON Schema 约束设计与 Function Calling 容错修复机制。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
sql-query-optimizer
2428424081cn
SQL 性能优化与慢查询诊断。提供索引覆盖(Covering Index)、分页深度优化与 JOIN 性能建议。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
db-schema-inspector
2428424081cn
数据库结构探查与自省工具。探查 SQLite 数据库表清单、列类型、主键与记录行数。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
code-review-guard
2428424081cn
静态代码审查与漏洞检查助手。深度扫描源码中的 SQL 拼接、空异常捕获、未清理定时器与硬编码凭据。
SkillBFreshness: B★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 24, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/2428424081cn/Skill-mcp
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from 2428424081cn
- 0.544score
agy-customizations
2428424081cn
Comprehensive guide and reference for the Antigravity Customization System.
SkillBFreshness: B★ 1Claude Code +9 - 0.544score
permissioned-github
2428424081cn
Guidelines for interacting with GitHub and request permissions from the user when commands fail due to restrictions in the agent environment.
SkillBFreshness: B★ 1Claude Code +9 - 0.541score
graphql-schema-design
2428424081cn
GraphQL API 设计准则:Relay 游标分页、DataLoader 批量防 N+1 查询与 Schema 优雅演进。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
structured-output-json-schema
2428424081cn
大模型严格结构化输出 JSON Schema 约束设计与 Function Calling 容错修复机制。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
nestjs-prisma-drizzle
2428424081cn
NestJS 模块化依赖注入架构与 Prisma / Drizzle ORM 端到端类型安全后端规范。
SkillBFreshness: B★ 1Claude Code +9 - 0.538score
architecture-decision-records
2428424081cn
架构决策记录 (ADR) 标准规范:技术选型、架构权衡论证与变更生命周期管理。
SkillBFreshness: B★ 1Claude Code +9
Cite this page
golang-idiomatic-patterns skill. Agent Mart. https://agentmart.dev/skills/2428424081cn-golang-idiomatic-patterns (last updated 2026-10-24)