roninforge/roninforge-go/go-new-service
Claude Code and agent skill by roninforge/roninforge-go
- community
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-serviceSKILL.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
- Create the binary at
cmd/<name>/main.go. Internal packages go underinternal/.
main()is a thin wrapper:
``go func main() { if err := run(); err != nil { slog.Error("fatal", "err", err) os.Exit(1) } } ``
run() errordoes:
- Set the default slog handler (JSON for production, text for local).
- Build a
context.Contextfromsignal.NotifyContext(... SIGINT, SIGTERM). - Wire dependencies (config, store, handler).
- Construct
&http.Server{Addr, Handler, ReadHeaderTimeout: 5 * time.Second}. - Run
ListenAndServein a goroutine sending toerrCh. - Select on
ctx.Done()(graceful shutdown) orerrCh. - On shutdown, call
srv.Shutdown(shutdownCtx)with a separate timeout.
- Routing uses stdlib
http.NewServeMuxwith method+path:
``go mux := http.NewServeMux() mux.HandleFunc("GET /users/{id}", h.GetUser) mux.HandleFunc("POST /users", h.CreateUser) ``
- Middleware is
func(http.Handler) http.Handler. Chain by wrapping.
- Handlers read path values with
r.PathValue("id")and passr.Context()to downstream calls.
- Add a
go.modwith the current Go version (go 1.24or higher) and thetooldirective if dev tools are pinned.
- Do not import
gorilla/mux,chi, orginunless the project already uses one. Stdlib is enough for new code.
- Never use
http.HandleFunc(...)on the default mux. Build your own.
- Always include
handler_test.gonext to the handler withhttptestsmoke tests for the routes. Go puts tests alongside source, never in a separatetests/directory.
Files to Generate
cmd/<name>/main.gointernal/handler/handler.gointernal/handler/handler_test.go(tests live next to the code, never in a separatetests/directory)go.mod(declare Go version)Makefilewithbuild,test,lint,runtargets (optional).golangci.ymlwitherrcheck,govet,staticcheck,errorlint,bodyclose,contextcheckenabled (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
- SKILL.md in the repositoryCheckingskills/go-new-service/SKILL.md
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
[](https://verified-skill.com/skills/roninforge/roninforge-go/go-new-service)