Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Go

ASecurity

Write reliable Go code avoiding goroutine leaks, interface traps, and common concurrency bugs.

14 stars
0 votes
0 copies
2 views
Added 9/7/2026
designgo

Security Analysis

A100/100

Scanned 9/7/2026

Install to Claude Code

$npx -y skills add modbender/skill-library-mcp --skill go --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Go?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Go
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-skill-library-mcp-05443f4a/badge)](https://www.skillsdirectory.com/skills/modbender-skill-library-mcp-05443f4a)

More formats (shields.io, HTML) on the badges page.

Download with Pro
Files
SKILL.md
---
name: Go
slug: go
version: 1.0.2
description: Write reliable Go code avoiding goroutine leaks, interface traps, and common concurrency bugs.
metadata: {"clawdbot":{"emoji":"🐹","requires":{"bins":["go"]},"os":["linux","darwin","win32"]}}
---

## Quick Reference

| Topic | File |
|-------|------|
| Concurrency patterns | `concurrency.md` |
| Interface and type system | `interfaces.md` |
| Slices, maps, strings | `collections.md` |
| Error handling patterns | `errors.md` |

## Goroutine Leaks

- Goroutine blocked on channel with no sender = leak forever—always ensure channel closes or use context
- Unbuffered channel send blocks until receive—deadlock if receiver never comes
- `for range` on channel loops forever until channel closed—sender must `close(ch)`
- Context cancellation doesn't stop goroutine automatically—must check `ctx.Done()` in loop
- Leaked goroutines accumulate memory and never garbage collect

## Channel Traps

- Sending to nil channel blocks forever—receiving from nil also blocks forever
- Sending to closed channel panics—closing already closed channel panics
- Only sender should close channel—receiver closing causes sender panic
- Buffered channel full = send blocks—size buffer for expected load
- `select` with multiple ready cases picks randomly—not first listed

## Defer Traps

- Defer arguments evaluated immediately, not when deferred function runs—`defer log(time.Now())` captures now
- Defer in loop accumulates—defers stack, run at function end not iteration end
- Defer runs even on panic—good for cleanup, but recover only in deferred function
- Named return values modifiable in defer—`defer func() { err = wrap(err) }()` works
- Defer order is LIFO—last defer runs first

## Interface Traps

- Nil concrete value in interface is not nil interface—`var p *MyType; var i interface{} = p; i != nil` is true
- Type assertion on wrong type panics—use comma-ok: `v, ok := i.(Type)`
- Empty interface `any` accepts anything but loses type safety—avoid when possible
- Interface satisfaction is implicit—no compile error if method signature drifts
- Pointer receiver doesn't satisfy interface for value type—only `*T` has the method

## Error Handling

- Errors are values, not exceptions—always check returned error
- `err != nil` after every call—unchecked errors are silent bugs
- `errors.Is` for wrapped errors—`==` doesn't work with `fmt.Errorf("%w", err)`
- Sentinel errors should be `var ErrFoo = errors.New()` not recreated
- Panic for programmer errors only—return error for runtime failures

## Slice Traps

- Slice is reference to array—modifying slice modifies original
- Append may or may not reallocate—never assume capacity
- Slicing doesn't copy—`a[1:3]` shares memory with `a`
- Nil slice and empty slice differ—`var s []int` vs `s := []int{}`
- `copy()` copies min of lengths—doesn't extend destination

## Map Traps

- Reading from nil map returns zero value—writing to nil map panics
- Map iteration order is random—don't rely on order
- Maps not safe for concurrent access—use `sync.Map` or mutex
- Taking address of map element forbidden—`&m[key]` doesn't compile
- Delete from map during iteration is safe—but add may cause issues

## String Traps

- Strings are immutable byte slices—each modification creates new allocation
- `range` over string iterates runes, not bytes—index jumps for multi-byte chars
- `len(s)` is bytes, not characters—use `utf8.RuneCountInString()`
- String comparison is byte-wise—not Unicode normalized
- Substring shares memory with original—large string keeps memory alive

## Struct and Memory

- Struct fields padded for alignment—field order affects memory size
- Zero value is valid—`var wg sync.WaitGroup` works, no constructor needed
- Copying struct with mutex copies unlocked mutex—always pass pointer
- Embedding is not inheritance—promoted methods can be shadowed
- Exported fields start uppercase—lowercase fields invisible outside package

## Build Traps

- `go build` caches aggressively—use `-a` flag to force rebuild
- Unused imports fail compilation—use `_` import for side effects only
- `init()` runs before main, order by dependency—not file order
- `go:embed` paths relative to source file—not working directory
- Cross-compile: `GOOS=linux GOARCH=amd64 go build`—easy but test on target

Attribution

modbendermodbender
View sourceMore from modbender →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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 (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Responsive Design

Implement modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first breakpoint strategies. Use when building adaptive interfaces, implementing fluid layouts, or creating component-level responsive behavior.

400052 votes

Mermaid Diagrams

Creating and refining Mermaid diagrams with live reload. Use when users want flowcharts, sequence diagrams, class diagrams, ER diagrams, state diagrams, or any other Mermaid visualization. Provides best practices for syntax, styling, and the iterative workflow using mermaid_preview and mermaid_save tools.

2102 votes

sleek-design-mobile-apps

Use when the user wants to design a mobile app, create screens, build UI, or interact with their Sleek projects. Covers high-level requests ("design an app that does X") and specific ones ("list my projects", "create a new project", "screenshot that screen").

5711 votes

swiftui-design-skill

SwiftUI frontend visual design skill. Creates beautiful, distinctive iOS/macOS interfaces that avoid generic AI slop patterns. Covers design direction, layout systems, typography, color, spacing, brand integration, and design review. Use when designing new SwiftUI views, reviewing UI quality, creating iOS prototypes, choosing visual styles, improving app aesthetics, or when the UI looks generic or AI-generated.

1801 votes

Ios Hig

Use when designing iOS interfaces, implementing accessibility (VoiceOver, Dynamic Type), handling dark mode, ensuring adequate touch targets, providing animation/haptic feedback, or requesting user permissions. Apple Human Interface Guidelines for iOS compliance.

761 votes
View all in design →