preact-ui
Use when designing, refactoring, or reviewing Preact pages and components, including component structure, MVVM architecture, signals, hooks, forms, routing…
Skill by prachwal-archive
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/prachwal-archive-preact-ui
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, frontend, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/preact-ui
What's inside
- Skill name
preact-ui- Description
- Use when designing, refactoring, or reviewing Preact pages and components, including component structure, MVVM architecture, signals, hooks, forms, routing, data fetching, accessibility, SCSS integration, and tests.
- License
- MIT
- Instructions
- 199 lines in SKILL.md · view on GitHub
Files (11)
- LICENSE
- SKILL.md
- accessibility.md · references/
- component-patterns.md · references/
- forms.md · references/
- layout.md · references/
- mvvm.md · references/
- routing.md · references/
- signals.md · references/
- state.md · references/
- testing.md · references/
SKILL.md (first lines)
# Preact UI Skill
Use this skill when building Preact pages, component systems, or full applications.
Prefer the **MVVM (Model–View–ViewModel)** pattern to cleanly separate business logic from rendering.
## Architecture: MVVM in Preact
Organize code into three layers:
- **Model** — pure TypeScript modules for domain data, validation rules, and API contracts. No Preact imports.
- **ViewModel** — custom hooks (`useXxxViewModel`) or module-level signals that hold state, computed values, and commands. Bridges Models to Views.
- **View** — functional components that only render and call ViewModel hooks. No business logic inside.
Directory layout:
```
src/
models/ # domain types, validation, factories
viewmodels/ # useXxxViewModel hooks, signal stores
components/ # shared presentational UI atoms/molecules
features/ # feature slices (view + viewmodel colocated)
routes/ # route-level page components
services/ # API clients, storage adapters
hooks/ # generic reusable hooks
styles/ # global SCSS, tokens, mixins
```
## Core approach
1. Define the Model first — data shape, validation, and invariants.
2. Build the ViewModel — expose signals, computed values, and actions.
3. Build the View last — render only, bind to the ViewModel.
4. Keep components small and composable.
5. Treat accessibility and responsiveness as design constraints, not afterthoughts.
## Preact fundamentals
- Import from `preact` and `preact/hooks`, not React.
- Use `@preact/signals` for reactive state — prefer over `useState` for shared or performance-sensitive state.
- Use `preact/compat` only when consuming React-targeting third-party libraries.
- Use `preact-iso` (the official meta-framework router) or `preact-router` for client-side routing.
- Scaffold new projects with `npm create preact@latest` — it sets up Vite, TypeScript, and preact-iso.
## Signals (preferred state primitive)
- `signal(value)` — reactive value; read `.value`, write `.value =`.
- `computed(() => expr)` — derived signal; recalculates only when dependencies change.
- `effect(() => sideEffect)` — runs when dependencies change; call the returned cleanup to dispose.
- `useSignal(value)` — component-scoped signal; behaves like `useState` but with signal semantics.
- `useComputed(() => expr)` — component-scoped computed signal.
- Pass signals directly into JSX: `<span>{count}</span>` updates the DOM node without re-rendering the component.
- Define shared signals in a ViewModel module; import them in View components.
- Use `batch(() => { ... })` to group multiple signal updates into a single render.
## Hooks and state
- Use `useState` / `useSignal` for purely local UI state (toggle, hover, open).
- Use `useEffect` for external subscriptions, timers, and DOM side-effects; always return cleanup.
- Use `useRef` for DOM references and mutable values that should not trigger re-renders.
- Use `useMemo` / `useComputed` for expensive derived computations.
- Use `useCallback` only when passing stable references to memoized children.
- Avoid `useEffect` for data that can be modelled as derived/computed state.
## Workflow
1. Identify the page role:
- marketing / landing page
- dashboard with live data
- form flow (wizard, multi-step)
- content / article page
- interactive tool or widget
2. Define the layout hierarchy before writing any component code.
3. Separate presentational and data-fetching concerns.
4. Model state intentionally:
- local signal/state for local UI
- module-level signals for cross-component shared state
- `computed` for derived values — never duplicate state
5. Wire routing at the route layer; keep route components thin.
6. Integrate SCSS through predictable class names and component-scoped partials.
7. Add accessibility checks for keyboard, labels, focus order, and semantics.
8. Write tests for user-visible behavior, not implementation details.
## Component rules
- One main concern per component.
- Props describe intent, not DOM mechanics.
- Use semantic HTML first; add ARIA only when semantics are insufficient.
- Avoid overusing Context when signals or props are simpler.
- Never put business logic inside a View component — move it to the ViewModel.
- Memoize with `memo()` only when profiling identifies a bottleneck.
## Professional component patterns
### Splitting heuristics
Split a component when it has more than one independently testable concern, when its sub-trees could change independently, or when it is reused across features.
### TypeScript props
- Define explicit interfaces — never use `any` or untyped prop objects.
- Extend `Preact.JSX.InputHTMLAttributes<HTMLElement>` for low-level wrappers.
- Use union types for `variant`, `size`, and similar constrained props.
### Compound components
Group tightly related sub-components (e.g. `Tabs.Tab`, `Tabs.Panel`) under a shared namespace and use a private Context to coordinate state between them. Exposes a clean API without props drilling.
### Render props / children as function
Pass `renderItem: (item: T) => ComponentChildren` when the parent owns list/async behavior but the consumer controls individual rendering.
### Error boundaries
Wrap every route and major feature in a class-based `ErrorBoundary`. Place them at feature seams, not around individual atoms.
### Context API
Use only for cross-cutting concerns: auth user, locale, theme, feature flags. Do **not** use Context for feature data flow — signals and props are simpler and more efficient.
### Portals
Use `createPortal` from `preact/compat` for modals, tooltips, and dropdowns that must escape overflow or z-index stacking contexts.
### Controlled vs uncontrolled inputs
Prefer controlled (signal-bound) for validated forms; prefer uncontrolled (`useRef` + `FormData`) for simple, low-interactivity forms.From prachwal-archive/web-ui-skills, MIT.
More from prachwal-archive/web-ui-skills
- 0.502score
a11y-review
prachwal-archive
Use when reviewing web interfaces for accessibility, including WCAG 2.2 mapping, ARIA misuse, keyboard access, focus management, responsive/mobile behavior…
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
docs-instructions
prachwal-archive
Use when maintaining repository Markdown, Copilot instructions, Codex AGENTS.md, repo skills, prompts, or LLM evaluation tasks.
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
preact-a11y
prachwal-archive
Use when designing, implementing, testing, or reviewing accessibility in Preact apps — semantic HTML, ARIA, keyboard flow, focus management, forms, contrast…
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
react-a11y
prachwal-archive
Use when designing, implementing, testing, or reviewing accessibility in React apps — semantic HTML, ARIA, keyboard flow, focus management, forms, contrast…
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
react-ui
prachwal-archive
Guidance for building, redesigning, or reviewing React TSX pages/components, hooks, state management, styling, routing, accessibility, and Testing Library…
SkillCFreshness: C★ 1Claude Code +9 - 0.491score
project-tooling
prachwal-archive
Tooling guidance for Vite, Vitest, TypeScript, ESLint/Biome, package scripts, path aliases, and build/test tooling.
SkillCFreshness: C★ 1Claude Code +9 - 0.437score
netlify-serverless
prachwal-archive
Use when choosing and operating Netlify's serverless execution primitives.
SkillDFreshness: D★ 1Claude Code +9 - 0.437score
netlify-typescript-api
prachwal-archive
Use when designing or implementing TypeScript backend APIs on Netlify, including handler structure, validation, typed contracts, error envelopes, and testable…
SkillDFreshness: D★ 1Claude Code +9 - 0.437score
typescript-fundamentals
prachwal-archive
Use when designing or reviewing TypeScript code structure, type safety, patterns, JSDoc, naming conventions, formatting, and module organization.
SkillDFreshness: D★ 1Claude Code +9 - 0.437score
eslint-config
prachwal-archive
Use when setting up, extending, or fixing ESLint configuration for TypeScript projects, including flat config, Preact/React, Node.js, Netlify Functions, and…
SkillDFreshness: D★ 1Claude Code +9 - 0.437score
mongodb-netlify
prachwal-archive
Use when building Netlify Functions or full-stack apps that use MongoDB Atlas or MongoDB-compatible deployments.
SkillDFreshness: D★ 1Claude Code +9 - 0.437score
neon-netlify
prachwal-archive
Use when building Netlify apps or APIs with Neon Postgres.
SkillDFreshness: D★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Apr 9, 2026 (6 months ago)
- Last release
- Apr 23, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from prachwal-archive
- 0.502score
a11y-review
prachwal-archive
Use when reviewing web interfaces for accessibility, including WCAG 2.2 mapping, ARIA misuse, keyboard access, focus management, responsive/mobile behavior…
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
react-a11y
prachwal-archive
Use when designing, implementing, testing, or reviewing accessibility in React apps — semantic HTML, ARIA, keyboard flow, focus management, forms, contrast…
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
docs-instructions
prachwal-archive
Use when maintaining repository Markdown, Copilot instructions, Codex AGENTS.md, repo skills, prompts, or LLM evaluation tasks.
SkillCFreshness: C★ 1Claude Code +9 - 0.497score
preact-a11y
prachwal-archive
Use when designing, implementing, testing, or reviewing accessibility in Preact apps — semantic HTML, ARIA, keyboard flow, focus management, forms, contrast…
SkillCFreshness: C★ 1Claude Code +9 - 0.494score
react-ui
prachwal-archive
Guidance for building, redesigning, or reviewing React TSX pages/components, hooks, state management, styling, routing, accessibility, and Testing Library…
SkillCFreshness: C★ 1Claude Code +9 - 0.491score
project-tooling
prachwal-archive
Tooling guidance for Vite, Vitest, TypeScript, ESLint/Biome, package scripts, path aliases, and build/test tooling.
SkillCFreshness: C★ 1Claude Code +9
Cite this page
preact-ui skill. Agent Mart. https://agentmart.dev/skills/prachwal-archive-preact-ui (last updated 2026-10-24)