Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

refui

FreeRuns bundled scriptsNot checked

Build, debug, and migrate rEFui applications using a self-contained guide to retained-mode signals, component lifecycles, memo/keepAlive factories, lists…

SudoMakerby SudoMaker★ 91 GitHub stars9 installs in other catalogs

About this skill

rEFui

Overview

Apply rEFui’s retained-mode + signals model correctly, choose the right JSX mode and renderer, and fix reactivity or lifecycle issues without importing assumptions from other UI frameworks. This file is the operative guide: do not require repository documentation, a linked local checkout, MCP documentation, or the bundled reference files to complete ordinary rEFui work.

Core Pitfalls (skim)

  • JSX is evaluated once; {signal.value} in JSX is static. Use {signal} or a derived $(() => ...).
  • In-place array/object mutation requires sig.trigger() (or replace with a new value).
  • A reactive scope that writes a signal it also reads can schedule itself repeatedly. Audit this as a possible feedback loop, not an automatic error: guarded or convergent updates may be intentional.
  • Context values are stable; provide signals in context if consumers must react.
  • Passing a signal/computed directly to rEFui control-flow is correct: <If condition={sig}> and <If condition={computed}> are intended usage. The pitfall is conditional .value reads inside JS/derived code that skip later dependencies.
  • Prefer lazy If branches when setup and cleanup should follow branch visibility: <If condition={flag}>{() => <Page />}</If>. Eager children are valid when their earlier evaluation and parent ownership are intentional.
  • If consumes its first two children as true/false branches. To show several siblings in one branch, return one Fragment from one function; do not pass those siblings as separate children.

General guide

Mental model (retained mode)

  • Component bodies are setup: they run once; they do not “re-render”.
  • JSX is evaluated once; signals update the already-built UI incrementally.
  • If something “doesn’t update”, you almost always read .value too early (non-reactively) or mutated in place without trigger().

Signals & reactivity

  • State: const count = signal(0)
  • Reactive JSX: {count} (not {count.value})
  • Derived: const label = $(() => Count: ${count.value}) and then {label}
  • In-place mutation: call sig.trigger() after mutating arrays/objects.
import { signal, $ } from 'refui'

const Counter = () => {
	const count = signal(0)
	return (
		<button on:click={() => count.set(count.value + 1)}>
			{$(() => `Count: ${count.value}`)}
		</button>
	)
}

Effects & cleanup

  • Reactive effect: watch(() => { ...reads signals... })
  • Setup/cleanup: useEffect(() => { ...; return () => cleanup })
  • Teardown-only: onDispose(() => cleanup)
  • EffectScope is the ownership basis for components, effects, and disposer scopes. Work created inside a live scope is automatically released with that owner.
  • connect(signals, callback) and signal.connect(callback) subscribe only to the explicitly supplied signals. Reads inside their callbacks are intentionally untracked; create watch() explicitly when a callback needs discovered dependencies.
  • useAction listeners are event handlers, not reactive effects. Signal reads and writes inside a listener do not subscribe the listener; listener registration is still disposed with its outer scope.
  • Review writes to a scope's own signal dependencies for repeated scheduling and termination. A guard, stable value, or convergent update can make this intentional. Warn when the intent is unclear; do not block or rewrite an understood design, or keep repeating an acknowledged warning. peek/untrack reads and deferred event callbacks have different tracking semantics.
  • Scheduling: if you need “after updates applied”, await nextTick().

Control flow components

  • Conditional UI: <If condition={cond}>{() => <Then />}{() => <Else />}</If>
  • Branch functions defer evaluation into the selected branch's scope. Direct children are evaluated before If; their setup can belong to the enclosing owner and outlive branch visibility. Choose the form that matches the intended lifetime, accounting for the renderer and JSX/HMR mode.
  • Two branch children mean true and false, not two true-branch siblings. Use <If condition={cond}>{() => <><First /><Second /></>}</If> when both belong to the true branch.
  • Lazy branches are a recommendation, not a hard requirement. Preserve intentional eager construction; discuss the ownership tradeoff only when it matters to the observed behavior.
  • Lists: <For entries={items} track="id">{({ item, index }) => ...}</For>; its child is an item method, not a component boundary.
  • Inline dynamic subtree with lifecycle: <Fn ctx={something}>{(ctx) => ...}</Fn>
  • For has no fallback; for empty states, wrap with <If>.
  • If the condition already exists as a signal/computed, pass it directly. Do not “fix” <If condition={someSignal}> into extra .value plumbing.

Memoization and retained subtrees

  • memo(fn) caches only the immediate result of the first fn(...) call in its captured owner scope.
  • Components are two-stage: Page(props) returns a render fun
Full SKILL.md on GitHub

Install refui in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

docsreferences/async-suspense-transition.mdreferences/dos-and-donts.mdreferences/jsx-and-renderers.mdreferences/lists-cache-memo.mdreferences/portals-parse-custom-elements.mdreferences/project-setup.mdreferences/project-triage.mdreferences/reactivity-pitfalls.mdscripts/refui-audit.mjsscripts/refui-audit.test.mjs

FAQ

What does the refui skill do?

Build, debug, and migrate rEFui applications using a self-contained guide to retained-mode signals, component lifecycles, memo/keepAlive factories, lists, async UI, DOM/HTML/Reflow renderers, JSX modes, directives, and HMR. Use when library source or separate local documentation may be unavailable.

How do I install the refui skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the refui skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare refui with