Skip to content
Back to skills

Go Antipatterns

ASecurity

Forbidden Go patterns — SQL injection, shell injection, missing timeouts, resource leaks, goroutine leaks, and error handling issues. Applies when editing Go files.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 21, 2026
ai-agentsgoshellsql

Works with

  • cli

Security analysis

A100/100

Pro scans all 16 files and shows the line behind each finding

Scanned October 21, 2026

npx -y skills add emgiezet/aisdlc --skill go-antipatterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Go Antipatterns?

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

Security grade badge for Go Antipatterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/emgiezet-go-antipatterns/badge)](https://www.skillsdirectory.com/skills/emgiezet-go-antipatterns)

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: go-antipatterns
description: Forbidden Go patterns — SQL injection, shell injection, missing timeouts, resource leaks, goroutine leaks, and error handling issues. Applies when editing Go files.
paths: ["**/*.go"]
user-invocable: false
---

# Go anti-patterns — do not write these

Checks run automatically after each edit. Findings reference the IDs below.

## Blockers
- AP-GO-SEC-001 — Build SQL with `$1`/`?` placeholders; never use `fmt.Sprintf` or `+` to compose queries.
- AP-GO-SEC-002 — Use `exec.Command("prog", arg1, arg2)` with separate args; never `sh -c` with user input.
- AP-GO-SEC-004 — Use `crypto/rand` for tokens and secrets; `math/rand` is for simulations only.
- AP-GO-SEC-005 — Never set `InsecureSkipVerify: true`; configure a valid `RootCAs` pool.

## Errors
- AP-GO-SEC-003 — Set `ReadHeaderTimeout`, `ReadTimeout`, `WriteTimeout`, `IdleTimeout` on `http.Server`.
- AP-GO-PERF-001 — Set `Client.Timeout` and use `NewRequestWithContext`; never use `http.Get` without a timeout.
- AP-GO-PERF-002 — Defer `resp.Body.Close()` and `rows.Close()` immediately; always check `rows.Err()`.
- AP-GO-PERF-003 — Limit goroutine fan-out with `errgroup.SetLimit`; always propagate context for cancellation.
- AP-GO-MAINT-001 — Handle every error; wrap with `fmt.Errorf("…: %w", err)`; compare with `errors.Is`/`errors.As`.
- AP-GO-MAINT-002 — Return errors from libraries; never call `panic`/`log.Fatal`/`os.Exit` outside `main`.

## Warnings
- AP-GO-MAINT-003 — Propagate the request `ctx` through all calls; never use `context.Background()` in handlers.

Details for any ID: `reference/<ID>.md`

Files in this skill

  • SKILL.md1.6 KB
  • reference/AP-GO-MAINT-001.md776 B
  • reference/AP-GO-MAINT-002.md722 B
  • reference/AP-GO-MAINT-003.md697 B
  • reference/AP-GO-MAINT-004.md496 B
  • reference/AP-GO-PERF-001.md821 B
  • reference/AP-GO-PERF-002.md930 B
  • reference/AP-GO-PERF-003.md886 B
  • reference/AP-GO-PERF-004.md815 B
  • reference/AP-GO-SEC-001.md702 B
  • reference/AP-GO-SEC-002.md664 B
  • reference/AP-GO-SEC-003.md747 B
  • reference/AP-GO-SEC-004.md705 B
  • reference/AP-GO-SEC-005.md712 B
  • reference/AP-GO-SEC-006.md856 B
  • reference/AP-GO-SEC-007.md694 B

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.

Comments

Loading comments…

Newsletter

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