Write or review Rust backend code for the Static Web Server (SWS) project — crates, modules, functions, types, error handling, and async code

Apache-2.0Auto-check passedDevelopment

Install Rust Backend

skills CLI
$ npx skills add static-web-server/static-web-server --skill rust-backend -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install static-web-server/static-web-server rust-backend --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/static-web-server/static-web-server.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rust-backend .claude/skills/rust-backend && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rust-backend
GitHub stars
2.4k
Token cost
~1.7k tokens
SKILL.md length
726 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
Apache-2.0

At a glance

Write or review Rust backend code for the Static Web Server (SWS) project — crates, modules, functions, types, error handling, and async code

  • Works in 2 steps: cargo clippy --features all -- -D warnings → cargo clippy --features all --tests --…
  • Tasks that involve Error handling
  • SKILL.md covers Mandatory Tools, Code Quality, Error Handling and Async Code, plus 4 more sections
  • Calls cargo

What it does

Rust Backend is an agent skill from static-web-server/static-web-server. Write or review Rust backend code for the Static Web Server (SWS) project — crates, modules, functions, types, error handling, and async code

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Error handling and Code quality. It works with Rust and Linux. The repository describes itself as: A cross-platform, high-performance and asynchronous web server for static files-serving. ⚡. The licence is Apache-2.0.

When your agent uses it

  • Tasks that involve Error handling
  • Tasks that involve Code quality

Example prompts

  • “/rust-backend”

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. cargo clippy --features all -- -D warnings
  2. cargo clippy --features all --tests -- -D warnings

What it can do on your machine

Read from SKILL.md and the folder at commit 32ec4aa. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Rust Backend loads about 1.7k tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 726 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~39
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from static-web-server/static-web-server at commit 32ec4aa, republished under its Apache-2.0 licence (© static-web-server). 726 words, ~1,674 tokens.

Download SKILL.mdSave it as .claude/skills/rust-backend/SKILL.md (or your agent's skills folder).
name
rust-backend
description
Write or review Rust backend code for the Static Web Server (SWS) project — crates, modules, functions, types, error handling, and async code

Rust Backend Coding Standards

Load this skill when writing, reviewing, or refactoring Rust code in the SWS project.

When to load: editing any file under src/, adding a new module, changing error handling, touching async code, or reviewing a PR that modifies Rust source.

Mandatory Tools

Always use the following commands to maintain code quality and consistency:

Linting
  1. cargo clippy --features all -- -D warnings
  2. cargo clippy --features all --tests -- -D warnings
Formatting
  1. cargo fmt --all -- --check tests/*.rs
Testing
  1. cargo test -v --features all
  2. cargo test -v --no-default-features
Cargo docs lint
cargo +nightly rustdoc --lib -Zrustdoc-map --features all \
    --config "build.rustflags=[\"--cfg\", \"tokio_unstable\"]" \
    -Zhost-config -Ztarget-applies-to-host \
    --config "host.rustflags=[\"--cfg\", \"tokio_unstable\"]" \
    --config "build.rustdocflags=[\"--cfg\", \"docsrs\", \"--cfg\", \"docsrs\", \"--cfg\", \"tokio_unstable\", \"-Z\", \"unstable-options\", \"--emit=invocation-specific\", \"--cap-lints\", \"warn\", \"--extern-html-root-takes-precedence\"]" \
    -Zunstable-options -- --document-private-items

Code Quality

  • All clippy commands in Mandatory Tools must pass with zero warnings before committing
  • unsafe is forbidden at the crate level: SWS uses #![forbid(unsafe_code)]. Consider refactoring to avoid unsafe entirely
  • Prefer &Path over &PathBuf in function parameters. Accept impl AsRef<Path> for public APIs
  • Use #[must_use] on pure functions whose return value should not be silently discarded
  • Derive common traits explicitly: Debug, Clone, PartialEq, Eq on all public types unless there is a reason not to
  • No commented-out code: Delete it. Git history preserves it

Error Handling

  • Use the crate's Result<T> and Error types: Defined in src/error.rs. All fallible functions return Result<T> or Result<T, StatusCode> for HTTP-level errors
  • Use anyhow::Context for wrapping: fallible_op().with_context(|| "failed to parse config")?
  • No unwrap() or expect() in production code: Use ? or match. Allow expect only for values guaranteed by prior validation (e.g., a regex that is known to compile, a lock that should never be poisoned). Add an inline comment explaining the invariant
  • Log errors at the boundary: Module code returns errors. The HTTP handler (handler.rs) logs them and converts to HTTP status codes
  • Distinguish HTTP status codes from internal errors: StatusCode (hyper) for HTTP semantics; Error (anyhow) for internal failures. Functions use Result<T, StatusCode> when the only possible failures are HTTP-level

Async Code

  • Use tokio as the runtime: All async code targets tokio (multi-threaded, rt-multi-thread feature)
  • No block_on in async context: Never call tokio::runtime::Handle::block_on inside an async function
  • Prefer spawn_blocking for CPU-bound work: Offload file hashing, compression dictionary building, etc.
  • Use hyper as the HTTP framework: SWS is built on hyper v1 with http-body-util. src/service.rs defines RouterService and RequestService, which implement hyper::service::Service and delegate to RequestHandler::handle()

HTTP & Request Handling

  • Request pipeline ordering: handler.rs orchestrates the request flow in a fixed order with three phases:
    • Pre-processing (may short-circuit with a response): method check → health/metrics → CORS → basic auth → maintenance mode → redirects → rewrites → virtual hosts → markdown negotiation
    • Core: static file resolution and serving
    • Post-processing (additive, runs on every response): fallback page → CORS headers → text charset → static compression → dynamic compression → cache-control → security headers → custom headers
  • Post-processing is additive: Each post-processing step appends or modifies headers. No step removes headers set by a previous step unless explicitly documented
  • Response body type: crate::body::Body is a type alias for BoxBody<Bytes, std::io::Error> (defined in src/body.rs). Use the constructors crate::body::empty(), crate::body::full(impl Into<Bytes>), or crate::body::stream<S>(s)
  • Static file serving is the core: static_files.rs handles path resolution, index files, directory listing, pre-compressed variants, and byte-range requests
Show full SKILL.md (231 more words)Show less

Settings & Configuration

  • Three equivalent channels: CLI arguments (clap), environment variables, and TOML config file. Defined in src/settings/
  • Precedence (lowest to highest): compiled defaults → TOML config file → environment variables → CLI arguments. Runtime validation runs after merging
  • Feature-gated settings: Settings that require Cargo features (e.g., compression, directory-listing) are conditionally compiled with #[cfg(feature = "...")]
  • Validation at startup, not per-request: Canonicalize paths, validate TLS certificates, parse index files once at startup in server/opts.rs

File System

  • Canonicalize paths once at startup: The root directory is canonicalized in server/opts.rs. Per-request path resolution reuses this canonical base
  • Path traversal prevention: sanitize_path() (in src/fs/path.rs) strips .., root prefixes, and other traversal components. resolve_and_contain() (in src/static_files/security.rs) verifies the resolved path stays within the base directory
  • Symlink policy: When --follow-symlinks is disabled (default), enforce_symlink_policy() (in src/static_files/security.rs) walks each path component checking for symlinks via symlink_metadata(). This is a syscall per component — check cheaper guards (hidden files) first
  • File metadata operations: try_metadata() and try_metadata_with_html_suffix() (in src/fs/meta.rs) encapsulate filesystem access with proper error mapping to HTTP status codes

Patterns to Avoid

  • No String as an error type: Use structured errors or StatusCode
  • No Box<dyn Error>: Use anyhow::Error
  • No global mutable state: No static mut or lazy_static! with Mutex. SWS uses Arc<RequestHandlerOpts> for shared read-only config
  • No deep nesting: Extract nested conditionals into named functions or match guards
  • No per-request canonicalize or alloc when avoidable: Cache canonical paths, reuse buffers, avoid clone() in the hot path

© static-web-server, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/rust-backend of static-web-server/static-web-server.

Open the folder on GitHubat commit 32ec4aa

Compare with similar skills

Rust Backend next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Rust Backend compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rust Backend this skillstatic-web-server/static-web-server2.4k—~1.7kAutomated safety check: PassApache-2.0
Cross-Language Coding Standardszereight/gitlab-mcp2k1 repos~1.4kAutomated safety check: PassMIT
Strict Programming Practicescode-yeongyu/oh-my-openagent70k—~9.5kAutomated safety check: PassCustom licence
Rust Best Practicesfarm-fe/farm5.6k3 repos~1.1kAutomated safety check: PassMIT
R Function Input Validationtidyverse/dplyr5.1k1 repos~2.3kAutomated safety check: PassCustom licence
SeekDB Code Reviewoceanbase/seekdb3.1k—~2.1kAutomated safety check: PassApache-2.0

Similar skills

  • Shared reference for naming, function size, complexity and error handling rules that reviewer agents apply across TypeScript, Python, Go, Rust, Java, C# and Swift.

    2k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • Strict Programming Practices

    code-yeongyu/oh-my-openagent

    Applies strict, type-first coding rules for Python, Rust, TypeScript and Go, loading the matching language reference before the agent writes or edits any code.

    70k GitHub stars~9.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

    5.6k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Validates arguments of exported R functions with the standalone check_* type checkers from rlang, in tidyverse style with clear error messages.

    5.1k GitHub starsUsed in 1 repo~2.3k tokens
    DevelopmentAuto-check passed
  • SeekDB Code Review

    oceanbase/seekdb

    Reviews seekdb pull requests and diffs for real defects in correctness, resources, concurrency, security and tests, reporting only Blocker or Major findings.

    3.1k GitHub stars~2.1k tokensUpdated 3 days ago
    DevelopmentAuto-check passed
  • Rust Async Patterns

    diodeme/Gold-Band

    Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns.

    143 GitHub starsUsed in 9 repos~3.1k tokens
    DevelopmentAuto-check passed

More from static-web-server/static-web-server

All 9 skills in this repo
  • Design

    static-web-server/static-web-server

    Design or review software architecture, API contracts, data models, and module boundaries for the Static Web Server (SWS) project

    2.4k GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Issue Tracking

    static-web-server/static-web-server

    Triage, debug, fix, and document issues for the Static Web Server (SWS) project — bug reports, root cause analysis, fix implementation, and regression prevention

    2.4k GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Performance

    static-web-server/static-web-server

    Optimize or review performance for the Static Web Server (SWS) project — profiling, bottlenecks, resource usage, compression, and caching

    2.4k GitHub stars~3.1k tokensUpdated yesterday
    Auto-check passed
  • Prose

    static-web-server/static-web-server

    Author or edit any prose for the Static Web Server (SWS) project — documentation, design docs, READMEs, PR descriptions, issue bodies, commit message bodies, or other human-readable text — following…

    2.4k GitHub stars~971 tokensUpdated yesterday
    Auto-check passed
  • Static File Serving

    static-web-server/static-web-server

    Serve static files and web assets with optimal headers, MIME types, compression, and caching for the Static Web Server (SWS) project

    2.4k GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Testing

    static-web-server/static-web-server

    Write or review tests for the Static Web Server (SWS) project — unit tests, integration tests, test fixtures, and mocking strategies

    2.4k GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Rust Backend

What does Rust Backend do?

Write or review Rust backend code for the Static Web Server (SWS) project — crates, modules, functions, types, error handling, and async code. Rust Backend is an agent skill from static-web-server/static-web-server.

When should I use Rust Backend?

Rust Backend fits situations like: tasks that involve Error handling; tasks that involve Code quality.

How do I install Rust Backend in Claude Code?

Run `npx skills add static-web-server/static-web-server --skill rust-backend -a claude-code`. Or copy the skill folder (.agents/skills/rust-backend in static-web-server/static-web-server) into .claude/skills/rust-backend in your project. Claude Code loads it when a task matches its description.

How do I install Rust Backend in Codex?

Run `npx skills add static-web-server/static-web-server --skill rust-backend -a codex`. Or copy the skill folder (.agents/skills/rust-backend in static-web-server/static-web-server) into .agents/skills/rust-backend in your project. Codex loads it when a task matches its description.

Can I use Rust Backend in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add static-web-server/static-web-server --skill rust-backend -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rust-backend, .gemini/skills/rust-backend, .github/skills/rust-backend and .opencode/skills/rust-backend in your project.

What does Rust Backend need to run?

Going by SKILL.md and its folder, Rust Backend needs the command-line tools its instructions call (cargo).

Does Rust Backend access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Rust Backend safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Rust Backend use?

Rust Backend is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rust Backend use?

About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Rust Backend?

Skills that share tags, products or a category with Rust Backend: Cross-Language Coding Standards (zereight/gitlab-mcp, 2k stars), Strict Programming Practices (code-yeongyu/oh-my-openagent, 70k stars), Rust Best Practices (farm-fe/farm, 5.6k stars) and R Function Input Validation (tidyverse/dplyr, 5.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rust Backend?

static-web-server (a GitHub organization) maintains it in static-web-server/static-web-server, which has 2,373 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 5, 2026.

Source: static-web-server/static-web-server on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.