Skip to content
Back to skills

Rules Golang

ASecurity

ANVIL coding rules for golang code (**/*.go, **/*_test.go): Go Security, Go, Go Testing.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentgosqltestingsecurity

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill rules-golang --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rules Golang?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rules Golang
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-rules-golang/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-rules-golang)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rules-golang
description: "ANVIL coding rules for golang code (**/*.go, **/*_test.go): Go Security, Go, Go Testing."
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# ANVIL rules: golang

Follow these rules for golang code (**/*.go, **/*_test.go).

## Go Security

# Go Security

- Pass process arguments explicitly via `exec.CommandContext(ctx, bin, arg1, arg2)`—never invoke `sh -c` with user-controlled strings.
- Use `crypto/rand` (never `math/rand`) for security tokens/nonces and `crypto/subtle.ConstantTimeCompare` for HMAC/secret verification.
- Use `html/template` instead of `text/template` for HTML rendering, and `$1` / `?` placeholders for all SQL queries.
- Set `http.Server` timeouts and validate redirect/webhook/outbound URLs (blocking loopback and cloud metadata ranges) to stop Slowloris and SSRF.

## Go

# Go

- Check every error and wrap with context using `%w`.
- Pass `context.Context` first for I/O; honor cancellation.
- Every goroutine has an owner and an exit; run tests with `-race`.
- `gofmt`/`go vet` clean; small consumer-defined interfaces.

## Go Testing

# Go Testing
- Table-driven tests with `t.Run`; `t.Parallel()` where safe.
- Run with `-race`; use `httptest` and fakes instead of real network.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.