跳到正文
Skillpedia
网站与界面(前端)5.2k · #15030

build-with-tinybase

它能做什么

它说明如何设置 TinyBase,让数据保存在设备上,并可选择在设备之间同步。适合用 TinyBase 构建 JavaScript 或 TypeScript 应用的开发者。

适用场景

  • ✓当你想构建一个把数据保存在浏览器或设备上的 JavaScript 或 TypeScript 应用时。
  • ✓当你想为 TinyBase 存储设置保存或同步功能时。
  • ✓当你想根据生成的入门模板创建一个新的 TinyBase 应用时。

技能链接

https://github.com/tinyplex/tinybase/blob/main/docs/skills/build-with-tinybase/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/tinyplex/tinybase/blob/main/docs/skills/build-with-tinybase/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请用 TinyBase 做一个小型待办事项应用,数据保存在浏览器中,并在我的两台设备之间同步。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体在编写代码前先阅读 TinyBase 的参考指南,然后按正确的顺序设置存储、保存层和同步层。之后,它会检查功能是否正常。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Build With TinyBase

Prefer a current generated application over reconstructing TinyBase setup from memory. Preserve persistence and synchronization lifecycle ordering, and verify the behavior the user actually needs.

Read The References

Do not recall TinyBase API details from memory. Read the reference covering the task before writing code:

Reference Read it when
references/architecture.md Choosing between Store and MergeableStore, a persistence backend, a synchronization approach, or UI bindings
references/import-paths.md Importing anything outside the tinybase root, or checking which Persisters accept a MergeableStore
references/lifecycle.md Creating, starting, reconnecting, or destroying a Persister or Synchronizer, or setting WebSocket paths and channel Ids
references/durable-objects.md Building or debugging a Cloudflare Durable Object sync server

Select The Architecture

Read references/architecture.md when choosing between Store and MergeableStore, persistence backends, synchronization, or UI bindings.

Confirm that TinyBase fits the task:

  • Keep the active application dataset in a JavaScript runtime.
  • Use TinyBase for reactive tabular or key-value data, local-first behavior, persistence, synchronization, or framework bindings.
  • Do not present TinyBase as a hosted database service.
  • Pair it with another database or service when the authoritative dataset is unbounded, primarily queried on a server, or requires managed backend facilities.

Scaffold A New Application

Inspect the installed generator contract first:

npm create tinybase@latest -- --list-options

Translate the user's requirements into explicit values. Generate unattended projects with every applicable option and always disable automatic installation and server startup:

npm create tinybase@latest -- \
  --non-interactive \
  --projectName my-tinybase-app \
  --appType todos \
  --language typescript \
  --framework react \
  --tinyWidgets false \
  --schemas true \
  --syncType none \
  --persistenceType local-storage \
  --prettier true \
  --eslint true \
  --installAndRun false

Run the generator in the parent directory that should contain the new project. Do not overwrite an existing directory. After generation:

  1. Read the generated AGENTS.md and README.md.
  2. Inspect the primary Store file before modifying application code.
  3. Install dependencies only when authorized and required.
  4. Make application-specific changes within the generated architecture.
  5. Run the generated client build.
  6. Run the server build when server code changed.

Extend An Existing Application

Inspect package.json, TinyBase imports, Store creation, Persister setup, and Synchronizer setup before editing. Use documentation matching the installed TinyBase version. Start at https://tinybase.org/llms.txt or retrieve current TinyBase documentation through Context7 when available.

Keep these boundaries clear:

  • Store creation and schemas
  • persistence startup and teardown
  • synchronization startup and teardown
  • framework Provider or context wiring
  • application-specific data and UI

Reuse existing imports and patterns when they are current. Import integrations from their specific tinybase/... subpaths. Avoid adding a second source of truth in component state for data already owned by TinyBase.

Avoid These Errors

These account for most incorrect TinyBase code. Each is covered in detail by a reference above.

  • Passing a Store where a MergeableStore is required. Every Synchronizer, and every Durable Object Persister, requires createMergeableStore().
  • Importing an integration from tinybase instead of its own tinybase/persisters/..., tinybase/synchronizers/..., or tinybase/schematizers/... subpath.
  • Starting auto-saving before loading, which overwrites stored data wi
常见问题

智能体会凭记忆使用 TinyBase 的细节吗?

不会。该技能要求在编写代码之前先阅读参考指南。

数据可以在设备之间同步吗?

可以。该技能涵盖通过 WebSockets 或 Cloudflare Durable Objects 同步存储。

这个技能涵盖把数据保存到数据库吗?

涵盖。它包括配置浏览器或数据库的持久化。

详情

作者的原始描述

Scaffold, extend, and verify reactive local-first JavaScript or TypeScript applications with TinyBase. Use when choosing TinyBase for in-memory tabular or key-value state, generating an app with create-tinybase, adding schemas or UI bindings, resolving TinyBase import paths, configuring browser or database persistence, configuring MergeableStore synchronization over WebSockets or Cloudflare Durable Objects, or diagnosing an existing TinyBase application.

repo: tinyplex/tinybase

热度

GitHub 星标
5.2k
排名
#15030
许可证
MIT
更新时间
2026/10/22

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

相似技能