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.
Write Go code following the conventions and patterns used in the within.website/x repository, including CLI patterns with internal.HandleStartup(), error handling, logging with slog, HTTP handlers…
$ npx skills add Xe/x --skill xe-go-style -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install Xe/x xe-go-style --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/Xe/x.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/xe-go-style .claude/skills/xe-go-style && 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 "xe-go-style" agent skill from https://github.com/Xe/x/tree/master/.claude/skills/xe-go-style into .claude/skills/xe-go-style/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xe-go-style", 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/Xe/x/tree/master/.claude/skills/xe-go-styleType 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 Xe/x --skill xe-go-style -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install Xe/x xe-go-style --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Xe/x.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/xe-go-style .agents/skills/xe-go-style && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "xe-go-style" agent skill from https://github.com/Xe/x/tree/master/.claude/skills/xe-go-style into .agents/skills/xe-go-style/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xe-go-style", 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 Xe/x --skill xe-go-style -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install Xe/x xe-go-style --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Xe/x.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/xe-go-style .cursor/skills/xe-go-style && 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 "xe-go-style" agent skill from https://github.com/Xe/x/tree/master/.claude/skills/xe-go-style into .cursor/skills/xe-go-style/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xe-go-style", 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/Xe/x.git --path .claude/skills/xe-go-style--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 Xe/x --skill xe-go-style -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install Xe/x xe-go-style --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Xe/x.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/xe-go-style .gemini/skills/xe-go-style && 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 "xe-go-style" agent skill from https://github.com/Xe/x/tree/master/.claude/skills/xe-go-style into .gemini/skills/xe-go-style/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xe-go-style", 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 Xe/x xe-go-styleInstalls 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 Xe/x --skill xe-go-style -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/Xe/x.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/xe-go-style .github/skills/xe-go-style && 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 "xe-go-style" agent skill from https://github.com/Xe/x/tree/master/.claude/skills/xe-go-style into .github/skills/xe-go-style/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xe-go-style", 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 Xe/x --skill xe-go-style -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install Xe/x xe-go-style --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Xe/x.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/xe-go-style .opencode/skills/xe-go-style && 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 "xe-go-style" agent skill from https://github.com/Xe/x/tree/master/.claude/skills/xe-go-style into .opencode/skills/xe-go-style/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xe-go-style", 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.
xe-go-styleWrite Go code following the conventions and patterns used in the within.website/x repository, including CLI patterns with internal.HandleStartup(), error handling, logging with slog, HTTP handlers…
Xe Go Style is an agent skill from Xe/x. Write Go code following the conventions and patterns used in the within.website/x repository, including CLI patterns with internal.HandleStartup(), error handling, logging with slog, HTTP handlers, and testing.
Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Error handling. The repository describes itself as: Various tools, trinkets and experiments. The licence is CC0-1.0.
Read from SKILL.md and the folder at commit 42a5acb. 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.
Shell commands in SKILL.md call:
gonpmFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use npm, which can reach the network depending on how they are called.
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.
Xe Go Style loads about 2k tokens when it runs. Until then it costs about 56 tokens; SKILL.md has 260 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 Xe/x at commit 42a5acb, republished under its CC0-1.0 licence (© Xe). 260 words, ~2,033 tokens.
.claude/skills/xe-go-style/SKILL.md (or your agent's skills folder).Write Go code following the conventions and patterns used in the within.website/x repository (Go 1.25.4).
├── cmd/ # Main applications (each subdirectory is a binary)
│ ├── x/ # Main CLI with subcommands
│ │ ├── main.go
│ │ └── cmd/ # Subcommand packages
│ └── sakurajima/ # Service binaries
│ ├── main.go
│ └── internal/ # Command-specific internal packages
├── internal/ # Private packages shared across commands
├── web/ # Web-related services and API clients
├── writer/ # Utility libraries for io.Writer middleware
└── gen/ # Generated code (protobuf)Package naming: lowercase, single words preferred (slog, flagenv, kahless).
All command-line tools MUST call internal.HandleStartup() at the start of main(). This function handles configuration loading and calls flag.Parse(). Individual binaries MUST NOT call flag.Parse() themselves.
package main
import (
"flag"
"within.website/x/internal"
)
var (
bind = flag.String("bind", ":8080", "HTTP bind address")
dbLoc = flag.String("db-loc", "", "Database location")
)
func main() {
internal.HandleStartup() // NO flag.Parse() call!
// flags are now parsed, use *bind and *dbLoc here
}Configuration loading order: flags → env vars (flagenv) → /run/secrets (flagfolder) → config file (flagconfyg) → flags (final override).
Use github.com/google/subcommands for subcommand-based CLIs:
package main
import (
"context"
"flag"
"os"
"github.com/google/subcommands"
"within.website/x/internal"
)
func main() {
internal.HandleStartup()
subcommands.Register(subcommands.HelpCommand(), "")
subcommands.Register(subcommands.FlagsCommand(), "")
subcommands.Register(subcommands.CommandsCommand(), "")
subcommands.Register(&serveCmd{}, "")
subcommands.Register(&versionCmd{}, "")
os.Exit(int(subcommands.Execute(context.Background())))
}
type serveCmd struct {
dbLoc string
}
func (c *serveCmd) Name() string { return "serve" }
func (c *serveCmd) Synopsis() string { return "Start the server" }
func (c *serveCmd) Usage() string {
return "serve [flags]\nStart the HTTP server.\n"
}
func (c *serveCmd) SetFlags(f *flag.FlagSet) {
f.StringVar(&c.dbLoc, "db-loc", "", "Database location")
}
func (c *serveCmd) Execute(ctx context.Context, f *flag.FlagSet, args ...interface{}) subcommands.ExitStatus {
// Implementation
return subcommands.ExitSuccess
}Flag names use kebab-case: --db-loc, --grpc-bind, --slog-level.
Define package-level sentinel errors:
var ErrNotFound = errors.New("store: key not found")
var ErrCantDecode = errors.New("store: can't decode value")Wrap errors with context using %w:
if err != nil {
return nil, fmt.Errorf("failed to connect to database: %w", err)
}
return nil, fmt.Errorf("ollama: error encoding request: %w", err)Combine multiple validation errors with errors.Join:
func (t *Toplevel) Valid() error {
var errs []error
if err := t.Bind.Valid(); err != nil {
errs = append(errs, fmt.Errorf("invalid bind block:\n%w", err))
}
if len(errs) != 0 {
return fmt.Errorf("invalid configuration file:\n%w", errors.Join(errs...))
}
return nil
}Check errors with errors.Is() and errors.As():
if errors.Is(err, ErrNotFound) {
// handle not found
}Custom error types implement Error() and optionally slog.LogValue():
type Error struct {
WantStatus, GotStatus int
URL *url.URL
Method string
ResponseBody string
}
func (e Error) Error() string {
return fmt.Sprintf("%s %s: wanted status code %d, got: %d: %v",
e.Method, e.URL, e.WantStatus, e.GotStatus, e.ResponseBody)
}
func (e Error) LogValue() slog.Value {
return slog.GroupValue(
slog.Int("want_status", e.WantStatus),
slog.Int("got_status", e.GotStatus),
slog.String("url", e.URL.String()),
slog.String("method", e.Method),
slog.String("body", e.ResponseBody),
)
}Use log/slog (never the plain log package). Output JSON to stderr. Use -slog-level flag for runtime control.
slog.Info("starting up",
"bind", *bind,
"db-loc", *dbLoc,
)
slog.Error("failed to create dao", "err", err)
slog.Debug("processing", "count", len(items))Always use "err" as the key for errors. Implement LogValue() for complex types:
func (s *Show) LogValue() slog.Value {
return slog.GroupValue(
slog.String("title", s.GetTitle()),
slog.String("disk_path", s.GetDiskPath()),
)
}Middleware pattern:
func PasswordMiddleware(username, password string, next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, pass, ok := r.BasicAuth()
if !ok || user != username || pass != password {
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
next.ServeHTTP(w, r)
})
}Chaining middleware:
var h http.Handler = topLevel
h = xffMW.Handler(h)
h = cors.Default().Handler(h)
h = FlyRegionAnnotation(h)HTTP client with context and error handling:
func (c *Client) doRequest(ctx context.Context, method, path string, wantCode int, body io.Reader) (*http.Response, error) {
req, err := http.NewRequestWithContext(ctx, method, u.String(), body)
if err != nil {
return nil, fmt.Errorf("failed to create request: %w", err)
}
resp, err := c.http.Do(req)
if err != nil {
return nil, fmt.Errorf("request failed: %w", err)
}
if resp.StatusCode != wantCode {
return nil, web.NewError(wantCode, resp)
}
return resp, nil
}Server lifecycle with errgroup:
g, gCtx := errgroup.WithContext(ctx)
g.Go(func() error {
ln, err := net.Listen("tcp", cfg.Bind.HTTP)
if err != nil {
return fmt.Errorf("failed to listen: %w", err)
}
return rtr.HandleHTTP(gCtx, ln)
})
return g.Wait()Tests co-located with source (*_test.go). Use table-driven tests:
func TestDomainValid(t *testing.T) {
t.Parallel()
for _, tt := range []struct {
name string
input Domain
err error
errContains string
}{
{name: "simple happy path", input: Domain{Name: "example.com"}},
{name: "invalid domain", input: Domain{Name: "\uFFFD.com"}, err: ErrInvalidDomainName},
} {
t.Run(tt.name, func(t *testing.T) {
err := tt.input.Valid()
if tt.err != nil {
if !errors.Is(err, tt.err) {
t.Logf("want: %v", tt.err)
t.Logf("got: %v", err)
t.Error("got wrong error")
}
}
})
}
}Testing best practices:
tt as the loop variable in table-driven testsname field for subtestst.Helper() for helper functionst.Parallel() for independent testst.TempDir() for temporary directorieshttptest.NewServer() for HTTP mockingerrors.Is() for error comparisont.Logf("want: %v", x) and t.Logf("got: %v", y) for debuggingfunc loadConfig(t *testing.T, fname string) config.Toplevel {
t.Helper()
// ...
}go fmt/goimports for formattingcamelCase for variablesPascalCase for exported identifiersnpm run format before committing© Xe, CC0-1.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .claude/skills/xe-go-style of Xe/x.
Open the folder on GitHubat commit 42a5acb
Xe Go Style 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 |
|---|---|---|---|---|---|---|
| Xe Go Style this skillXe/x | 337 | — | ~2k | Automated safety check: Pass | CC0-1.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.
Xe/x
Transform unstructured notes into polished blog posts in Xe Iaso's voice.
Write Go table-driven tests following Go community best practices and this repository's conventions.
Xe/x
Build interactive hypermedia-driven applications with templ and HTMX.
Categories
Write Go code following the conventions and patterns used in the within.website/x repository, including CLI patterns with internal.HandleStartup(), error handling, logging with slog, HTTP handlers…. Xe Go Style is an agent skill from Xe/x.HandleStartup(), error handling, logging with slog, HTTP handlers, and testing.
Xe Go Style fits situations like: tasks that involve Error handling.
Run `npx skills add Xe/x --skill xe-go-style -a claude-code`. Or copy the skill folder (.claude/skills/xe-go-style in Xe/x) into .claude/skills/xe-go-style in your project. Claude Code loads it when a task matches its description.
Run `npx skills add Xe/x --skill xe-go-style -a codex`. Or copy the skill folder (.claude/skills/xe-go-style in Xe/x) into .agents/skills/xe-go-style 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 Xe/x --skill xe-go-style -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/xe-go-style, .gemini/skills/xe-go-style, .github/skills/xe-go-style and .opencode/skills/xe-go-style in your project.
Going by SKILL.md and its folder, Xe Go Style needs the command-line tools its instructions call (go and npm).
SKILL.md contains no URLs. Its commands use npm, which can reach the network depending on how they are called. 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.
Xe Go Style is published under the CC0-1.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2k tokens (SKILL.md is roughly 8.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Xe Go Style: 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.
Xe (a GitHub user) maintains it in Xe/x, which has 337 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on October 8, 2026.
Source: Xe/x on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.