Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

kerf-app

БесплатноБез исполняемых скриптовНе проверен

Build UIs in the kerf reactive framework (https://github.com/brianwestphal/kerf). Use this skill whenever the user is writing or modifying code that imports…

brianwestphalот brianwestphal★ 41 звезда на GitHub

Об этом скилле

Building apps with kerf

Drop this file into your ~/.claude/skills/kerf-app/SKILL.md (or your project's .claude/skills/kerf-app/SKILL.md) so Claude Code activates it whenever you work on a kerf app.

kerf is a ~12 KB reactive UI framework (~13 KB with arraySignal): signals + DOM morphing + JSX → HTML strings. No virtual DOM, no compiler, no scheduler. The whole public surface fits in 17 exports.

Setup

  • Install: npm install kerfjs
  • tsconfig.json: "jsx": "react-jsx", "jsxImportSource": "kerfjs"
  • Vite / esbuild need no extra config.
  • Dev diagnostics are opt-in by import, and only an APP installs them. kerf does not infer dev mode. In the app entry add if (import.meta.env.DEV) await import('kerfjs/dev'); (Vite) or if (process.env.NODE_ENV !== 'production') await import('kerfjs/dev'); (webpack/Node). That enables the read-only store get() snapshot, the throwing dangerous-URL screen, and makes the KERF_DEV_WARN_* family available; omitting it is production shape and sheds ~4.7 KB min+gzip because the condition folds away and the chunk is never emitted. Put it FIRST if relying on the untracked-signal warning — signal() picks its constructor at creation time.
    • Switch individual warnings on with enableWarnings(), which is the only switch that works in a browser (no process object there, and a bundler define cannot reach the read): const dev = await import('kerfjs/dev'); dev.enableWarnings({ staleBinding: true, narrowSet: true, invariants: 'throw' });. The KERF_DEV_WARN_* env vars do the same for Node/SSR/CI; an explicit call wins either way.
    • A component package must NEVER import kerfjs/dev. The hooks are process-global, so installing them is the consuming app's decision — a library that does it forces the diagnostics (and the chunk) on every consumer. Put the import in your demo page or test harness instead.
  • Recommended companion: npm install --save-dev eslint-plugin-kerfjs and add kerfjs.configs.recommended to the project's eslint config. Enforces five of the hard rules below (no inline JSX event handlers, require data-key in each(), capture delegate() disposers, no nested mount(), prefer module JSX augmentation) at edit time — useful as a self-correction signal when authoring kerf code.

Public API — one import path

import {
  signal, computed, effect, batch,    // reactivity
  defineStore, resetAllStores,        // stores
  mount, morph, each,                 // render (reactive + one-shot) + keyed list
  delegate, delegateCapture,          // events
  toElement,                          // direct JSX → DOM Element (or DocumentFragment for multi-root)
  SafeHtml, isSafeHtml, raw, Fragment,
} from 'kerfjs';

// Optional, only when you need granular collection updates:
import { arraySignal } from 'kerfjs/array-signal';

// Development diagnostics — gate with YOUR build's dev flag, in YOUR code.
if (import.meta.env.DEV) await import('kerfjs/dev');
Export Use
signal(initial) atomic reactive state; .value get/set
computed(fn) derived value, read-only
effect(fn) side effect on signal change; returns disposer
batch(fn) coalesce multiple writes into one re-run
defineStore({initial, actions}) named multi-consumer state
resetAllStores() reset every store (test teardown)
mount(el, render) bind reactive render to a DOM element; returns disposer
morph(liveRoot, template) one-shot reconcile against a populated element (SSR hydration, page-refresh diffs). Template = Element, SafeHtml, or HTML string
each(items, render, cacheKey?) keyed list iteration; per-row memoization on identity (+ optional cacheKey — a passive comparator for external state). Distinct from data-key on the rendered element
each(items, render, { cacheKey, key }) same, options form. key gives the list a stable identity — required whenever a conditional list can render before this one, else kerf rebuilds this list and its rows lose focus/scroll/IME. A keyed list takes no positional slot, so keying the conditional list usually fixes its siblings too
delegate(root, type, sel, h) one listener at the root; closest(selector) walk from target
delegateCapture(root, type, sel, h, opts?) capture-phase escape hatch; closest() walk-up by default (same as delegate); pass { match: 'direct' } for strict target.matches()
attr(name, value) pre-computed AttrSpec<N,V> — .selector for delegate(), .attrs to spread into JSX (rename-safe)
attr(name) dynamic factory — attr<N,V=string>(name) returns (value: V) => { readonly [name]: V }; both generics off → N inferred, V defaults to string; specify both to constrain values
toElement(jsx) parse JSX into a DOM node (SVG-aware). Single-root → Element; multi-root (<><svg/> label</>, two icons side by side) → DocumentFragment that appendChild/replaceChildren/
Полный SKILL.md на GitHub

Установить kerf-app в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл kerf-app?

Build UIs in the kerf reactive framework (https://github.com/brianwestphal/kerf). Use this skill whenever the user is writing or modifying code that imports `kerfjs`, asks to add a feature to a kerf app, or asks "how do I do X in kerf?". Use it proactively the moment you spot a kerf import in the file you're editing.

Как установить скилл kerf-app?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл kerf-app запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить kerf-app с