effector-storage

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Effector Storage Skill

Effector Storage 技能

Use this skill to design, implement, and debug
effector-storage
integrations with predictable runtime behavior.
运用本技能可设计、实现并调试
effector-storage
集成,确保运行时行为可预测。

Workflow

工作流程

  1. Classify the request:
  • adapter-choice
    : pick the right adapter for environment and data behavior.
  • integration
    : wire
    persist
    /
    createPersist
    into existing model flow.
  • contracts-errors
    : validate storage payloads and route failures.
  • sync-debug
    : investigate cross-tab/query/broadcast synchronization issues.
  • ssr-fallback
    : make persistence safe across browser/server runtimes.
  1. Load references progressively:
  • Start with
    references/core-patterns.md
    .
  • Add
    references/adapter-matrix.md
    when adapter selection/configuration is needed.
  • Add
    references/tools-and-composition.md
    for
    async
    ,
    either
    ,
    farcached
    , or composition recipes.
  • Add
    references/contracts-and-errors.md
    for contracts and error channels.
  • End with
    references/pitfalls-and-checklist.md
    before finalizing.
  1. Build answer contract:
  • Start with a concrete adapter decision and why.
  • Provide a minimal working snippet with explicit key strategy.
  • List behavior caveats (init timing, sync limits, validation behavior).
  • Add verification steps/tests for the chosen flow.
  1. 对请求进行分类:
  • adapter-choice
    :根据运行环境与数据行为选择合适的适配器。
  • integration
    :将
    persist
    /
    createPersist
    接入现有模型流程。
  • contracts-errors
    :验证存储负载并处理错误路由。
  • sync-debug
    :排查跨标签页/查询/广播的同步问题。
  • ssr-fallback
    :确保持久化在浏览器/服务器运行时环境中安全运行。
  1. 逐步加载参考资料:
  • references/core-patterns.md
    开始。
  • 当需要选择或配置适配器时,添加
    references/adapter-matrix.md
  • 若涉及
    async
    either
    farcached
    或组合方案,添加
    references/tools-and-composition.md
  • 若涉及合约与错误通道,添加
    references/contracts-and-errors.md
  • 最终定稿前,参考
    references/pitfalls-and-checklist.md
  1. 构建响应规范:
  • 首先给出明确的适配器选择及理由。
  • 提供包含明确键策略的最小可运行代码片段。
  • 列出行为注意事项(初始化时机、同步限制、验证行为)。
  • 为所选流程添加验证步骤/测试。

Defaults

默认规则

  • Target
    effector-storage
    v7.x behavior.
  • Prefer explicit
    key
    over implicit store names for portability.
  • Prefer declarative Effector wiring around
    persist
    (sample/clock/context units).
  • Keep payloads plain and serialization stable (
    deserialize(serialize(x))
    ).
  • effector-storage
    v7.x版本的行为为标准。
  • 为保证可移植性,优先使用显式
    key
    而非隐式存储名称。
  • 优先采用声明式的Effector方式来配置
    persist
    (使用sample/clock/context单元)。
  • 保持负载为简单数据结构,确保序列化稳定(满足
    deserialize(serialize(x))
    一致性)。

Guardrails

注意事项

  • Do not omit both
    key
    and store name.
  • Do not use
    source === target
    for non-store units.
  • Do not assume
    pickup
    still performs automatic initial restore (it disables it).
  • Do not assume contract validation prevents writes; invalid values can be persisted and then reported via
    fail
    .
  • Do not treat
    broadcast
    as durable storage; it is sync-only messaging.
  • 不得同时省略
    key
    和存储名称。
  • 非存储单元不得使用
    source === target
  • 请勿假设
    pickup
    仍会执行自动初始恢复(实际上它会禁用该功能)。
  • 请勿认为合约验证会阻止写入;无效值仍可能被持久化,之后通过
    fail
    上报。
  • 请勿将
    broadcast
    视为持久化存储;它仅用于同步消息传递。

Practical Extras Boundary

扩展库使用边界

For adapters from
effector-storage-extras
, reuse the same adapter contract and decision flow from this skill, but verify exact API/options in that repository before coding.
对于来自
effector-storage-extras
的适配器,可复用本技能中的适配器规范与决策流程,但编码前需确认该仓库中的具体API/选项。