rust-web
Skill1 starsChanged 5 days agoMITView on GitHub
Design, implement, test, and operate production Rust server-side HTTP services, including axum, Actix Web, routing, extractors, application state, error mapping, middleware order, timeouts, body limits, observability, graceful shutdown, and database boundaries. Use when users ask for Rust REST APIs, web handlers, middleware, server lifecycle, HTTP contracts, or production web-service architecture; hand security controls to rust-web-security.
3 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- gurinderu/crafttheir own version, first seen Nov 29, 2026
- full-stack-skills/rust-skillsedited, first seen Oct 15, 2026
- huiali/rust-skillstheir own version, first seen Feb 9, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- full-stack-skills/rust-skills★ 898% same
Wrote their own version · 2
- huiali/rust-skills★ 47same name
- gurinderu/craft★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- accessibilitySkill
- cargo-fuzzSkill
- core-web-vitalsSkill
- impeccableSkill
- property-based-testingSkill
- rust-best-practicesSkill
- rust-cargo-buildSkill
- rust-cliSkill
- rust-concurrencySkill
- rust-databaseSkill
- rust-http-clientSkill
- rust-performanceSkill
- rust-testingSkill
- rust-web-securitySkill
- sonjoo-auditSkill
- sonjoo-auditSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Before modification, verify from OpenAPI specs, existing routes, clients, tests, configuration, and run environments:
- Very specific: line 40
Verify service entry points, router composition, state management, error types, middleware ordering, shutdown signals, and testing tools.
- Very specific: line 68
Avoid .await operations across lock-held states.
- Very specific: line 69
Do not use unwrap()/expect() for handling failures in requests, network access, database queries, or serialization.
- Very specific: line 76
Not found, conflicts, and permission denials → stable client-error statuses such as 404, 409, and 403.
- Distinctive: line 98
Ensure cancellation propagates downward to clean up subtasks without creating leaked tasks detached from request lifetimes.
- Distinctive: line 109
Ensure transaction coverage across complete use cases without unnecessary external network waits.
- Distinctive: line 137
Add OpenAPI/schema compatibility checks, integration environment tests, and security scans per project.
- Distinctive: line 146
When real databases, networks, TLS connections, or deployments are unverified, remaining boundaries must be explicitly marked.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust HTTP Service Delivery
Deliver server-side HTTP APIs based on HTTP contracts and runtime lifecycles. The framework handles transport adaptation; domain logic and data access remain independently testable without embedding all backend issues into handlers.
Confirming the Service Contract
Before modification, verify from OpenAPI specs, existing routes, clients, tests, configuration, and run environments:
- Methods, paths, status codes, request/response schemas, and compatibility strategies;
- Authentication context origin (authentication system design is outside this skill scope);
- Request bodies, concurrency limits, timeouts, upload sizes, and response size constraints;
- Dependencies on external HTTP services, databases, caches, or queues, including failure semantics;
- Listening addresses, proxies, TLS termination, health checks, graceful shutdown budgets;
- Rust/MSRV versions of axum, Tokio, Tower, and related crates with locked dependencies;
- Logging levels, tracing configuration, metrics exposure, sensitive field handling, data retention policies.
Response fields from existing client libraries constitute compatibility constraints. When contracts are missing, declare minimal assumptions first.
Workflow
1. Establish Current Baseline
rustc --version --verbose
cargo metadata --format-version 1
cargo tree -e features
cargo test --all-targetsVerify service entry points, router composition, state management, error types, middleware ordering, shutdown signals, and testing tools. Adhere strictly to Cargo.lock versions and official documentation; do not mix axum/Tower APIs based on memory rather than versioned specifications.
2. Define Transport Boundaries
Recommended call flow:
HTTP request
-> router / extractor / transport validation
-> application service / use case
-> repository or outbound HTTP port
-> domain result/error
-> centralized HTTP response mapping- Handlers perform extraction, transport-layer validation, invoke use cases, and map responses;
- Domain logic does not depend on axum request/response types;
- Database connection pools and HTTP clients serve as stateful dependencies within the service layer; do not store business data in global locks.
- Transactions belong to use case/data access boundaries and are not scatteredly controlled by handlers.
- DTOs, domain models, and persistence models should be separated based on change reasons to avoid unintended reuse of structures without control.
Refer to Service Boundaries when determining specific layering or adapter requirements.
3. Implement Routing and Input Boundaries
- Route paths, extractors, and response types must align with locked axum versions;
- Explicitly validate path parameters, query strings, headers, and request bodies to distinguish syntax errors from domain conflicts;
- Enforce limits on request body size, uploads, pagination, and batch sizes;
- Avoid
.awaitoperations across lock-held states; prefer delegating shared mutable state to dedicated services or storage mechanisms. - Do not use
unwrap()/expect()for handling failures in requests, network access, database queries, or serialization; instead, convert unexpressible preconditions into type-level checks and centralized validation that avoids duplication across multiple handlers.
4. Unified Error Response Mapping
Define a single mapping from application errors to HTTP responses:
- Validation failures → client-fixable 4xx status codes;
- Not found, conflicts, and permission denials → stable client-error statuses such as
404,409, and403; - Downstream unavailability, timeouts, internal defects → 5xx status codes that do not leak internal details.
Each error response must include a stable machine code and request/tracing identifiers for correlation. Full error chains enter controlled logging; responses should not expose SQL queries, tokens, file paths, or backtraces. Avoid mapping all errors to 500 or hiding failures by returning 200.
5. Middleware Composition and Security Boundaries
Review the Tower middleware layer in accordance with actual call order:
- Redact sensitive headers while retaining request IDs and trace identifiers;
- Configure global and downstream timeouts;
- Enforce request body limits and concurrency/load protection measures;
- Integrate authentication contexts and authorization checks at appropriate points.
- Maintain precise CORS allowlists; do not default to permissive policies when credentials are present in the service chain.
- Account for CPU costs associated with compression and risks of exposing sensitive responses under compressed headers.
- Trust proxy headers only from explicitly controlled sources.
Middleware ordering, timeout configurations, and graceful shutdown strategies are documented in Middleware and Lifecycle.
6. Managing Async Lifecycles
- Configure layered timeouts for servers, external requests, and database operations;
- Ensure cancellation propagates downward to clean up subtasks without creating leaked tasks detached from request lifetimes;
- Gracefully shut down by stopping new incoming requests while exhausting in-flight ones within budget limits before releasing resources.
- Distinguish between non-retryable and retryable errors; retries require budgets, backoff strategies, and idempotency guarantees.
- Route deep design of Tokio tasks, channels,
Send/Sync, cancellation safety, and lock scopes to$rust-concurrency.
7. Bounded External Adapter Access
This skill can integrate with services requiring databases or outbound HTTP clients but focuses solely on the server-side boundary:
- Reuse connection pools/client instances rather than creating new ones per request;
- Configure timeouts, connection limits, and observable error reporting for downstream components;
- Ensure transaction coverage across complete use cases without unnecessary external network waits.
- Route schema migrations, indexes, transactions, SQL tuning, and ORM modeling to
$rust-database. - Independent SDKs, crawlers, or bulk HTTP clients are not part of the server-side main flow; they belong to separate tooling domains.
- Route JWT/OAuth flows, sessions, tokens, CORS/CSRF policies, and secret management to
$rust-web-security; this skill only consumes principal identities and authorization outcomes from verified sources. - WebSocket upgrades, message protocols, heartbeat mechanisms, and backpressure handling are processed as independent sub-flows when explicitly requested.
8. Layered Service Testing
Ensure coverage of:
- Domain/use case pure tests;
- Router-level request testing without binding to real ports per use case;
- Extractor failures, error mapping logic, body limits, timeouts, and authentication boundaries;
- External adapter contract validation and fault injection scenarios;
- Database migration isolation, commits, rollbacks when requiring real databases;
- Limited socket tests verifying listening behavior, proxy configurations, or graceful shutdown dynamics.
Detailed test matrices are provided in HTTP Service Testing. Test organization, coverage targets, CI gate policies, and performance baselines fall under the purview of rust-testing.
Common Gates
cargo fmt --all -- --check
cargo check --all-targets
cargo test --all-targets
cargo clippy --all-targets -- -D warningsAdd OpenAPI/schema compatibility checks, integration environment tests, and security scans per project. Do not silently skip failing dependency-based tests to claim overall pass status.
Completion Criteria
- HTTP contracts, versioning assumptions, and compatibility guarantees are explicit;
- Handlers remain thin with domain logic and external adapters testable independently;
- Error handling, status codes, timeouts, middleware ordering, and graceful shutdown behaviors have corresponding tests;
- Logs and responses do not leak secrets or internal details.
cargo fmt,cargo check,cargo test, andclippypass successfully;- When real databases, networks, TLS connections, or deployments are unverified, remaining boundaries must be explicitly marked.
Handoff Boundaries
| Primary Issue | Assigned Responsibility |
| Schema definitions, migrations, transactions, connection pools, SQL/ORM modeling | rust-database |
| Authentication, authorization, sessions/tokens, CORS/CSRF policies, SSRF protection | rust-web-security |
| Tokio tasks, locks, channels, cancellation safety, graceful shutdown implementation | rust-concurrency |
| Test layering strategies, coverage targets, attribute tests, performance baselines | rust-testing |
| Ownership semantics, serde type contracts, generic error design patterns | rust-best-practices |
| Features, workspace configurations, build scripts, release pipelines | rust-cargo-build |
| Unsafe network libraries, C ABI interfaces, raw buffer handling | The Rustonomicon |
On-Demand Resources
- Service Boundaries: Consult when designing handlers, state management, data structures, or outbound HTTP adapters.
- Middleware and Lifecycle: Review Tower configuration, timeout policies, CORS rules, load balancing strategies, or graceful shutdown logic.
- HTTP Service Testing: Refer to design patterns for router integration, end-to-end testing, fault injection scenarios.
- Examples: Use templates for end-to-end task decomposition when needed.
examples/golden-handler/: Offline compilation and verification of transport boundary behavior and error mapping logic.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

