Covers the fundamental constraints of building web services in Rust: why handlers must be async, how to manage shared state with Arc, and when to use type-safe extractors for validation. The framework comparison (axum vs actix vs warp) is helpful if you're still choosing, but the real value is in the constraint-to-implementation traces. It shows you why blocking code kills latency and why Rc doesn't work in handler state. The error handling pattern with IntoResponse is solid boilerplate you'll actually use. Think of this as the bridge between "I need a REST API" and understanding why the borrow checker is yelling at you about Send bounds.

skills.sh installs
648
GitHub stars
1.3K
last updated
Jul 14, 2026

Install

$ npx -y skills add zhanghandong/rust-skills --skill domain-web --agent claude-code

Installs into .claude/skills of the current project.

Files

Web Domain

Layer 3: Domain Constraints

Domain Constraints → Design Implications

Domain RuleDesign ConstraintRust Implication
Stateless HTTPNo request-local globalsState in extractors
ConcurrencyHandle many connectionsAsync, Send + Sync
Latency SLAFast responseEfficient ownership
SecurityInput validationType-safe extractors
ObservabilityRequest tracingtracing + tower layers

Critical Constraints

Async by Default

RULE: Web handlers must not block
WHY: Block one task = block many requests
RUST: async/await, spawn_blocking for CPU work

State Management

RULE: Shared state must be thread-safe
WHY: Handlers run on any thread
RUST: Arc<T>, Arc<RwLock<T>> for mutable

Request Lifecycle

RULE: Resources live only for request duration
WHY: Memory management, no leaks
RUST: Extractors, proper ownership

Trace Down ↓

From constraints to design (Layer 2):

"Need shared application state"
    ↓ m07-concurrency: Use Arc for thread-safe sharing
    ↓ m02-resource: Arc<RwLock<T>> for mutable state

Sponsors

Details

Repository
github.com/zhanghandong/rust-skills
Category
Rust

More from zhanghandong/rust-skills

All 34

Recommended

More Rust
1zhanghandong avatardomain-iotzhanghandong/rust-skillsdomain iot568skills.sh installs
2warpdotdev avatarfix-errorswarpdotdev/common-skillsFix compilation errors, linting issues, and test failures in the warp Rust codebase. Covers presubmit checks, WASM-specific errors, and running specific tests. 28.7Kskills.sh installs
3wshobson avatarmemory-safety-patternswshobson/agentsImplement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C. Use when writing safe systems code, man12.2Kskills.sh installs
4dotnet avatartest-gap-analysisdotnet/skillsPerforms pseudo-mutation analysis on production code in any language to find gaps in existing tests. Use when the user asks to find weak or shallow tests, disco4.3Kskills.sh installs
5actionbook avatarm02-resourceactionbook/rust-skillsCRITICAL: Use for smart pointers and resource management. Triggers: Box, Rc, Arc, Weak, RefCell, Cell, smart pointer, heap allocation, reference counting, RAII,3.6Kskills.sh installs
6actionbook avatarm09-domainactionbook/rust-skillsCRITICAL: Use for domain modeling. Triggers: domain model, DDD, domain-driven design, entity, value object, aggregate, repository pattern, business rules, valid3.5Kskills.sh installs