← ClaudeAtlas

chilisted

Chi lightweight Go HTTP router. Covers routing, middleware, context, and patterns. Use for idiomatic, stdlib-compatible Go APIs. USE WHEN: user mentions "chi", "go-chi", "lightweight go router", "stdlib go router", asks about "chi middleware", "chi router", "chi context", "idiomatic go api", "net/http compatible router", "chi patterns" DO NOT USE FOR: Gin projects - use `gin` instead, Echo projects - use `echo` instead, Fiber projects - use `fiber` instead, non-Go backends
claude-dev-suite/claude-dev-suite · ★ 33 · AI & Automation · score 80
Install: claude install-skill claude-dev-suite/claude-dev-suite
# Chi Core Knowledge > **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `chi` for comprehensive documentation. ## Basic Setup ```go package main import ( "net/http" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" ) func main() { r := chi.NewRouter() r.Use(middleware.Logger) r.Use(middleware.Recoverer) r.Get("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello, World!")) }) http.ListenAndServe(":8080", r) } ``` ## Routing ### Basic Routes ```go r := chi.NewRouter() r.Get("/users", listUsers) r.Get("/users/{id}", getUser) r.Post("/users", createUser) r.Put("/users/{id}", updateUser) r.Delete("/users/{id}", deleteUser) // Method not allowed handler r.MethodNotAllowed(methodNotAllowedHandler) // Not found handler r.NotFound(notFoundHandler) ``` ### Path Parameters ```go r.Get("/users/{userID}", func(w http.ResponseWriter, r *http.Request) { userID := chi.URLParam(r, "userID") json.NewEncoder(w).Encode(map[string]string{"id": userID}) }) // Regex constraints r.Get("/articles/{date:\\d{4}-\\d{2}-\\d{2}}", getArticleByDate) // Catch-all r.Get("/files/*", serveFiles) ``` ### Route Groups ```go r := chi.NewRouter() r.Route("/api", func(r chi.Router) { r.Route("/v1", func(r chi.Router) { r.Get("/users", listUsersV1) r.Post("/users", createUserV1) }) r.Route("/v2", func(r chi.Router) { r.Get("/users", listUsersV2)