Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rust Axum Services?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/adityaaatiwari-rust-axum-services-anvil)
---
name: rust-axum-services
description: Build fast, safe Rust web APIs with Axum routers, typed extractors, Tower middleware, and shared state
---
<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->
# Rust Axum services
Use when building HTTP APIs or middleware in Rust with Axum and Tower.
## Routing and state
- Share pools and clients via `State<AppState>` wrapped in `Arc` instead of per-request initialization or globals.
- Order typed extractors correctly: extractors consuming the body (`Json`, `Bytes`) must come last in handler signatures.
- Return a domain `ApiError` enum implementing `IntoResponse` so internal errors log details internally while returning sanitized JSON.
## Concurrency and middleware
- Apply `tower::ServiceBuilder` with request timeouts, body size limits, and tracing layers at router boundaries.
- Offload CPU-heavy compression, hashing, or parsing with `tokio::task::spawn_blocking` to avoid starving the async executor.
- Use `axum::serve(...).with_graceful_shutdown(...)` so active connections finish before process exit.
## Verify
Run `cargo clippy --all-targets` and `cargo test` using `tower::ServiceExt::oneshot` against router endpoints.