Vercel Composition Patterns
supabase/supabase
React composition patterns that scale. An agent skill from supabase/supabase.
A skill your agent uses when hardening Go code at API boundaries — copying slices/maps, verifying interface compliance, using defer for cleanup, time.Time/time.Duration, or avoiding mutable globals.
$ npx skills add cxuu/golang-skills --skill go-defensive -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install cxuu/golang-skills go-defensive --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/cxuu/golang-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/go-defensive .claude/skills/go-defensive && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "go-defensive" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-defensive into .claude/skills/go-defensive/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-defensive", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/cxuu/golang-skills/tree/main/skills/go-defensiveType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add cxuu/golang-skills --skill go-defensive -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install cxuu/golang-skills go-defensive --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cxuu/golang-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/go-defensive .agents/skills/go-defensive && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "go-defensive" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-defensive into .agents/skills/go-defensive/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-defensive", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add cxuu/golang-skills --skill go-defensive -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install cxuu/golang-skills go-defensive --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cxuu/golang-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/go-defensive .cursor/skills/go-defensive && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "go-defensive" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-defensive into .cursor/skills/go-defensive/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-defensive", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/cxuu/golang-skills.git --path skills/go-defensive--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add cxuu/golang-skills --skill go-defensive -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install cxuu/golang-skills go-defensive --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cxuu/golang-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/go-defensive .gemini/skills/go-defensive && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "go-defensive" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-defensive into .gemini/skills/go-defensive/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-defensive", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install cxuu/golang-skills go-defensiveInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add cxuu/golang-skills --skill go-defensive -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/cxuu/golang-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/go-defensive .github/skills/go-defensive && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "go-defensive" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-defensive into .github/skills/go-defensive/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-defensive", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add cxuu/golang-skills --skill go-defensive -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install cxuu/golang-skills go-defensive --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/cxuu/golang-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/go-defensive .opencode/skills/go-defensive && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "go-defensive" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-defensive into .opencode/skills/go-defensive/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-defensive", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
go-defensiveA skill your agent uses when hardening Go code at API boundaries — copying slices/maps, verifying interface compliance, using defer for cleanup, time.Time/time.Duration, or avoiding mutable globals.
Go Defensive is an agent skill from cxuu/golang-skills. Use when hardening Go code at API boundaries — copying slices/maps, verifying interface compliance, using defer for cleanup, time.Time/time.Duration, or avoiding mutable globals. Also use when reviewing for robustness concerns like missing cleanup or unsafe crypto usage, even if the user doesn't mention "defensive programming." Does not cover error handling strategy (see go-error-handling).
Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/BOUNDARY-COPYING.md`, `references/GLOBAL-STATE.md` and `references/MUST-FUNCTIONS.md`).
It sits in Development. The repository describes itself as: AI Agent Skills for idiomatic, production-ready Go code, distilled from Google, Uber, Community. The licence is Apache-2.0.
Read from SKILL.md and the folder at commit 91f0c2e. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are go).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Go Defensive loads about 1.6k tokens when it runs, and up to ~5.5k if it reads all its reference files. Until then it costs about 102 tokens; SKILL.md has 511 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from cxuu/golang-skills at commit 91f0c2e, republished under its Apache-2.0 licence (© cxuu). 511 words, ~1,637 tokens.
.claude/skills/go-defensive/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.Compatibility: Crypto examples may use
crypto/rand.Text, which requires Go 1.24+.
references/BOUNDARY-COPYING.md - Read when copying slices/maps across API boundaries.references/GLOBAL-STATE.md - Read when introducing or removing package globals.references/MUST-FUNCTIONS.md - Read when deciding whether a panic-on-error helper is acceptable.references/PANIC-RECOVER.md - Read when evaluating panic, recover, or crash containment.references/TIME-ENUMS-TAGS.md - Read when handling time types, enum zero values, or struct tags.When hardening code at API boundaries, check in this order:
Reviewing an API boundary?
├─ 1. Error handling → Return errors; don't panic (see go-error-handling)
├─ 2. Input validation → Copy slices/maps received from callers
├─ 3. Output safety → Copy slices/maps before returning to callers
├─ 4. Resource cleanup → Use defer for Close/Unlock/Cancel
├─ 5. Interface checks → Route compile-time assertions to go-interfaces
├─ 6. Time correctness → Use time.Time and time.Duration, not int/float
├─ 7. Enum safety → Start iota at 1 so zero-value is invalid
└─ 8. Crypto safety → crypto/rand for keys, never math/rand| Pattern | Rule | Details |
|---|---|---|
| Boundary copies | Copy slices/maps on receive and return | BOUNDARY-COPYING.md |
| Defer cleanup | defer f.Close() right after os.Open | Below |
| Interface check | Compile-time satisfaction assertion | See go-interfaces |
| Time types | time.Time / time.Duration, never raw int | TIME-ENUMS-TAGS.md |
| Enum start | iota + 1 so zero = invalid | Below |
| Crypto rand | crypto/rand for keys, never math/rand | Below |
| Must functions | Only at init; panic on failure | MUST-FUNCTIONS.md |
| Panic/recover | Never expose panics across packages | PANIC-RECOVER.md |
| Mutable globals | Replace with dependency injection | Below |
Route compile-time interface assertions to go-interfaces. Use this skill only to notice API-boundary robustness risk; the interface skill owns when an assertion is appropriate and the exact assertion shape.
Slices and maps contain pointers to underlying data. Copy at API boundaries to prevent unintended modifications.
// Receiving: copy incoming slice
d.trips = make([]Trip, len(trips))
copy(d.trips, trips)
// Returning: copy map before returning
result := make(map[string]int, len(s.counters))
for k, v := range s.counters { result[k] = v }Use defer to clean up resources (files, locks). Avoids missed cleanup on multiple return paths.
p.Lock()
defer p.Unlock()
if p.count < 10 {
return p.count
}
p.count++
return p.countDefer overhead is negligible. Place defer f.Close() immediately after
os.Open for clarity. Arguments to deferred functions are evaluated when
defer executes, not when the function runs. Multiple defers execute in
LIFO order.
Advisory: Always add explicit field tags to structs that are marshaled or unmarshaled.
type User struct {
Name string `json:"name" yaml:"name"`
Email string `json:"email" yaml:"email"`
}Field tags are a serialization contract — renaming a struct field without updating the tag silently breaks wire compatibility. Treat tags as part of the public API for any type that crosses a serialization boundary.
Start enums at non-zero to distinguish uninitialized from valid values.
const (
Add Operation = iota + 1 // Add=1, zero value = uninitialized
Subtract
Multiply
)Exception: When zero is the sensible default (e.g., LogToStdout = iota).
Inject dependencies instead of mutating package-level variables. This makes code testable without global save/restore.
type signer struct {
now func() time.Time // injected; tests replace with fixed time
}
func newSigner() *signer {
return &signer{now: time.Now}
}Do not use math/rand or math/rand/v2 to generate keys — this is a
security concern. Time-seeded generators have predictable output.
import "crypto/rand"
func Key() string { return rand.Text() }For text output, use crypto/rand.Text directly, or encode random bytes
with encoding/hex or encoding/base64.
Use panic only for truly unrecoverable situations. Library functions
should avoid panic.
func safelyDo(work *Work) {
defer func() {
if err := recover(); err != nil {
log.Println("work failed:", err)
}
}()
do(work)
}Key rules:
init() if a library truly cannot set itself upMust functions panic on error — use them only during program
initialization where failure means the program cannot run.
var validID = regexp.MustCompile(`^[a-z][a-z0-9-]{0,62}$`)
var tmpl = template.Must(template.ParseFiles("index.html"))© cxuu, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files (references) in skills/go-defensive of cxuu/golang-skills.
Open the folder on GitHubat commit 91f0c2e
Go Defensive next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Go Defensive this skillcxuu/golang-skills | 172 | — | ~1.6k | Automated safety check: Pass | Apache-2.0 | |
| Vercel Composition Patternssupabase/supabase | 111k | 58 repos | ~726 | Automated safety check: Pass | MIT | |
| Finishing a Development Branchobra/superpowers | 297k | 5 repos | ~1.9k | Automated safety check: Pass | MIT | |
| Typescript Advanced Typesrolling-scopes/rsschool-app | 10k | 25 repos | ~4.2k | Automated safety check: Pass | MPL-2.0 | |
| PR Babysitteropeninterpreter/openinterpreter | 69k | 3 repos | ~4.2k | Automated safety check: Pass | Apache-2.0 | |
| Code Review ChecklistshareAI-lab/learn-claude-code | 78k | 5 repos | ~1.1k | Automated safety check: Pass | MIT |
supabase/supabase
React composition patterns that scale. An agent skill from supabase/supabase.
obra/superpowers
Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.
rolling-scopes/rsschool-app
Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.
openinterpreter/openinterpreter
Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.
shareAI-lab/learn-claude-code
Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.
onyx-dot-app/onyx
Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.
cxuu/golang-skills
A skill your agent uses when writing, reviewing, or improving Go test code — including table-driven tests, subtests, parallel tests, test helpers, test doubles, and assertions with cmp.Diff.
cxuu/golang-skills
A skill your agent uses when reviewing Go code or checking code against community style standards.
cxuu/golang-skills
A skill your agent uses when optimizing Go code, investigating slow performance, or writing performance-critical sections.
cxuu/golang-skills
A skill your agent uses when writing or reviewing documentation for Go packages, types, functions, or methods.
cxuu/golang-skills
A skill your agent uses when writing Go code that returns, wraps, or handles errors — choosing between sentinel errors, custom types, and fmt.Errorf (%w vs %v), structuring error flow, or deciding…
cxuu/golang-skills
A skill your agent uses when defining or implementing Go interfaces, designing abstractions, creating mockable boundaries for testing, or composing types through embedding.
Categories
A skill your agent uses when hardening Go code at API boundaries — copying slices/maps, verifying interface compliance, using defer for cleanup, time.Time/time.Duration, or avoiding mutable globals. Go Defensive is an agent skill from cxuu/golang-skills.Duration, or avoiding mutable globals.
Go Defensive fits situations like: hardening Go code at API boundaries — copying slices/maps; verifying interface compliance; using defer for cleanup; time.Time/time.Duration.
Run `npx skills add cxuu/golang-skills --skill go-defensive -a claude-code`. Or copy the skill folder (skills/go-defensive in cxuu/golang-skills) into .claude/skills/go-defensive in your project. Claude Code loads it when a task matches its description.
Run `npx skills add cxuu/golang-skills --skill go-defensive -a codex`. Or copy the skill folder (skills/go-defensive in cxuu/golang-skills) into .agents/skills/go-defensive in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cxuu/golang-skills --skill go-defensive -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/go-defensive, .gemini/skills/go-defensive, .github/skills/go-defensive and .opencode/skills/go-defensive in your project.
SKILL.md names no scripts, command-line tools or credentials: Go Defensive is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Go Defensive is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.9k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Go Defensive: Vercel Composition Patterns (supabase/supabase, 111k stars), Finishing a Development Branch (obra/superpowers, 297k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and PR Babysitter (openinterpreter/openinterpreter, 69k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
cxuu (a GitHub user) maintains it in cxuu/golang-skills, which has 172 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on June 20, 2026.
Source: cxuu/golang-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.