gcx — Go Cross-Compilation & Deploy Tool

VerifiedSafe

gcx is a lightweight CLI tool for cross-compiling Go binaries and publishing them to S3 or SSH servers. It reads YAML configuration and supports deployment with notifications.

Sby Skills Guide Bot
DevelopmentAdvanced
7/25/2026
Claude Code
#go#cross-compilation#cli#deployment#build-publish

Recommended for

Automated summary

Engineering guide for working in the gcx repository, a Go CLI for cross-compilation, publishing, and deployment.

Strengths

  • Provides a precise map of the internal architecture and package responsibilities.
  • Gives concrete procedures for adding CLI commands, config fields, and publish or deploy providers.
  • Captures project conventions for validation, templates, and factories.

Limitations

  • Highly specific to the gcx repository and its internal APIs.
  • Assumes familiarity with Go, urfave/cli/v3, and the project’s interfaces.
  • Does not explain operational setup of real S3 or SSH targets in depth.
When to use it

Use it whenever a task changes code, configuration, or tests in the gcx repository.

When not to use it

Avoid it when building another Go cross-compilation tool or when simply using gcx on the command line without modifying its code.

Security analysis

Safe
Quality score88/100

The skill is a documentation and development guide for the gcx codebase. It contains no executable commands that would harm the user's environment, no data exfiltration, no obfuscated payloads, and no instructions to disable safety. References to SSH, S3 publishing, and hook execution are descriptive of existing project architecture, not directives for the agent to perform risky actions. Since no tools are declared and the skill is non-invocable, there is no meaningful execution risk.

No concerns found

How this analysis is made

Examples

Add publish provider
In the gcx codebase, add a new publish provider for an S3-compatible service. Implement the Publisher interface, add BlobConfig fields and validation, register it in the factory, and update examples/gcx.yaml.
Add config field
In gcx, add an ArchiveConfig option to control whether zip archives are created, including the YAML tag, validation, and an updated example config.
Trace build issue
Help me trace why the gcx build command is not passing the correct version template into archive creation; inspect the relevant internal/build and internal/tmpl code paths and suggest a fix.

name: gcx description: > Go cross-compilation, build, publish, and deploy CLI tool (github.com/sxwebdev/gcx). Use this skill whenever working in the gcx codebase — editing build/publish/deploy logic, CLI commands, config structs, archive creation, SSH/S3 publishing, deployment alerts, or tests. Also triggers when code imports "sxwebdev/gcx", references gcx.yaml configuration, or when the user mentions: gcx CLI, Go cross-compilation tool, gcx build, gcx publish, gcx deploy, gcx release changelog, gcx config init, BlobConfig, BuildConfig, DeployConfig, ArchiveConfig, HooksConfig, Publisher, Deployer, Archiver, AlertData, shoutrrr alerts, or GoReleaser alternative. user-invocable: false

gcx — Go Cross-Compilation & Deploy Tool

Overview

gcx is a lightweight CLI tool for cross-compiling Go binaries and publishing them to S3 or SSH servers. It reads YAML configuration (gcx.yaml), manages secrets via .env files, uses git tags for versioning, and supports deployment with notifications.

The codebase follows a clean package architecture with each concern separated into its own package under internal/.

Architecture

See references/architecture.md for the full codebase map including file layout, key packages, and data flow.

Key packages:

  • cmd/gcx/main.go — thin CLI layer (~200 lines): command definitions, flag wiring, package orchestration
  • internal/config/ — all config structs, YAML loading, comprehensive validation
  • internal/build/ — build orchestration, BuildArtifact struct, archive creation
  • internal/archive/ — Archiver interface with tar.gz and zip implementations
  • internal/publish/ — Publisher interface with S3 and SSH implementations
  • internal/deploy/ — Deployer interface with SSH implementation
  • internal/notify/ — notification sending via shoutrrr
  • internal/git/ — git operations (tag, changelog, commit hash)
  • internal/sshutil/ — shared SSH client factory, known hosts management
  • internal/tmpl/ — shared template processing utility
  • internal/hook/ — hook execution via sh -c
  • internal/shellutil/ — shell escaping utilities
  • internal/helpers/ — path expansion utility

Configuration Schema

See references/config-schema.md for the complete config schema with all fields, types, defaults, and template variables.

Instructions

Adding a new CLI command

  1. Define the command in cmd/gcx/main.go inside the cli.Command tree
  2. Use urfave/cli/v3 patterns — cli.Command with Name, Usage, Flags, and Action
  3. The action handler receives context.Context — pass it to all package functions
  4. Access config via config.Load(cmd.String("config")) when the command needs configuration

Modifying config structs

  1. Add the new field to the appropriate struct in internal/config/config.go
  2. Include the yaml:"field_name,omitempty" tag
  3. Add validation in the struct's Validate() method
  4. Update examples/gcx.yaml to document the new field

Adding a new publish provider

  1. Create a new file internal/publish/{provider}.go
  2. Implement the Publisher interface: Name() string and Publish(ctx, artifactsDir, version) error
  3. Add provider-specific fields to config.BlobConfig with yaml:"...,omitempty" tags
  4. Add validation in BlobConfig.Validate() for the new provider
  5. Register the provider in publish.NewPublisher() factory
  6. Use tmpl.Process() for directory template processing
  7. Use sshutil.NewClient() if the provider needs SSH (eliminates code duplication)

Adding a new deploy provider

  1. Create a new file internal/deploy/{provider}.go
  2. Implement the Deployer interface: Name() string and Deploy(ctx) error
  3. Add provider-specific fields to config.DeployConfig
  4. Add validation in DeployConfig.Validate()
  5. Register in deploy.NewDeployer() factory

Working with templates

gcx uses internal/tmpl.Process() — a wrapper around Go's text/template:

result, err := tmpl.Process("name", templateStr, data)

Template data for builds:

  • {{.Version}} — git tag
  • {{.Commit}} — short commit hash
  • {{.Date}} — RFC3339 build timestamp
  • {{.Env.VAR_NAME}} — environment variable (security-filtered)

For archive naming (ArchiveTemplateData): {{.Binary}}, {{.Version}}, {{.Os}}, {{.Arch}}

Adding deployment alerts

Alerts use the shoutrrr library via internal/notify/.

notify.Send(urls, notify.AlertData{
    AppName: "myapp",
    Version: "v1.0.0",
    Status:  "Success",
})

Error handling patterns

  • Wrap errors with context: fmt.Errorf("doing X: %w", err)
  • All config structs have Validate() methods
  • Alert failures are logged but don't block deployment
  • Hook failures stop execution immediately
  • Git command failures return sensible defaults ("0.0.0" for tag, "none" for commit)

Building and testing

make build          # builds to ./bin/gcx
go test ./...       # run all tests
make docker-build   # build Docker image
make install        # go install

Key principles

  • Clean package architecture: Each concern is in its own package. cmd/gcx/main.go is a thin CLI layer that wires packages together.

  • Interfaces for providers: Publisher, Deployer, and Archiver interfaces enable testability and easy extension via factory functions.

  • Shared SSH client factory: sshutil.NewClient() eliminates SSH client code duplication between publish and deploy.

  • Shell safety: Hooks run via sh -c (not naive strings.Fields parsing). SSH remote commands use shellutil.Quote() for shell escaping.

  • Context propagation: All operations accept context.Context for cancellation support.

  • Template safety: Environment variables are selectively exposed — only vars explicitly referenced in {{.Env.X}} patterns are loaded.

  • Structured artifact metadata: build.Artifact carries binary name, version, OS, arch as structured data — no fragile filename parsing.

  • Parallel builds: errgroup with configurable concurrency limit handles concurrent compilation and archiving.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/download' --output '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md.part' && mv '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md.part' '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md' && test -s '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gcx' && cp -R '.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x' '.claude/skills/gcx'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x'

openskills read 'gcx-go-cross-compilation-deploy-tool-mrzxuq5x'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/gcx-go-cross-compilation-deploy-tool-mrzxuq5x/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills