go-middleware

Implement a standardized middleware pipeline for Go net/http and chi applications.

1|Updated Jun 20, 2026
One-click install
npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill go-middleware-shafibabar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-middleware
Source: https://github.com/shafibabar/SDLC-Artifact-Factory/tree/main/skills/go-middleware
Command: npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill go-middleware-shafibabar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill addresses the complexity of building robust, production-grade Go HTTP middleware chains, preventing common pitfalls like incorrect ordering, panic leaks, and context key collisions.

Core Features & Use Cases

  • Middleware Ordering Standard: Enforces a strict, battle-tested sequence (Recoverer, RequestID, Telemetry, Logging, SecurityHeaders, CORS, Authenticate, RateLimit) to ensure security and observability.
  • Panic Recovery & Response Wrapping: Provides a standardized, safe boundary for panic recovery and response status recording, ensuring consistent error envelopes and preventing keep-alive connection corruption.
  • Use Case: When building a new backend service, use this skill to wire up your chi router with a standardized pipeline that handles authentication, rate limiting, and telemetry without manual, error-prone boilerplate.

Quick Start

Use the go-middleware skill to implement the standard request pipeline in your chi router and verify it against the quality criteria.

Frequently Asked Questions about go-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize Go HTTP middleware ordering for chi routers?

Standardize Go HTTP middleware ordering by enforcing a strict sequence: Recoverer, RequestID, Telemetry, Logging, SecurityHeaders, CORS, Authenticate, and RateLimit. This sequence ensures correct panic recovery, observability, and security boundaries within chi router pipelines.

What is the correct sequence for Go net/http middleware pipelines?

The correct sequence for Go net/http middleware pipelines is Recoverer, RequestID, Telemetry, Logging, SecurityHeaders, CORS, Authenticate, and RateLimit. This battle-tested order prevents common pitfalls like incorrect ordering, panic leaks, and context key collisions.

How do I prevent context key collisions in Go HTTP middleware?

Prevent context key collisions in Go HTTP middleware by ensuring type-safe context key ownership within a strict architectural boundary. This approach manages cross-cutting concerns securely across the HTTP request lifecycle without manual context handling errors.

Does this Go middleware pipeline handle panic recovery and keep-alive connections?

Yes, this Go middleware pipeline handles panic recovery and keep-alive connections by providing a standardized safe boundary. It ensures consistent error envelopes and prevents keep-alive connection corruption during response status recording.

Can I use this middleware pipeline for rate limiting and authentication in Go?

Yes, you can use this middleware pipeline for rate limiting and authentication in Go. It wires up chi routers with standardized pipelines that handle authentication and rate limiting alongside telemetry, replacing manual error-prone boilerplate.

Why does my Go HTTP middleware chain leak panics or drop telemetry data?

Go HTTP middleware chains leak panics or drop telemetry data due to incorrect middleware ordering. Enforcing a strict sequence starting with Recoverer and RequestID ensures panic recovery and telemetry capture happen before downstream processing.