Mole Bug Patterns
tw93/Mole
A catalog of recurring bug shapes in the Mole Mac cleaner, used to review safety-sensitive diffs for deletion safety, unbounded commands, shell traps and weak tests.
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…
$ npx skills add cxuu/golang-skills --skill go-error-handling -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install cxuu/golang-skills go-error-handling --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-error-handling .claude/skills/go-error-handling && 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-error-handling" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-error-handling into .claude/skills/go-error-handling/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-error-handling", 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-error-handlingType 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-error-handling -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install cxuu/golang-skills go-error-handling --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-error-handling .agents/skills/go-error-handling && 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-error-handling" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-error-handling into .agents/skills/go-error-handling/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-error-handling", 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-error-handling -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install cxuu/golang-skills go-error-handling --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-error-handling .cursor/skills/go-error-handling && 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-error-handling" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-error-handling into .cursor/skills/go-error-handling/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-error-handling", 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-error-handling--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-error-handling -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install cxuu/golang-skills go-error-handling --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-error-handling .gemini/skills/go-error-handling && 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-error-handling" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-error-handling into .gemini/skills/go-error-handling/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-error-handling", 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-error-handlingInstalls 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-error-handling -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-error-handling .github/skills/go-error-handling && 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-error-handling" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-error-handling into .github/skills/go-error-handling/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-error-handling", 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-error-handling -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-error-handling --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-error-handling .opencode/skills/go-error-handling && 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-error-handling" agent skill from https://github.com/cxuu/golang-skills/tree/main/skills/go-error-handling into .opencode/skills/go-error-handling/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "go-error-handling", 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-error-handlingA 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…
Go Error Handling is an agent skill from cxuu/golang-skills. Use 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 whether to log or return. Also use when propagating errors across package boundaries or using errors.Is/As, even if the user doesn't ask about error strategy. Does not cover panic/recover patterns (see go-defensive).
Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and reference files (for example `references/ERROR-FLOW.md`, `references/ERROR-TYPES.md` and `references/WRAPPING.md`).
It sits in Development, covering Error handling. 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.
4 steps, taken from the first numbered list in SKILL.md.
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 these tools, so the agent can use them without asking each time:
Bash(bash:*)From allowed-tools in the SKILL.md frontmatter.
Ships 2 files in scripts/ (Go and Shell), which the agent can run.
Shell commands in SKILL.md call:
bashgoFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
go.devpkg.go.devFrom 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 Error Handling loads about 1.5k tokens when it runs, and up to ~4.7k if it reads all its reference files. Until then it costs about 103 tokens; SKILL.md has 551 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); the scripts in this folder are not scanned.
The full file from cxuu/golang-skills at commit 91f0c2e, republished under its Apache-2.0 licence (© cxuu). 551 words, ~1,501 tokens.
.claude/skills/go-error-handling/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.Compatibility:
errors.Is,errors.As, and%wwrapping require Go 1.13+; structured logging examples may uselog/slogfrom Go 1.21+.
scripts/check-errors.sh - Run when checking string-based error matching, bare error propagation, and log-and-return patterns.scripts/check-errors-ast.go - Implementation helper invoked by check-errors.sh; patch this when changing error-flow analysis behavior.references/ERROR-FLOW.md - Read when deciding where to handle, wrap, log, or return errors.references/ERROR-TYPES.md - Read when choosing sentinel errors, typed errors, or opaque errors.references/WRAPPING.md - Read when choosing %w versus %v or crossing package boundaries.In Go, errors are values — they are created by code and consumed by code.
%v to avoid leaking internals%wfmt.Errorf("...: %w", err)Default: wrap with %w and place it at the end of the format string.
Never return concrete error types from exported functions — a concrete nil
pointer can become a non-nil interface:
// Bad: Concrete type can cause subtle bugs
func Bad() *os.PathError { /*...*/ }
// Good: Always return the error interface
func Good() error { /*...*/ }Error strings should not be capitalized and should not end with punctuation. Exception: exported names, proper nouns, or acronyms.
// Bad
err := fmt.Errorf("Something bad happened.")
// Good
err := fmt.Errorf("something bad happened")For displayed messages (logs, test failures, API responses), capitalization is appropriate.
When a function returns an error, callers must treat all non-error return values as unspecified unless explicitly documented.
Tip: Functions taking a context.Context should usually return an error
so callers can determine if the context was cancelled.
When encountering an error, make a deliberate choice — do not discard
with _:
log.Fatal or panicTo intentionally ignore: add a comment explaining why.
n, _ := b.Write(p) // never returns a non-nil errorFor related concurrent operations, use
errgroup:
g, ctx := errgroup.WithContext(ctx)
g.Go(func() error { return task1(ctx) })
g.Go(func() error { return task2(ctx) })
if err := g.Wait(); err != nil { return err }Don't return -1, nil, or empty string to signal errors. Use multiple
returns:
// Bad: In-band error value
func Lookup(key string) int // returns -1 for missing
// Good: Explicit error or ok value
func Lookup(key string) (string, bool)This prevents callers from writing Parse(Lookup(key)) — it causes a
compile-time error since Lookup(key) has 2 outputs.
Handle errors before normal code. Early returns keep the happy path unindented:
// Good: Error first, normal code unindented
if err != nil {
return err
}
// normal codeHandle errors once — either log or return, never both:
Error encountered?
├─ Caller can act on it? → Return (with context via %w)
├─ Top of call chain? → Log and handle
└─ Neither? → Log at appropriate level, continueAdvisory: Recommended best practice.
| Caller needs to match? | Message type | Use |
|---|---|---|
| No | static | errors.New("message") |
| No | dynamic | fmt.Errorf("msg: %v", val) |
| Yes | static | var ErrFoo = errors.New("...") |
| Yes | dynamic | custom error type |
Default: Wrap with fmt.Errorf("...: %w", err). Escalate to sentinels for
errors.Is(), to custom types for errors.As().
Advisory: Recommended best practice.
%v: At system boundaries, for logging, to hide internal details%w: To preserve error chain for errors.Is/errors.AsKey rules: Place %w at the end. Add context callers don't have. If
annotation adds nothing, return err directly.
Validation: After implementing error handling, run
bash scripts/check-errors.shto detect common anti-patterns. Then rungo vet ./...to catch additional issues.
ErrFoo) or custom error typeserrors.Is/errors.As or writing error-checking helpers© 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 (scripts, references) in skills/go-error-handling of cxuu/golang-skills.
Open the folder on GitHubat commit 91f0c2e
Go Error Handling 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 Error Handling this skillcxuu/golang-skills | 172 | — | ~1.5k | Automated safety check: Pass | Apache-2.0 | |
| Mole Bug Patternstw93/Mole | 70k | — | ~2k | Automated safety check: Pass | GPL-3.0 | |
| Native Data FetchingCherryHQ/cherry-studio-app | 4k | 6 repos | ~2.9k | Automated safety check: Notes | MIT | |
| Rust Best Practicesfarm-fe/farm | 5.6k | 3 repos | ~1.1k | Automated safety check: Pass | MIT | |
| R Function Input Validationtidyverse/dplyr | 5.1k | 1 repos | ~2.3k | Automated safety check: Pass | Custom licence | |
| Next Best Practicesvercel-labs/openreview | 1.7k | 18 repos | ~1k | Automated safety check: Pass | None |
tw93/Mole
A catalog of recurring bug shapes in the Mole Mac cleaner, used to review safety-sensitive diffs for deletion safety, unbounded commands, shell traps and weak tests.
CherryHQ/cherry-studio-app
A skill your agent uses when implementing or debugging ANY network request, API call, or data fetching.
farm-fe/farm
Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.
tidyverse/dplyr
Validates arguments of exported R functions with the standalone check_* type checkers from rlang, in tidyverse style with clear error messages.
vercel-labs/openreview
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
microsoft/data-formulator
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用. An agent skill from microsoft/data-formulator.
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 defining or implementing Go interfaces, designing abstractions, creating mockable boundaries for testing, or composing types through embedding.
cxuu/golang-skills
A skill your agent uses when naming any Go identifier — packages, types, functions, methods, variables, constants, or receivers — to ensure idiomatic, clear names.
Categories
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…. Go Error Handling is an agent skill from cxuu/golang-skills.Errorf (%w vs %v), structuring error flow, or deciding whether to log or return.
Go Error Handling fits situations like: writing Go code that returns; handles errors — choosing between sentinel errors; fmt.Errorf (%w vs %v); structuring error flow.
Run `npx skills add cxuu/golang-skills --skill go-error-handling -a claude-code`. Or copy the skill folder (skills/go-error-handling in cxuu/golang-skills) into .claude/skills/go-error-handling in your project. Claude Code loads it when a task matches its description.
Run `npx skills add cxuu/golang-skills --skill go-error-handling -a codex`. Or copy the skill folder (skills/go-error-handling in cxuu/golang-skills) into .agents/skills/go-error-handling 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-error-handling -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-error-handling, .gemini/skills/go-error-handling, .github/skills/go-error-handling and .opencode/skills/go-error-handling in your project.
Going by SKILL.md and its folder, Go Error Handling needs Go and a shell for the scripts in its folder and the command-line tools its instructions call (bash and go). Our summary lists: A Bash shell. Its frontmatter pre-approves these tools: Bash(bash:*).
SKILL.md names 2 domains. As links in the text: go.dev and pkg.go.dev. 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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
Go Error Handling 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.5k tokens (SKILL.md is roughly 6k 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.2k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Go Error Handling: Mole Bug Patterns (tw93/Mole, 70k stars), Native Data Fetching (CherryHQ/cherry-studio-app, 4k stars), Rust Best Practices (farm-fe/farm, 5.6k stars) and R Function Input Validation (tidyverse/dplyr, 5.1k 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.