axum-impl-middleware
OfficialAdd safe Axum middleware without order bugs.
Software Engineering#axum#auth gate#middleware ordering#tower middleware#from_fn#route_layer#Next::run
AuthorImpertio-Studio
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill prevents common Axum/Tower middleware wiring mistakes that either fail to compile or silently skip your handler logic. It also avoids subtle routing bugs where an auth gate incorrectly converts missing routes into unauthorized responses.
Core Features & Use Cases
- Correct middleware helper selection: choose
map_request/map_responsefor one-way transforms andfrom_fn/from_fn_with_statewhen you need request+response handling or short-circuiting. - Guaranteed
from_fnargument ordering: enforces the required shape of[FromRequestParts..., FromRequest, Next]to avoid opaqueHandler is not satisfiedtrait-bound errors. - Safe control flow with
Next: ensures middleware either callsnext.run(request).awaitor deliberately short-circuits with anIntoResponse, avoiding “handler never runs” incidents. - Correct
.layer()vs.route_layer()semantics: uses.route_layer()for auth/authz so unmatched paths still return real404instead of being masked as401/403. - Layer stacking without reversal confusion: clarifies how Router’s chained
.layer()order differs fromtower::ServiceBuilder, preventing request/response execution order surprises.
Quick Start
Add middleware to your Axum routes by asking for a from_fn or from_fn_with_state example that uses the correct argument order, short-circuit behavior, and .route_layer() for auth gates on Axum 0.7/0.8.
Dependency Matrix
Required Modules
None requiredComponents
references
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: axum-impl-middleware Download link: https://github.com/Impertio-Studio/Axum-Claude-Skill-Package/archive/main.zip#axum-impl-middleware Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.