Skip to content
Back to skills

Go Http Services

ASecurity

Build production Go HTTP servers using net/http, chi/mux middleware, explicit timeouts, and graceful shutdown

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentgodatabase

Works with

  • cli

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill go-http-services --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Go Http Services?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Go Http Services
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-go-http-services-anvil/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-go-http-services-anvil)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: go-http-services
description: Build production Go HTTP servers using net/http, chi/mux middleware, explicit timeouts, and graceful shutdown
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# Go HTTP services

Use when implementing HTTP handlers, routing, or server lifecycle code in Go.

## Server setup
- Never use `http.ListenAndServe` or `http.DefaultClient`; configure `http.Server` with `ReadHeaderTimeout`, `ReadTimeout`, `WriteTimeout`, and `IdleTimeout`.
- Propagate `r.Context()` into every database, cache, and outbound HTTP call so client disconnects cancel downstream work.
- Handle `SIGINT`/`SIGTERM` with `signal.NotifyContext` and `server.Shutdown(ctx)` to drain in-flight requests cleanly.

## Handlers and middleware
- Read request bodies through `http.MaxBytesReader` to bound memory allocation on malformed payloads.
- Write structured middleware for request IDs, panic recovery, and latency metrics without mutating global state.
- Map domain errors to consistent JSON status codes in one helper rather than calling `http.Error` ad hoc.

## Verify
Run `go test -race ./...` using `httptest.NewRequest` and `httptest.NewServer` for routing, timeouts, and shutdown.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.