leptos
БесплатноБез исполняемых скриптовНе проверенLeptos is a Rust web framework that builds reactive user interfaces compiled to WebAssembly, either as a client-side app or as a full-stack app with…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Leptos — Full-Stack Rust Web Framework
Overview
Leptos renders HTML from Rust components written with the view! macro and updates the page through fine-grained signals: when a signal changes, only the DOM nodes that read it are touched. It runs in two modes:
- Client-side rendering (CSR) — the app compiles to WebAssembly and is served as static files by Trunk. Fast builds, any backend.
- Server-side rendering (SSR) with hydration — one crate compiles twice: a native server binary (feature
ssr) that renders HTML, and a WebAssembly bundle (featurehydrate) that makes it interactive.cargo-leptoscoordinates both builds, and server functions let client code call server code directly.
Leptos 0.7 rewrote the API, and 0.8 keeps it. Code from older tutorials (use leptos::*, create_signal, create_resource, .into_view() on every branch) fails or warns: the current forms are use leptos::prelude::*, signal(), Resource::new(), .into_any().
Instructions
1. Set up the toolchain
Rust comes from rustup (use your distribution's rustup package, or download rustup-init and check it against the .sha256 published next to it). Then:
rustup target add wasm32-unknown-unknown
cargo install --locked trunk # CSR apps
cargo install --locked cargo-leptos # full-stack apps
Stable Rust is enough. The nightly feature of leptos only adds function-call syntax for signals (count() instead of count.get()).
2. Client-side app with Trunk
cargo init reading-timer && cd reading-timer
cargo add leptos --features=csr
cargo add console_error_panic_hook
printf '<!DOCTYPE html>\n<html>\n <head></head>\n <body></body>\n</html>\n' > index.html
trunk serve --open # rebuilds and reloads on save
trunk build --release # static site in dist/
// src/main.rs
use leptos::prelude::*;
#[component]
fn Counter(#[prop(default = 0)] initial: i32, #[prop(into)] label: String) -> impl IntoView {
let (count, set_count) = signal(initial);
let doubled = Memo::new(move |_| count.get() * 2);
Effect::new(move |_| leptos::logging::log!("count is {}", count.get()));
view! {
<button on:click=move |_| set_count.update(|n| *n -= 1)>"-"</button>
<span class:negative=move || count.get() < 0>{label} ": " {count} " (doubled: " {doubled} ")"</span>
<button on:click=move |_| *set_count.write() += 1>"+"</button>
<Show when=move || { count.get() > 9 } fallback=|| view! { <p>"Keep going"</p> }>
<p>"Double digits"</p>
</Show>
}
}
fn main() {
console_error_panic_hook::set_once();
leptos::mount::mount_to_body(|| view! { <Counter initial=3 label="Clicks"/> });
}
What to know about signals and the view macro:
signal(v)returns a(ReadSignal, WriteSignal)pair;RwSignal::new(v)is one handle for both. Read with.get()(clones) or.read()(borrows); write with.set(v),.update(|v| ...)or*sig.write() = v. All areCopy, somoveclosures can capture them freely.- A value is reactive in the view only if it is a signal or a closure:
{count}and{move || count.get() * 2}update,{count.get()}is evaluated once. Memo::newcaches a derived value;Effect::newruns side effects in the browser after render and never on the server.- Text nodes are string literals in quotes. Attributes:
on:click=,class:name=,style:color=,prop:value=, andbind:value=signalfor two-way input binding. - Branches of an
if/matchinsideview!must have one type: end each branch with.into_any()or use<Show>. Lists use<For each=... key=... children=.../>with a stable key.
3. Full-stack project with cargo-leptos
cargo leptos new --git https://github.com/leptos-rs/start-axum --name reading-list # or .../start-actix
cd reading-list
cargo leptos watch # http://127.0.0.1:3000, rebuilds server and client
cargo leptos build --release # target/release/reading-list + target/site/
cargo leptos new is a wizard: it asks "Use nightly features?" (answer No) and stops with IO error: not a terminal in a script or agent session. There, run cargo generate --git https://github.com/leptos-rs/start-axum --name reading-list -d nightly=No instead (cargo install --locked cargo-generate). The template's Cargo.toml wires the two builds. Keep this shape when adding dependencies: server-only crates are optional and listed under ssr.
[dependencies]
leptos = { version = "0.8" }
leptos_router = { version = "0.8" }
leptos_meta = { version = "0.8" }
serde = { version = "1", features = ["derive"] } # added
axum = { version = "0.8", optional = true }
leptos_axum = { version = "0.8", optional = true }
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
sqlx = { version = "0.8", features = ["runtime-tokio", "postgres"], o
Установить leptos в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл leptos?
Leptos is a Rust web framework that builds reactive user interfaces compiled to WebAssembly, either as a client-side app or as a full-stack app with server-side rendering, hydration and server functions on Axum or Actix. Use when a user asks to "build a web app in Rust", "start a Leptos project", "add a server function", "use signals and resources in Leptos", "set up cargo-leptos", "fix Leptos code that no longer compiles after 0.7", or "deploy a Leptos SSR app". Covers Leptos 0.8: signals, the view macro, resources and Suspense, server functions and actions, routing, islands, Trunk and cargo-leptos.
Как установить скилл leptos?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл leptos запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic