skills/safe-golang/SKILL.md
Enforce "safe-golang" coding principles in Go. Use when writing, reading, reviewing, or refactoring Go code to ensure maximum safety, predictable execution, and zero technical debt.
npx skillsauth add thedumptruck/skills safe-golangInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build highly predictable, robust, and performant Go applications with a "zero technical debt" policy.
Always verify standards against the reference documentation before implementing.
| Resource | URL / Path |
|----------|------------|
| Safety & Control Flow | ./references/safety.md |
| Performance Patterns | ./references/performance.md |
| Developer Experience | ./references/dx.md |
Review the relevant documentation when writing new logic or performing code reviews.
./references/safety.md - Control flow limits, dynamic memory restrictions, assertions, errors./references/performance.md - In-place initialization, batching strategies./references/dx.md - Naming conventions, options structs, formatting limits, zero dependenciesSearch: no recursion, context cancellation, sync.Pool, golangci-lint, options struct
| Need | Example |
|------|---------|
| Predictable Execution | Bounded channels, bounded loops, timeout contexts |
| Memory Stability | Pre-allocating at startup, sync.Pool, value types over pointers |
| Operational Reliability | Explicitly wrapped errors, pair assertions |
| Maintainability | Maximum 70 lines per function, max 100 columns per line, options structs |
context.Contextmake(), new()) in hot paths** or pointers to interfaces)godotenv)// Always bound asynchronous or repeated operations
const maxTasks = 1000
ch := make(chan Task, maxTasks)
for {
select {
case <-ctx.Done():
// Always handle cancellation
return ctx.Err()
default:
if checkStatus() == "done" {
return nil
}
time.Sleep(10 * time.Millisecond)
}
}
type Server struct {
bufferPool sync.Pool
}
func NewServer() *Server {
return &Server{
bufferPool: sync.Pool{
New: func() any {
b := make([]byte, 1024*1024)
return &b
},
},
}
}
func (s *Server) process(data []byte) {
// Acquire from pool instead of allocating
bufPtr := s.bufferPool.Get().(*[]byte)
defer s.bufferPool.Put(bufPtr)
// ...
}
goto - Keep control flow simple and execution bounds completely static.sync.Pool for dynamic reuse.ifs up, push fors down._. Handle or wrap every returned error.timeoutMs, latencyMaxMs)._ = ...)init() for magic initialization or global mutable statereflect for runtime type manipulation**Node)make(chan T)) or unbound loopsdevelopment
Enforce "safe-ts" coding principles in TypeScript. Use when writing, reading, reviewing, or refactoring TypeScript code to ensure maximum safety, predictable execution, and zero technical debt.
development
Enforce "safe-rust" coding principles. Use when writing, reading, reviewing, or refactoring Rust code to ensure maximum memory safety, predictable execution, zero-cost abstractions, and idiomatic Rust patterns.
development
Enforce "safe-c" coding principles in C. Based on TigerBeetle's Tiger Style. Use when writing, reading, reviewing, or refactoring C code to ensure maximum safety, predictable execution, zero technical debt, and extreme performance.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.