Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Leptos Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-leptos-knowledge-patch-nevaberry-plugins)
---
name: leptos-knowledge-patch
description: Leptos
version: "0.8.23"
license: MIT
metadata:
author: Nevaberry
---
# Leptos Knowledge Patch
Load this skill for Leptos migrations, component and attribute APIs, reactive
resources and stores, routing, SSR, server functions, lazy loading, and
`cargo-leptos` configuration or installation.
## Reference index
| Reference | Topics |
| --- | --- |
| [Migration and Configuration](references/migration-and-configuration.md) | Custom conversions, options, crate versions, stylesheets, development flags, reload, source locations |
| [Reactivity, Resources, and Stores](references/reactivity-and-stores.md) | Callable signals, batching, selectors, resources, error boundaries, conversions, keyed stores |
| [Routing, SSR, and Integrations](references/routing-ssr-and-integrations.md) | Axum, protected routes, islands, transitions, parameters, redirects, origins, CSP, hydration scripts |
| [Server Functions and Lazy Loading](references/server-functions-and-lazy-loading.md) | Errors, codecs, Actix, WebSockets, server URLs, body limits, forms, lazy routes and functions |
| [Views, Components, and Browser APIs](references/views-components-and-browser.md) | DOM helpers, toggle events, attributes, radio binding, recursive views, props, optional values, keyed lists |
| [cargo-leptos](references/cargo-leptos.md) | Prebuilt installers, manual archives, checksums, supported platforms |
## Breaking changes and migrations
### Signals and closures
In 0.9.0-beta, signals dereference to callable values on stable and nightly Rust.
Change props accepting both signals and closures from `impl Fn() -> T` to
`impl SignalOrFn<Output = T>`: signals no longer implement the `Fn` traits
directly on nightly.
```rust
use leptos::prelude::*;
let (count, set_count) = signal(42);
set_count(13);
assert_eq!(count(), 13);
```
### Lazy-loading feature and form encoding
In 0.9.0-beta, enable the `lazy` feature on the `leptos` dependency to continue
using lazy loading and WASM code splitting.
```toml
[dependencies]
leptos = { version = "0.9.0-beta", features = ["lazy"] }
```
The default URL-encoded server-function input in 0.9.0-beta uses `serde_qs` 1.0.
Retest empty collections: they may decode without the `#[server(default)]`
workarounds used with the older codec.
### DOM helpers, events, and removed rendering API
- In 0.9.0-beta, switch handle-returning helpers from `_with_handle` names to
their unsuffixed names.
- In 0.9.0-beta, `on:toggle` receives `ToggleEvent`; update callbacks explicitly
taking a plain `Event`.
- `render_app_async_stream_with_context` was removed in 0.9.0-beta. Update
integrations that call it directly.
### Custom conversions and configuration
- For custom view children in 0.7.0, migrate `IntoView` implementations to
`IntoRender`; for custom HTML attribute values, migrate `IntoAttribute`
implementations to `IntoAttributeValue`.
- In 0.7.0, former `String` fields in `LeptosOptions` use `Arc<str>`; pass
`field.as_ref()` to APIs needing `&str`.
- In 0.8.0, replace `LeptosOptions::default()` and `ConfFile::default()` with
explicit construction or `get_configuration(None)?.leptos_options`.
- Starting in 0.8.6, workspace crates receive patch releases independently;
choose each crate's published version when pinning dependencies.
### Axum integration
For Leptos 0.8.0, upgrade Axum to 0.8 alongside `leptos_axum` so their types
match. Use brace paths such as `/posts/{id}` and `/files/{*rest}` for routes
registered directly on Axum's router.
The 0.9.0-beta integration can leave a non-unit state type on the router, allowing
composition with other routes before supplying the remaining state.
### Reactive value migrations
- In 0.7.0, reactive updates batch automatically. Remove `batch` calls and run
their bodies directly.
- In 0.8.0, `LocalResource` exposes values directly. Remove dereferences used
solely to unwrap `SendWrapper`; update action code explicitly using the former
`SendOption` wrapper to use ordinary `Option`.
- In 0.8.0, pass keys to `Selector::selected` by reference:
`selector.selected(&key)`.
- Starting in 0.8.11, `effect::immediate::batch(|| { /* signal writes */ })`
defers immediate effects until the batch finishes.
## Components and attributes
### Attribute forwarding
Use `attr:` for individual HTML attributes or `{..}` after component props to
treat subsequent entries as attributes. Spread attributes apply to each rendered
root element and can pass through wrappers such as `Suspense`.
```rust
view! { <A href="/" attr:aria-label="Home" {..} class="nav-link">"Home"</A> }
```
Starting in 0.7.1, `<AttributeInterceptor>` captures spread attributes for
forwarding to a chosen element inside a wrapper component.
Starting in 0.7.5, `TextProp` can be an HTML attribute value; starting in 0.8.16,
`MaybeProp` implements `AttributeValue` and can be passed directly as well.
### Binding and optional rendering
Use `bind:group` with the same writable `String` signal on each radio input;
the signal holds the selected input's `value`.
End recursive component views with `.into_any()` so the compiler can determine
the size of the view tree.
`<ShowLet>` renders a reactive `Option`'s value and uses its fallback for `None`
starting in 0.8.8. Starting in 0.8.15, it also accepts a plain `Option`.
## Resources and stores
Starting in 0.8.3, put reads that should trigger a refetch in the source closure
passed to `Resource::new`. Reads inside the fetcher's `async` block are untracked.
Use `Resource::write()` to mutate a resource's stored value directly.
In 0.8.21, errors inside a `<Suspense>` tracking only `LocalResource` values reach
the enclosing `<ErrorBoundary>`. Resource-read checks also apply to attributes
whose `Signal` or `Memo` reads a resource.
Starting in 0.8.21, convert a reactive store subfield directly into a `MaybeProp`,
for example `let tooltip: MaybeProp<String> = store.tooltip().into();`.
Starting in 0.8.19, patches changing a keyed collection's structure notify
subscribers of that structural change.
## Routing and SSR
`<ProtectedRoute>` reevaluates its condition as reactive state changes and uses
`Suspense` for resource-backed conditions. In 0.8.0, enable `islands-router` for
client-side navigation while hydrating an islands app's interactive islands.
Set `transition=true` on `<Routes>` or `<FlatRoutes>` for browser View Transition
API navigation. On `<html>`, use `.routing-progress`, `.router-back`, and
`.router-outlet-0`, `.router-outlet-1`, and so on for navigation, back navigation,
and the depth of the changing outlet, respectively.
`ParamsMap` can preserve repeated query values. Starting in 0.8.16,
`#[derive(Params)]` works without nightly, and `for entry in ¶ms` iterates a
borrowed map while retaining it for later use.
In 0.8.0, server-rendered router fallbacks can set a custom HTTP status or
redirect; use `leptos_axum::ResponseOptions` for an Axum fallback's status.
In 0.9.0-beta, permanent router redirects emit HTTP 301 on the server, and the
server-side `Url::origin()` returns the actual request origin for absolute URLs.
Starting in 0.8.19 and 0.9.0-beta, use `Nonce::from_value` for an existing CSP
nonce, using the same nonce in the CSP header and rendered markup. In 0.8.21,
`use_nonce()` is available even without the `nonce` Cargo feature, and the
generated WebAssembly preload uses the active CSP nonce.
Starting in 0.8.23, request deferred script execution in the server-rendered
document shell:
```rust
view! { <HydrationScripts options defer=true /> }
```
## Server functions and code splitting
In 0.8.0, a `#[server]` function can return `Result<T, AppError>` when `AppError`
implements `FromServerFnError`; result aliases are accepted too.
For WebSocket server functions, select `Websocket<InputEncoding, OutputEncoding>`
and accept and return `BoxedStream` values. Open the connection from client-side
code and consume the returned stream for incoming messages.
Starting in 0.8.19, primary non-multipart server-function encodings honor the web
framework's request-body limit. For large requests, adjust Axum's
`DefaultBodyLimit` or Actix's `PayloadConfig`.
Starting in 0.8.5, implement `LazyRoute` with `#[lazy_route]` for WASM route
splitting; route data and views start loading concurrently, including nested
routes. Starting in 0.8.6, put `#[server]` above `#[lazy]` to split a server
function's client-side WASM code. Starting in 0.8.19, `lazy_preload!` can load a
`#[lazy]` function's WASM code ahead of its call.
## Build and stylesheet settings
Switch `<Stylesheet>` to `<HashedStylesheet>` when using `cargo-leptos` stylesheet
hashing. Starting in 0.8.18, `LeptosOptions::css_file_path()` resolves the generated
stylesheet's path on disk.
The `cargo-leptos` release paired with Leptos 0.8.0 enables
`--cfg=erase_components` for development by default; with Trunk, set it explicitly
for development builds. View hot reloading works on stable Rust starting in
0.8.4. Starting in 0.7.1, opt in to reactive source locations in release builds
with `RUSTFLAGS="--cfg locations" cargo build --release`.