agentleFS
kasevvladkasevvlad/claude-skills/skills/go-service/SKILL.md

go-service

Skill0 starsChanged 23 days agoMITView on GitHub

Create a new small Go service from scratch in the user's style - standard library HTTP, PostgreSQL or Redis, Docker, tests and Russian docs. Use when the user asks to "создай сервис на Go", "новый Go проект", "scaffold a Go service", or wants to start a Go learning project.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. Dankosik/golang-backend-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ask, in one message, only what is not clear from the request:

    line 12
  2. Very specific:

    Keep it flat. A single package main with files split by responsibility is the default.

    line 22
  3. Very specific:

    No comments in the code at all.

    line 47
  4. Very specific:

    Before finishing, run gofmt -l ., go vet ./...

    line 61
  5. Very specific:

    Do not create a GitHub repository or push: give the user the gh repo create command to run themselves.

    line 77

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Go service

Build a small, working Go service that looks like a learning project: simple, readable, honest about its limits. Prefer clarity over cleverness every time.

Agree on the scope first

Ask, in one message, only what is not clear from the request:

  • what the service does, in one sentence;
  • storage: none, PostgreSQL, Redis, or something else;
  • the repository name (default: kebab-case of the purpose).

Then propose the API or the main loop in a short list and wait for a yes before writing code.

Layout

Keep it flat. A single package main with files split by responsibility is the default; a separate package only when the code is meant to be imported as a library.

<name>/
  main.go              config, connections, start, graceful shutdown
  config.go            env variables with defaults
  api.go               HTTP handlers, if there is an API
  <core>.go            the main logic: worker.go, relay.go, limiter.go
  <core>_test.go
  integration_test.go  tests against real dependencies
  migrations/001_init.sql
  examples/            small programs that show how to use it
  docs/how-it-works.md
  docs/limitations.md
  Dockerfile
  docker-compose.yml
  Makefile
  README.md
  .gitignore

Code rules

  • Module path github.com/kasevvlad/<name>.
  • Standard library first: net/http with Go 1.22 patterns (mux.HandleFunc("POST /items/{id}", ...), r.PathValue), database/sql with github.com/jackc/pgx/v5/stdlib, log, encoding/json. Add a dependency only when the standard library has nothing.
  • No comments in the code at all. If something needs explaining, it goes into docs/how-it-works.md.
  • Plain error handling: if err != nil { return ..., err }, wrap with fmt.Errorf("...: %w", err) only where context helps. No panics outside main.
  • Config from environment via a small getEnv(name, default) helper. Every variable has a working default for local runs.
  • Graceful shutdown: signal.NotifyContext for SIGINT/SIGTERM, server.Shutdown with a timeout, background workers stop through the context and are awaited with sync.WaitGroup.
  • Work that must not be cut in half on shutdown (sending a request, a DB transaction) runs with its own context, not the cancelled one.
  • Concurrency only where the task needs it, and always with a test that runs it in parallel.
  • Time is injectable (now func() time.Time) in anything that depends on it, so tests never sleep for real.
  • Names are boring and clear: processOne, publishBatch, loadConfig.

Tests

  • Unit tests for pure logic with table-driven cases.
  • Integration tests against real dependencies. PostgreSQL tests skip when TEST_DATABASE_URL is empty; Redis can use github.com/alicebob/miniredis/v2; NATS can run in-process via github.com/nats-io/nats-server/v2/server.
  • make test-integration (or make test) starts what is needed in Docker and creates a separate test database.
  • Before finishing, run gofmt -l ., go vet ./... and go test -race ./... and fix everything. Then run the service with docker compose up and exercise it once end to end with curl or the example program.

Docker

  • Multi-stage Dockerfile: golang:<version from go.mod>-alpine to build with CGO_ENABLED=0, alpine to run.
  • docker-compose.yml with the dependencies, healthchecks, migrations mounted into docker-entrypoint-initdb.d, and the service itself. Pick host ports that do not clash with the user's other projects (check with docker ps and existing compose files nearby).

Documentation

  • README.md in English: first line says it is a learning project and what it practises; then what it does, how to run, API table, config table, how to run tests. Short.
  • docs/how-it-works.md in Russian: why the service exists, the path of one request or event, the interesting decisions explained in plain words with small diagrams, and which test proves each important property.
  • docs/limitations.md in Russian: honest list of what is simplified and what a production version would do differently.

Finishing

  • git init -b main and one commit with a plain message. No AI attribution, no Co-Authored-By trailer.
  • Do not create a GitHub repository or push: give the user the gh repo create command to run themselves.
  • Tell the user which parts to read first so they can explain the project in an interview.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.