Skip to main content

monolith-routing-and-middleware

Use when editing route registration, middleware ordering, CSRF behavior, and request pipeline behavior for HTTP handlers.

跳到安装

来源信息

仓库
cggonzal/monolith
最近来源活动
2026年2月14日 03:11
检测到的 SKILL.md 语言
英语
星标
0
分支
0

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
monolith-routing-and-middleware
description
Use when editing route registration, middleware ordering, CSRF behavior, and request pipeline behavior for HTTP handlers.
# Monolith Routing and Middleware ## Use this skill when - Adding new HTTP endpoints. - Inserting request/response middleware. - Troubleshooting request flow issues. ## Routing fundamentals - Main router is `http.ServeMux` in `app/routes/routes.go`. - Routes are registered in `registerRoutes`. - Pattern format uses method + path (e.g., `"GET /widgets/{id}"`). ## Middleware fundamentals - Middleware registration order lives in `app/middleware/registration.go`. - Current baseline includes logging and CSRF middleware. - Middleware wraps mux globally through `InitServerHandler`. ## Adding middleware safely 1. Implement `func(http.Handler) http.Handler` in `app/middleware/`. 2. Add it to registration slice in desired order. 3. Ensure it is side-effect free and deterministic. 4. Add tests similar to existing middleware tests. ## CSRF behavior `CSRFMiddleware` leverages Go's cross-origin protections; keep it in the stack unless you intentionally disable protection for a specific reason.
在 GitHub 查看