Token导航 LogoToken导航TokenDH.com
开发需要联网clawhub未标认证来源可访问clear审计通过

state-management状态管理

Agent Skill

state-management 用于辅助前端页面、组件、样式和交互逻辑开发,适合在 OpenClaw 中需要维护前端项目、生成组件或检查界面实现时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,248

周安装

177

GitHub Stars

公开资料未说明

下载量

1,416
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:state-management(状态管理)
来源仓库:https://github.com/clawkk/state-management
安装命令:
openclaw skills install state-management
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install state-management

简介

state-management 深入客户端状态建模与一致性管理,覆盖 UI 与服务器缓存协同。

  • 适用于前端组件开发、混合应用状态维护及异步数据处理场景。
  • 可协助设计状态结构、选择存储方案并集成 DevTools 进行调试验证。
  • 安装命令为 openclaw skills install state-management,需确认项目依赖与环境兼容性。
  • 建议结合实际框架(如 React/Vue)调整实现细节,避免引入不必要的复杂度。

SKILL.md

name
state-management
description
Deep workflow for client (and hybrid) state—modeling domain vs UI state, server cache vs client store, async and consistency, DevTools, persistence, and testing. Use when choosing Redux/Zustand/Recoil/Context, fixing stale UI, or designing data flow in React/Vue/Svelte apps.

State Management (Deep Workflow)

Most “state bugs” are ownership and lifecycle bugs: who writes, when it syncs, and what happens on failure. Guide users to explicit models instead of ad-hoc globals.

When to Offer This Workflow

Trigger conditions:

  • Prop drilling pain, inconsistent UI, duplicate sources of truth
  • Stale data after mutations; optimistic UI gone wrong
  • Choosing a library vs Context vs server-state library (React Query, SWR, Apollo)
  • SSR/hydration + client state mismatches

Initial offer:

Use six stages: (1) inventory state kinds, (2) assign ownership, (3) server vs client boundaries, (4) async & updates, (5) persistence & URLs, (6) testing & DevTools. Confirm framework and data fetching approach.


Stage 1: Inventory State Kinds

Goal: Classify what state exists before picking tools.

Categories

  • Remote/server state: API responses, pagination, staleness—often not Redux-shaped
  • URL state: filters, tabs, selection when shareable/bookmarkable
  • Session UI state: modals, toggles, transient form drafts
  • Client-derived: sorted/filtered views of remote data—avoid storing both raw and derived as writable truths
  • Global cross-cutting: auth user, theme, feature flags—with clear read-only vs mutable rules

Exit condition: Table of state slicessource of truthconsumers.


Stage 2: Assign Ownership

Goal: One writer per piece of truth (or strict reducer pattern).

Rules of Thumb

  • Colocate state where it’s used if not shared—don’t globalize prematurely
  • Lift only when multiple subtrees need it or prop chains hurt and ownership is clear
  • Avoid copying server entities into multiple stores without sync rules

Exit condition: For each slice: who sets, who reads, invalidation story.


Stage 3: Server vs Client Boundaries

Goal: Prefer server-state libraries for remote data; use client stores for true client concerns.

Guidance

  • React Query / SWR / RTK Query: caching, dedupe, refetch, background refresh—use for HTTP JSON
  • GraphQL clients: normalized cache + mutations with update policies
  • Redux: great for predictable global client state + middleware—not every fetch response

Anti-patterns

  • Storing full API JSON in Redux without normalization when Apollo/Query would fit
  • Double fetch: SSR then client refetch without coordination—use hydration patterns

Exit condition: Remote data has defined cache keys, stale time, and mutation flow.


Stage 4: Async & Consistency

Goal: Loading, error, empty, and retry are first-class; optimistic updates are safe or scoped.

Practices

  • Optimistic UI: rollback path; idempotent mutations; server reconciliation
  • Ordering: serial vs parallel requests; race cancellation (AbortController)
  • Pagination/infinite scroll: cursor stability; dedupe pages

Concurrency

  • Last write wins awareness; versioning or ETags if server supports

Exit condition: User-visible failure modes handled; no silent stale success.


Stage 5: Persistence & URL

Goal: Decide what survives refresh, what is shareable, and security.

Options

  • URL query for filters/tabs when users share links
  • localStorage/sessionStorage for drafts—mind XSS risk (sensitive data → not localStorage)
  • IndexedDB for offline—complexity tax

Exit condition: Sensitive data never persisted client-side inappropriately.


Stage 6: Testing & DevTools

Goal: State logic is unit-testable; time-travel/debug when needed.

Practices

  • Pure reducers / small hooks for rules
  • Integration tests for critical flows with MSW or mock server
  • DevTools: Redux/Query panels—ensure team knows how to inspect cache

Final Review Checklist

  • [ ] State classified: remote vs UI vs URL vs derived
  • [ ] Single owner per truth; invalidation clear
  • [ ] Server cache strategy chosen for API data
  • [ ] Async/error/empty/optimistic paths specified
  • [ ] Persistence/security boundaries respected

Tips for Effective Guidance

  • Start minimal: Context + server-state library solves many “Redux-sized” problems.
  • Always ask: “What is the source of truth after mutation returns?”
  • Mention React Strict Mode double-invoke when debugging weird effect behavior.

Handling Deviations

  • Legacy Redux everywhere: incremental migration—feature modules first, remote data to Query next.
  • Non-React: map patterns to signals/stores (Vue Pinia, Svelte stores) with same ownership discipline.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

91.31%
按下载量换算1,293

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills