roninforge/roninforge-go/go-new-service

Claude Code and agent skill by roninforge/roninforge-go

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Scaffold a modern Go HTTP service: main.go with graceful shutdown, slog setup, 1.22+ ServeMux with method routing, ReadHeaderTimeout, and a run() error wrapper.

Install

npx vskill@latest install roninforge/roninforge-go/go-new-service

SKILL.md

The same SKILL.md was published earlier as roninforge/roninforge-go/go-new-service.

Scaffold Go HTTP Service

When to Use

When creating a new Go HTTP service or rewriting an old http.ListenAndServe(...)-style server.

Instructions

  1. Create the binary at cmd/<name>/main.go. Internal packages go under internal/.
  1. main() is a thin wrapper:

``go func main() { if err := run(); err != nil { slog.Error("fatal", "err", err) os.Exit(1) } } ``

  1. run() error does:
  • Set the default slog handler (JSON for production, text for local).
  • Build a context.Context from signal.NotifyContext(... SIGINT, SIGTERM).
  • Wire dependencies (config, store, handler).
  • Construct &http.Server{Addr, Handler, ReadHeaderTimeout: 5 * time.Second}.
  • Run ListenAndServe in a goroutine sending to errCh.
  • Select on ctx.Done() (graceful shutdown) or errCh.
  • On shutdown, call srv.Shutdown(shutdownCtx) with a separate timeout.
  1. Routing uses stdlib http.NewServeMux with method+path:

``go mux := http.NewServeMux() mux.HandleFunc("GET /users/{id}", h.GetUser) mux.HandleFunc("POST /users", h.CreateUser) ``

  1. Middleware is func(http.Handler) http.Handler. Chain by wrapping.
  1. Handlers read path values with r.PathValue("id") and pass r.Context() to downstream calls.
  1. Add a go.mod with the current Go version (go 1.24 or higher) and the tool directive if dev tools are pinned.
  1. Do not import gorilla/mux, chi, or gin unless the project already uses one. Stdlib is enough for new code.
  1. Never use http.HandleFunc(...) on the default mux. Build your own.
  1. Always include handler_test.go next to the handler with httptest smoke tests for the routes. Go puts tests alongside source, never in a separate tests/ directory.

Files to Generate

  • cmd/<name>/main.go
  • internal/handler/handler.go
  • internal/handler/handler_test.go (tests live next to the code, never in a separate tests/ directory)
  • go.mod (declare Go version)
  • Makefile with build, test, lint, run targets (optional)
  • .golangci.yml with errcheck, govet, staticcheck, errorlint, bodyclose, contextcheck enabled (optional)

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/roninforge/roninforge-go/go-new-service/badge)](https://verified-skill.com/skills/roninforge/roninforge-go/go-new-service)

Something wrong with this skill or its page? Tell us.