Agent skill

Xe Go Style

by Xe in 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…

CC0-1.0Auto-check passedDevelopment

Install Xe Go Style

skills CLI
$ npx skills add Xe/x --skill xe-go-style -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Xe/x xe-go-style --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ 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-src

Use ~/.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/

Facts

Skill name
xe-go-style
GitHub stars
337
Token cost
~2k tokens
SKILL.md length
260 words
Files
1
Skills in repo
4
Repo updated
First seen
Licence
CC0-1.0

At a glance

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…

  • Tasks that involve Error handling
  • SKILL.md covers Project Structure, CLI Pattern (CRITICAL), Error Handling and Logging, plus 3 more sections
  • Calls go and npm

What it does

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.

When your agent uses it

  • Tasks that involve Error handling

Example prompts

  • “/xe-go-style”

What it can do on your machine

Read from SKILL.md and the folder at commit 42a5acb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    Shell commands in SKILL.md call:

    • go
    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    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.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

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.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~2k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from Xe/x at commit 42a5acb, republished under its CC0-1.0 licence (© Xe). 260 words, ~2,033 tokens.

Download SKILL.mdSave it as .claude/skills/xe-go-style/SKILL.md (or your agent's skills folder).
name
xe-go-style
description
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.

Xe/x Go Style Guide

Write Go code following the conventions and patterns used in the within.website/x repository (Go 1.25.4).

Project Structure

├── 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).

CLI Pattern (CRITICAL)

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.

go
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).

Subcommands

Use github.com/google/subcommands for subcommand-based CLIs:

go
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.

Error Handling

Define package-level sentinel errors:

go
var ErrNotFound = errors.New("store: key not found")
var ErrCantDecode = errors.New("store: can't decode value")

Wrap errors with context using %w:

go
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:

go
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():

go
if errors.Is(err, ErrNotFound) {
    // handle not found
}

Custom error types implement Error() and optionally slog.LogValue():

go
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),
    )
}

Logging

Use log/slog (never the plain log package). Output JSON to stderr. Use -slog-level flag for runtime control.

go
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:

go
func (s *Show) LogValue() slog.Value {
    return slog.GroupValue(
        slog.String("title", s.GetTitle()),
        slog.String("disk_path", s.GetDiskPath()),
    )
}

HTTP Patterns

Middleware pattern:

go
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:

go
var h http.Handler = topLevel
h = xffMW.Handler(h)
h = cors.Default().Handler(h)
h = FlyRegionAnnotation(h)

HTTP client with context and error handling:

go
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:

go
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()

Testing

Tests co-located with source (*_test.go). Use table-driven tests:

go
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:

  • Use tt as the loop variable in table-driven tests
  • Always include name field for subtests
  • Use t.Helper() for helper functions
  • Use t.Parallel() for independent tests
  • Use t.TempDir() for temporary directories
  • Use httptest.NewServer() for HTTP mocking
  • Use errors.Is() for error comparison
  • Include t.Logf("want: %v", x) and t.Logf("got: %v", y) for debugging
go
func loadConfig(t *testing.T, fname string) config.Toplevel {
    t.Helper()
    // ...
}

Code Style

  • Use go fmt/goimports for formatting
  • Tabs for indentation
  • camelCase for variables
  • PascalCase for exported identifiers
  • Files use snake_case
  • Packages use lower-case module names
  • Run npm 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

Files

Just SKILL.md in .claude/skills/xe-go-style of Xe/x.

Open the folder on GitHubat commit 42a5acb

Compare with similar skills

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.

Xe Go Style compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Xe Go Style this skillXe/x337—~2kAutomated safety check: PassCC0-1.0
Mole Bug Patternstw93/Mole70k—~2kAutomated safety check: PassGPL-3.0
Native Data FetchingCherryHQ/cherry-studio-app4k6 repos~2.9kAutomated safety check: NotesMIT
Rust Best Practicesfarm-fe/farm5.6k3 repos~1.1kAutomated safety check: PassMIT
R Function Input Validationtidyverse/dplyr5.1k1 repos~2.3kAutomated safety check: PassCustom licence
Next Best Practicesvercel-labs/openreview1.7k18 repos~1kAutomated safety check: PassNone

Similar skills

  • 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.

    70k GitHub stars~2k tokensUpdated today
    DevelopmentAuto-check passed
  • Native Data Fetching

    CherryHQ/cherry-studio-app

    A skill your agent uses when implementing or debugging ANY network request, API call, or data fetching.

    4k GitHub starsUsed in 6 repos~2.9k tokens
    DevelopmentAuto-check: notes
  • Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

    5.6k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Validates arguments of exported R functions with the standalone check_* type checkers from rlang, in tidyverse style with clear error messages.

    5.1k GitHub starsUsed in 1 repo~2.3k tokens
    DevelopmentAuto-check passed
  • Next Best Practices

    vercel-labs/openreview

    Official

    Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

    1.7k GitHub starsUsed in 18 repos~1k tokens
    DevelopmentAuto-check passed
  • Error Handling

    microsoft/data-formulator

    Official

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用. An agent skill from microsoft/data-formulator.

    18k GitHub stars~3.8k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from Xe/x

  • Transform unstructured notes into polished blog posts in Xe Iaso's voice.

    337 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Write Go table-driven tests following Go community best practices and this repository's conventions.

    337 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Build interactive hypermedia-driven applications with templ and HTMX.

    337 GitHub stars~3.3k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Xe Go Style

What does Xe Go Style do?

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.

When should I use Xe Go Style?

Xe Go Style fits situations like: tasks that involve Error handling.

How do I install Xe Go Style in Claude Code?

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.

How do I install Xe Go Style in Codex?

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.

Can I use Xe Go Style in Cursor, Gemini CLI or GitHub Copilot?

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.

What does Xe Go Style need to run?

Going by SKILL.md and its folder, Xe Go Style needs the command-line tools its instructions call (go and npm).

Does Xe Go Style access the network?

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.

Is Xe Go Style safe to install?

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.

What licence does Xe Go Style use?

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.

How many tokens does Xe Go Style use?

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.

What are the alternatives to Xe Go Style?

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.

Who maintains Xe Go Style?

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.