V

valtio-define

by @hairyfv
4.2(20)

Master of comprehensive usage techniques for `valtio-define`, used for defining and managing Valtio states.

valtioreact-state-managementproxy-based-statefrontend-developmentjavascript-librariesGitHub
Installation
npx skills add hairyf/skills --skill valtio-define
compare_arrows

Before / After Comparison

1
Before

When using Valtio for state management, unfamiliarity with its advanced features can lead to chaotic state definitions. This results in poor code readability, making it difficult to maintain and extend, and ultimately impacting development efficiency.

After

Applying this skill enables a comprehensive understanding of valtio-define's usage and best practices. It optimizes state definitions, improves code clarity and maintainability, ensuring efficient and stable state management.

SKILL.md

Based on valtio-define v1.0.1. A Valtio-based state management library with Pinia-like API for React applications.

Overview

valtio-define provides a factory function for creating reactive stores with state, actions, and getters. Built on top of Valtio, it offers a familiar API similar to Pinia with full TypeScript support.

Core References

TopicDescriptionReference
defineStoreCore API for creating reactive storescore-define-store
useStoreReact hook for accessing store statecore-use-store
TypesTypeScript types and interfacescore-types

Advanced Features

TopicDescriptionReference
SubscriptionsSubscribe to state changesadvanced-subscribe
PatchUpdate state with patch operationsadvanced-patch
SignalJSX component for inline reactive valuesadvanced-signal
Store to StateConvert store to useState-like hooksadvanced-store-to-state

Features

TopicDescriptionReference
Plugin SystemExtend stores with pluginsfeature-plugin-system
Persistent PluginPersist state to storagefeature-persistent-plugin

Quick Start

import { defineStore, useStore } from 'valtio-define'

const store = defineStore({
  state: () => ({ count: 0 }),
  actions: {
    increment() { this.count++ },
  },
  getters: {
    doubled() { return this.count * 2 },
  },
})

function Counter() {
  const state = useStore(store)
  return (
    <div>
      <div>Count: {state.count}</div>
      <div>Doubled: {state.doubled}</div>
      <button onClick={store.increment}>Increment</button>
    </div>
  )
}

User Reviews (0)

Write a Review

Effect
Usability
Docs
Compatibility

No reviews yet

Statistics

Installs629
Rating4.2 / 5.0
Version
Updated2026年5月23日
Comparisons1

User Rating

4.2(20)
5
15%
4
45%
3
35%
2
5%
1
0%

Rate this Skill

0.0

Compatible Platforms

🔧Claude Code
🔧OpenClaw
🔧OpenCode
🔧Codex
🔧Gemini CLI
🔧GitHub Copilot
🔧Amp
🔧Kimi CLI

Timeline

Created2026年3月16日
Last Updated2026年5月23日