Rust Axum Cursor Rules (.mdc) | Free & Offline

Production-grade architectural rulebook for Rust & Axum. Engineered to eliminate LLM hallucinations, enforce strict deterministic conventions, and prevent architectural drift across Cursor IDE, Claude Code CLI, and autonomous multi-agent pipelines.

Target Path
.cursor/rules/rust-axum.mdc
Execution Scope
Glob Pattern Auto-Match
Specification Format
Frontmatter MDC (.mdc)
AI Tool Support
Cursor IDE & Composer
02 / DRIFT ANALYSIS & VALUE PROPOSITION

Failure Patterns Prevented for Rust & Axum

Without This Rule (Default LLM Behavior)Vulnerable

Rust async borrow checker rules and Axum extractor ordering can confuse LLMs. These rules enforce proper State injection, custom error enums with `IntoResponse`, and minimal unwrap() usage.

Hallucination Symptoms
  • Invokes deprecated or removed APIs from older model training weights
  • Generates conflicting configuration files and invalid imports
  • Silently drops type-safety, boundaries, or transaction isolation
With This Rule (Guaranteed Invariants)Deterministic
Never call `.unwrap()` or `.expect()` in production route handlers; propagate errors via `Result<T, AppError>`.
Implement `IntoResponse` on custom application error enums with appropriate HTTP status codes.
Use `State(app_state)` extractors for shared database pools and configurations.
Keep Axum handlers strongly typed with `Json<T>` and `Path<T>` extractors.
04 / REPOSITORY PLACEMENT & INSTALLATION

Where to Save This Rule in Your Repository

Export the rules from the interactive editor above or download the full ZIP bundle. Ensure the file is placed at the exact path below relative to your project root so the AI engine automatically loads it:

.cursor/rules/rust-axum.mdc
05 / ROUTE DIRECTORY & CROSS-TOOLING
Format Pillar HubComprehensive Manual

Cursor Rules (.mdc) Directory & Generator

Inspect the complete specification manual, glob patterns, directory rules, and all available presets in our central directory.

/cursor-rules Directory
06 / FREQUENTLY ASKED QUESTIONS

Technical FAQ: Rust & Axum AI Rulebooks

Does this rule forbid unwrap()?

Yes! Production code paths are strictly constrained to proper Result propagation.