skills/axum/SKILL.md
ALWAYS invoke this skill BEFORE writing or modifying Axum web server code including routing, handlers, extractors, middleware, state management, Tower layers, error handling, or Leptos SSR integration. Covers axum 0.8, tower 0.5, tower-http 0.6. MANDATORY for all Axum development.
npx skillsauth add HadiCherkaoui/opencode-config axumInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ALWAYS load relevant sub-guidelines BEFORE writing Axum code. This skill covers axum 0.8.x with Tower 0.5 and tower-http 0.6.
| Task | Load |
|------|------|
| Creating routes, handlers, extractors (Path, Query, Json, Form) | 01_fundamentals.md |
| Application state, middleware, Tower layers, CORS, tracing | 02_state_middleware.md |
| Response types, IntoResponse, error handling, custom errors | 03_responses_errors.md |
| WebSocket, SSE, multipart uploads, testing, graceful shutdown | 04_advanced.md |
| Leptos SSR integration, server functions, cargo-leptos | 05_leptos_integration.md |
[dependencies]
axum = "0.8"
tokio = { version = "1", features = ["full"] }
tower = "0.5"
# Common additions:
tower-http = "0.6" # TraceLayer, CorsLayer, CompressionLayer, etc.
serde = { version = "1", features = ["derive"] }
| Crate | Compatible Version | Latest Verified | |-------|-------------------|-----------------| | axum | 0.8 | 0.8.8 | | axum-extra | 0.12 | 0.12.5 | | axum-core | 0.5 | 0.5.5 | | tokio | ^1.44 | 1.44+ | | tower | 0.5 | 0.5.3 | | tower-http | 0.6 | 0.6.8 | | hyper | ^1.1.0 | 1.x | | http | ^1.0.0 | 1.x | | matchit | =0.8.4 | 0.8.4 | | leptos_axum | 0.8 | 0.8.7 |
{param} syntax (NOT :param). Wildcards: {*path} (NOT *path)Router<S> means state S is MISSING — call .with_state(s) to get Router<()> before serving.layer() only applies to routes declared BEFORE it — order matters/foo and dynamic /{key} are NOT overlapping#[debug_handler] when debugging handler type errors (requires macros feature)std::sync::Mutex across .await — use tokio::sync::Mutex insteadDefaultBodyLimitOriginalUri if you need the full pathprovide_context over State<T> for sharing data with components/server fnsDefault: http1, json, form, query, matched-path, original-uri, tokio, tower-log, tracing
Enable as needed: http2, macros, multipart, ws
NestedPath extractor — returns the path prefix stripped by nestingRawPathParams, RawForm, RawQuery extractorsNoContent response type (HTTP 204)#[debug_middleware] attribute macro (requires macros feature)OptionalFromRequestParts / OptionalFromRequest traits for Option<T> extractionRouter::without_v07_checks() — allows legacy :param syntax during migrationRouter::method_not_allowed_fallback() — custom 405 handlerRouter::has_routes() — check if router has any routesfrom_extractor / from_extractor_with_state middlewaremap_request / map_response middleware functions/:id -> /{id}, /*path -> /{*path}#[async_trait] from custom FromRequest/FromRequestParts impls (native async fn in traits)Option<T> extractor: T must now impl OptionalFromRequestParts / OptionalFromRequesttower 0.5, tower-http 0.6, hyper 1.x, http 1.0Router::without_v07_checks() available for gradual migration of :param -> {param}Message::Text in WebSocket now wraps Utf8Bytes (not String)development
Use when you have a spec or requirements for a multi-step task, before touching code
data-ai
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
tools
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
development
Use when implementing any feature or bugfix, before writing implementation code