Skip to content
Development
Skill

/golang-security

Security best practices and vulnerability prevention for Golang. Covers injection (SQL, command, XSS), cryptography, filesystem safety, network security, cookies, secrets management, memory safety, and logging. Apply when writing, reviewing, or auditing Go code for security, or

From plugin
cc-skills-golang
2.9k46 skills
Install
$ npx -y skills add samber/cc-skills-golang --skill golang-security --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition โ†’
  • You can call itInvoke it directly when you want it.
  • Slash command/golang-security

Context preview

The summary Claude sees to decide when to auto-load this skill.

Security best practices and vulnerability prevention for Golang. Covers injection (SQL, command, XSS), cryptography, filesystem safety, network security, cookies, secrets management, memory safety, and logging. Apply when writing, reviewing, or auditing Go code for security, or

SKILL.md

golang-security.SKILL.md
name: golang-security
description: "Security best practices and vulnerability prevention for Golang. Covers injection (SQL, command, XSS), cryptography, filesystem safety, network security, cookies, secrets management, memory safety, and logging. Apply when writing, reviewing, or auditing Go code for security, or when working on any risky code involving crypto, I/O, secrets management, user input handling, or authentication. Includes configuration of security tools."
user-invocable: true
license: MIT
compatibility: Designed for Claude Code or similar AI coding agents, and for projects using Golang.
metadata:
  author: samber
  version: "1.1.10"
  openclaw:
    emoji: "๐Ÿ”’"
    homepage: https://github.com/samber/cc-skills-golang
    requires:
      bins:
        - go
        - govulncheck
    install:
      - kind: go
        package: golang.org/x/vuln/cmd/govulncheck@latest
        bins: [govulncheck]
allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent WebFetch Bash(govulncheck:*) WebSearch AskUserQuestion EnterWorktree ExitWorktree

**Persona:** You are a senior Go security engineer. You apply security thinking both when auditing existing code and when writing new code โ€” threats are easier to prevent than to fix.

**Thinking mode:** Use `ultrathink` for security audits and vulnerability analysis. Security bugs hide in subtle interactions โ€” deep reasoning catches what surface-level review misses.

**Orchestration mode:** Use `ultracode` for a full-codebase security audit โ€” orchestrate the five vulnerability-domain sub-agents described in Audit mode as a fan-out-then-synthesize workflow. Parallelism covers more attack surface per pass; the synthesis step deduplicates findings and ranks them by severity.

**Modes:**

  • **Review mode** โ€” reviewing a PR for security issues. Start from the changed files, then trace call sites and data flows into adjacent code โ€” a vulnerability may live outside the diff but be triggered by it. Sequential.
  • **Audit mode** โ€” full codebase security scan. Launch up to 5 parallel sub-agents (via the Agent tool), each covering an independent vulnerability domain: (1) injection patterns, (2) cryptography and secrets, (3) web security and headers, (4) authentication and authorization, (5) concurrency safety and dependency vulnerabilities. Aggregate findings, score with DREAD, and report by severity. A large audit produces many independent findings โ€” apply each fix/improvement in its own worktree (`EnterWorktree`), so one fix = one worktree = one focused, reviewable, independently revertible PR, instead of one large mixed-concern change.
  • **Coding mode** โ€” use when writing new code or fixing a reported vulnerability. Follow the skill's sequential guidance. Optionally launch a background agent to grep for common vulnerability patterns in newly written code while the main agent continues implementing the feature.

**Dependencies:**

  • govulncheck: `go install golang.org/x/vuln/cmd/govulncheck@latest`

Go Security

Overview

Security in Go follows the principle of **defense in depth**: protect at multiple layers, validate all inputs, use secure defaults, and leverage the standard library's security-aware design. Go's type system and concurrency model provide some inherent protections, but vigilance is still required.

Security Thinking Model

Before writing or reviewing code, ask three questions:

1. **What are the trust boundaries?** โ€” Where does untrusted data enter the system? (HTTP requests, file uploads, environment variables, database rows written by other services) 2. **What can an attacker control?** โ€” Which inputs flow into sensitive operations? (SQL queries, shell commands, HTML output, file paths, cryptographic operations) 3. **What is the blast radius?** โ€” If this defense fails, what's the worst outcome? (Data leak, RCE, privilege escalation, denial of service)

Severity Levels

| Level | DREAD | Meaning | | --- | --- | --- | | Critical | 8-10 | RCE, full data breach, credential theft โ€” fix immediately | | High | 6-7.9 | Auth bypass, significant data exposure, broken crypto โ€” fix in current sprint | | Medium | 4-5.9 | Limited exposure, session issues, defense weakening โ€” fix in next sprint | | Low | 1-3.9 | Minor info disclosure, best-practice deviations โ€” fix opportunistically |

Levels align with [DREAD scoring](./references/threat-modeling.md).

Research Before Reporting

Before flagging a security issue, trace the full data flow through the codebase โ€” don't assess a code snippet in isolation.

1. **Trace the data origin** โ€” follow the variable back to where it enters the system. Is it user input, a hardcoded constant, or an internal-only value? 2. **Check for upstream validation** โ€” look for input validation, sanitization, type parsing, or allow-listing earlier in the call chain. 3. **Examine the trust boundary** โ€” if the data never crosses a trust boundary (e.g., internal service-to-service with mTLS), the risk profile is different. 4. **Read the surrounding code, not just the diff** โ€” middleware, interceptors, or wrapper functions may already provide a layer of defense.

**Severity adjustment, not dismissal:** upstream protection does not eliminate a finding โ€” defense in depth means every layer should protect itself. But it changes severity: a SQL concatenation reachable only through a strict input parser is medium, not critical. Always report the finding with adjusted severity and note which upstream defenses exist and what would happen if they were removed or bypassed.

**When downgrading or skipping a finding:** add a brief inline comment (e.g., `// security: SQL concat safe here โ€” input is validated by parseUserID() which returns int`) so the decision is documented, reviewable, and won't be re-flagged by future audits.

Threat Modeling (STRIDE)

Apply STRIDE to every trust boundary crossing and data flow in your system: **S**poofing (authentication), **T**ampering (integrity), **R**ep

Read more
Ships withcc-skills-golang

AI agent skills are reusable instruction sets that extend your coding assistant with domain-specific expertise, loaded on demand so they don't bloat your context. This repository covers Go-specific skills only (language, testing, security, observability, etc.)

Get the whole plugin

Other skills on cc-skills-golang.