# Go backend

> Go backend is an open-source agent skill for developer tools. Guides an agent to write idiomatic Go backend services with typed errors and tests. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/Nabwinsaud/forgeline/tree/main/skills/go-backend
- **Repository:** https://github.com/nabwinsaud/forgeline
- **GitHub stars:** 8
- **License:** MIT
- **Skill name:** go-backend
- **Collection:** https://github.com/Nabwinsaud/forgeline
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill gives an AI coding agent a set of conventions for building Go HTTP services. It covers how to lay out packages by domain, how to propagate context and wrap errors, and how to map domain errors to HTTP status codes in one place. Handlers are kept thin, with decoding, validation and encoding separated from business logic.

For data access it describes a sqlc and pgx v5 setup with a connection pool, query files kept outside generated code, transactions with rollback handling, and reliance on database constraints for invariants. It also sets rules for structured logging with slog, goroutine ownership with errgroup, and testing with table-driven tests, httptest, and real Postgres through testcontainers. The skill tells the agent to defer to a repository's existing patterns where they exist.

The skill is plain instructions with no bundled scripts. It expects a Go project and, for the database parts, sqlc and PostgreSQL. It refers to a separate database-migrations skill for code generation details and lists commands such as go test with the race detector and go generate.

## When your agent uses it

> Idiomatic Go service code for factory jobs - package layout, context propagation, error wrapping and typed domain errors mapped to HTTP, thin handlers, sqlc + pgx with transactions, slog logging, and testing with table-driven tests, httptest, testcontainers and the race detector. Use when writing or reviewing Go backend code.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/Nabwinsaud/forgeline/tree/HEAD/skills/go-backend)
- [License: MIT](https://github.com/Nabwinsaud/forgeline/tree/HEAD/skills/go-backend)

## Features

- **Package layout guidance:** Describes a cmd and internal structure with packages organized by domain rather than by layer.
- **Error wrapping and HTTP mapping:** Shows wrapping with %w, errors.Is and errors.As checks, and a single function that maps domain errors to responses.
- **Thin HTTP handlers:** Separates request decoding, validation, service calls and response encoding from business rules and SQL.
- **sqlc and pgx transactions:** Covers pgxpool usage, sqlc query files, transactional writes and translating unique constraint violations into conflicts.
- **Structured logging and concurrency:** Sets rules for slog JSON logging with context and for goroutine lifecycles using errgroup and mutexes.
- **Table-driven and HTTP tests:** Provides patterns for table-driven subtests, httptest handler tests, and Postgres-backed tests with testcontainers.

## Good for

- Write a new order endpoint in a Go service
- Review a Go handler for error mapping problems
- Add a sqlc query and a transactional service method
- Write table-driven tests for a validation function
- Set up integration tests against Postgres with testcontainers
- Check a Go service for context and goroutine misuse

## Install

### Claude Code

This skill ships in the `forgeline` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add Nabwinsaud/forgeline
/plugin install forgeline@forgeline
```

Or copy only this skill to `~/.claude/skills/go-backend`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/go-backend &&
cp -R "$tmp/skills/go-backend" ~/.claude/skills/go-backend &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/go-backend` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/go-backend` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/go-backend &&
cp -R "$tmp/skills/go-backend" ~/.agents/skills/go-backend &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/go-backend` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/go-backend` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/go-backend &&
cp -R "$tmp/skills/go-backend" ~/.cursor/skills/go-backend &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/go-backend` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/Nabwinsaud/forgeline.git --path skills/go-backend
```

Or copy the folder to `~/.gemini/skills/go-backend` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/go-backend`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/go-backend &&
cp -R "$tmp/skills/go-backend" ~/.copilot/skills/go-backend &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/go-backend` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/Nabwinsaud/forgeline.git
```

Then copy `forgeline/skills/go-backend` into your agent's skills folder as `go-backend`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Go backend need to be useful?

It is written for Go backend code and assumes a project that may use sqlc, pgx and PostgreSQL. It tells the agent to follow the repository's own conventions first and use these defaults only where the repo is silent.

### Does Go backend run any scripts or change files on its own?

No scripts are included. It gives guidance for the agent to apply while writing or reviewing code, and it lists commands like go test -race and go generate for the agent to run.

### When does the skill trigger?

It is meant for tasks involving writing or reviewing Go backend code, as stated in its description.

### How do I install Go backend in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/go-backend to use it in all your projects, or to .claude/skills/go-backend in one project. Or install the forgeline plugin, which includes it: /plugin marketplace add Nabwinsaud/forgeline, then /plugin install forgeline@forgeline.

### Does Go backend run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Go backend?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Go backend?

The closest alternatives to Go backend are Go database, Python backend, Go API design, Go error handling and Go GRPC.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Go database](https://ai-powered.com/skills/go-database): Go database is an open-source agent skill for databases.
- [Python backend](https://ai-powered.com/skills/python-backend): Python backend is an open-source agent skill for developer tools.
- [Go API design](https://ai-powered.com/skills/go-api-design): Go API design is an open-source agent skill for developer tools.
- [Go error handling](https://ai-powered.com/skills/go-error-handling): Go error handling is an open-source agent skill for developer tools.
- [Go GRPC](https://ai-powered.com/skills/go-grpc): Go GRPC is an open-source agent skill for developer tools.
- [Database migrations](https://ai-powered.com/skills/database-migrations-nabwinsaud): Database migrations is an open-source agent skill for databases.
- [Error handling](https://ai-powered.com/skills/error-handling): Error handling is an open-source agent skill for developer tools.
- [Backend engineering edho ferdian](https://ai-powered.com/skills/backend-engineering-edho-ferdian): Backend engineering edho ferdian is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/go-backend
