Token导航 LogoToken导航

Agent Skill · 开发

spacetimedb-concepts(时空数据库概念)

spacetimedb-concepts 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

spacetimedb-concepts 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 9,220。

总安装 2,815周安装 115GitHub Stars 24,615下载 911核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:spacetimedb-concepts(时空数据库概念)
来源仓库:https://github.com/clockworklabs/spacetimedb
仓库路径:skills/spacetimedb-concepts
安装命令:
npx skills add https://github.com/clockworklabs/spacetimedb --skill spacetimedb-concepts
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/clockworklabs/spacetimedb --skill spacetimedb-concepts

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

spacetimedb-concepts 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。

通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/spacetimedb-concepts

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/clockworklabs/spacetimedb --skill spacetimedb-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

spacetimedb-concepts 怎么安装?

在终端执行 npx skills add https://github.com/clockworklabs/spacetimedb --skill spacetimedb-concepts。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

spacetimedb-concepts 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

spacetimedb-concepts 需要什么权限?

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

spacetimedb-concepts 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

spacetimedb-concepts 用的人多吗?

公开数据是累计安装 2,815 次,近一周安装 115 次,下载 911 次,GitHub 24,615 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

spacetimedb-concepts 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 24,615 星,维护活跃度相对可查。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
spacetimedb-concepts

时空数据库概念 · 本页

2,81524,615需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

SpacetimeDB Core Concepts

SpacetimeDB is a relational database that is also a server. It lets you upload application logic directly into the database via WebAssembly modules, eliminating the traditional web/game server layer entirely.


Critical Rules (Read First)

These five rules prevent the most common SpacetimeDB mistakes:

  1. Reducers are transactional — they do not return data to callers. Use subscriptions to read data.
  2. Reducers must be deterministic — no filesystem, network, timers, or random. All state must come from tables.
  3. Read data via tables/subscriptions — not reducer return values. Clients get data through subscribed queries.
  4. Auto-increment IDs are not sequential — gaps are normal, do not use for ordering. Use timestamps or explicit sequence columns.
  5. ctx.sender() is the authenticated principal — never trust identity passed as arguments. Always use ctx.sender() for authorization.

Feature Implementation Checklist

When implementing a feature that spans backend and client:

  1. Backend: Define table(s) to store the data
  2. Backend: Define reducer(s) to mutate the data
  3. Client: Subscribe to the table(s)
  4. Client: Call the reducer(s) from UI — do not skip this step
  5. Client: Render the data from the table(s)

Common mistake: Building backend tables/reducers but forgetting to wire up the client to call them.


Debugging Checklist

When things are not working:

  1. Is SpacetimeDB server running? (spacetime start)
  2. Is the module published? (spacetime publish)
  3. Are client bindings generated? (spacetime generate)
  4. Check server logs for errors (spacetime logs <db-name>)
  5. Is the reducer actually being called from the client?

CLI Commands

spacetime start
spacetime publish <db-name> --module-path <module-path>
spacetime publish <db-name> --clear-database -y --module-path <module-path>
spacetime generate --lang <lang> --out-dir <out> --module-path <module-path>
spacetime logs <db-name>

What SpacetimeDB Is

SpacetimeDB combines a database and application server into a single deployable unit. Clients connect directly to the database and execute application logic inside it. The system is optimized for real-time applications requiring maximum speed and minimum latency.

Key characteristics:

  • In-memory execution: Application state is served from memory for very low-latency access
  • Persistent storage: Data is automatically persisted to a write-ahead log (WAL) for durability
  • Real-time synchronization: Changes are automatically pushed to subscribed clients
  • Single deployment: No separate servers, containers, or infrastructure to manage

The Five Zen Principles

  1. Everything is a Table: Your entire application state lives in tables. No separate cache layer, no Redis, no in-memory state to synchronize.
  2. Everything is Persistent: SpacetimeDB persists state by default (for example via WAL-backed durability).
  3. Everything is Real-Time: Clients are replicas of server state. Subscribe to data and it flows automatically.
  4. Everything is Transactional: Every reducer runs atomically. Either all changes succeed or all roll back.
  5. Everything is Programmable: Modules are real code (Rust, C#, TypeScript) running inside the database.

Tables

Tables store all data in SpacetimeDB. They use the relational model and support SQL queries for subscriptions.

Defining Tables

Tables are defined using language-specific attributes. In 2.0, use accessor (not name) for the API name:

Rust:

#[spacetimedb::table(accessor = player, public)]
pub struct Player {
    #[primary_key]
    #[auto_inc]
    id: u32,
    #[index(btree)]
    name: String,
    #[unique]
    email: String,
}

C#:

[SpacetimeDB.Table(Accessor = "Player", Public = true)]
public partial struct Player
{
    [SpacetimeDB.PrimaryKey]
    [SpacetimeDB.AutoInc]
    public uint Id;
    [SpacetimeDB.Index.BTree]
    public string Name;
    [SpacetimeDB.Unique]
    public string Email;
}

TypeScript:

const players = table(
  { name: 'players', public: true },
  {
    id: t.u32().primaryKey().autoInc(),
    name: t.string().index('btree'),
    email: t.string().unique(),
  }
);

Table Visibility

  • Private tables (default): Only accessible by reducers and the database owner
  • Public tables: Exposed for client read access through subscriptions. Writes still require reducers.

Table Design Principles

Organize data by access pattern, not by entity:

Decomposed approach (recommended):

Player          PlayerState         PlayerStats
id         <--  player_id           player_id
name            position_x          total_kills
                position_y          total_deaths
                velocity_x          play_time

Benefits: reduced bandwidth, cache efficiency, schema evolution, semantic clarity.

Reducers

Reducers are transactional functions that modify database state. They are the primary client-invoked mutation path; procedures can also mutate tables by running explicit transactions.

Key Properties

  • Transactional: Run in isolated database transactions
  • Atomic: Either all changes succeed or all roll back
  • Isolated: Cannot interact with the outside world (no network, no filesystem)
  • Callable: Clients invoke reducers as remote procedure calls

Critical Reducer Rules

  1. No global state: Relying on static variables is undefined behavior
  2. No side effects: Reducers cannot make network requests or access files
  3. Store state in tables: All persistent state must be in tables
  4. No return data: Reducers do not return data to callers — use subscriptions
  5. Must be deterministic: No random, no timers, no external I/O

Defining Reducers

Rust:

#[spacetimedb::reducer]
pub fn create_user(ctx: &ReducerContext, name: String, email: String) -> Result<(), String> {
    if name.is_empty() {
        return Err("Name cannot be empty".to_string());
    }
    ctx.db.user().insert(User { id: 0, name, email });
    Ok(())
}

C#:

[SpacetimeDB.Reducer]
public static void CreateUser(ReducerContext ctx, string name, string email)
{
    if (string.IsNullOrEmpty(name))
        throw new ArgumentException("Name cannot be empty");
    ctx.Db.User.Insert(new User { Id = 0, Name = name, Email = email });
}

ReducerContext

Every reducer receives a ReducerContext providing:

  • Database: ctx.db (Rust field, TS property) / ctx.Db (C# property)
  • Sender: ctx.sender() (Rust method) / ctx.Sender (C# property) / ctx.sender (TS property)
  • Connection ID: ctx.connection_id() (Rust method) / ctx.ConnectionId (C# property) / ctx.connectionId (TS property)
  • Timestamp: ctx.timestamp (Rust field, TS property) / ctx.Timestamp (C# property)

Event Tables (2.0)

Event tables are the preferred way to broadcast reducer-specific data to clients.

#[table(accessor = damage_event, public, event)]
pub struct DamageEvent {
    pub target: Identity,
    pub amount: u32,
}

#[reducer]
fn deal_damage(ctx: &ReducerContext, target: Identity, amount: u32) {
    ctx.db.damage_event().insert(DamageEvent { target, amount });
}

Clients subscribe to event tables and use on_insert callbacks. Event tables must be subscribed explicitly and are excluded from subscribe_to_all_tables().

Subscriptions

Subscriptions replicate database rows to clients in real-time.

How Subscriptions Work

  1. Subscribe: Register SQL queries describing needed data
  2. Receive initial data: All matching rows are sent immediately
  3. Receive updates: Real-time updates when subscribed rows change
  4. React to changes: Use callbacks (onInsert, onDelete, onUpdate)

Subscription Best Practices

  1. Group subscriptions by lifetime: Keep always-needed data separate from temporary subscriptions
  2. Subscribe before unsubscribing: When updating subscriptions, subscribe to new data first
  3. Avoid overlapping queries: Distinct queries returning overlapping data cause redundant processing
  4. Use indexes: Queries on indexed columns are efficient; full table scans are expensive

Modules

Modules are WebAssembly bundles containing application logic that runs inside the database.

Module Components

  • Tables: Define the data schema
  • Reducers: Define callable functions that modify state
  • Views: Define read-only computed queries
  • Event Tables: Broadcast reducer-specific data to clients (2.0)
  • Procedures: (Beta) Functions that can have side effects (HTTP requests)

Module Languages

Server-side modules can be written in: Rust, C#, TypeScript (beta)

Module Lifecycle

  1. Write: Define tables and reducers in your chosen language
  2. Compile: Build to WebAssembly using the SpacetimeDB CLI
  3. Publish: Upload to a SpacetimeDB host with spacetime publish
  4. Hot-swap: Republish to update code without disconnecting clients

Identity

Identity is SpacetimeDB's authentication system based on OpenID Connect (OIDC).

  • Identity: A long-lived, globally unique identifier for a user.
  • ConnectionId: Identifies a specific client connection.
#[spacetimedb::reducer]
pub fn do_something(ctx: &ReducerContext) {
    let caller_identity = ctx.sender();  // Who is calling?
    // NEVER trust identity passed as a reducer argument
}

Authentication Providers

SpacetimeDB works with many OIDC providers, including SpacetimeAuth (built-in), Auth0, Clerk, Keycloak, Google, and GitHub.

When to Use SpacetimeDB

Ideal Use Cases

  • Real-time games: MMOs, multiplayer games, turn-based games
  • Collaborative applications: Document editing, whiteboards, design tools
  • Chat and messaging: Real-time communication with presence
  • Live dashboards: Streaming analytics and monitoring

Key Decision Factors

Choose SpacetimeDB when you need:

  • Sub-10ms latency for reads and writes
  • Automatic real-time synchronization
  • Transactional guarantees for all operations
  • Simplified architecture (no separate cache, queue, or server)

Less Suitable For

  • Batch analytics: Optimized for OLTP, not OLAP
  • Large blob storage: Better suited for structured relational data
  • Stateless APIs: Traditional REST APIs do not need real-time sync

Common Patterns

Authentication check in reducer:

#[spacetimedb::reducer]
fn admin_action(ctx: &ReducerContext) -> Result<(), String> {
    let admin = ctx.db.admin().identity().find(&ctx.sender())
        .ok_or("Not an admin")?;
    Ok(())
}

Scheduled reducer:

#[spacetimedb::table(accessor = reminder, scheduled(send_reminder))]
pub struct Reminder {
    #[primary_key]
    #[auto_inc]
    id: u64,
    scheduled_at: ScheduleAt,
    message: String,
}

#[spacetimedb::reducer]
fn send_reminder(ctx: &ReducerContext, reminder: Reminder) {
    log::info!("Reminder: {}", reminder.message);
}

Editing Behavior

When modifying SpacetimeDB code:

  • Make the smallest change necessary
  • Do NOT touch unrelated files, configs, or dependencies
  • Do NOT invent new SpacetimeDB APIs — use only what exists in docs or this repo

平台分布

Codex

33.77%
按下载量换算308

Claude

29.68%
按下载量换算270

Cursor

21.86%
按下载量换算199

Gemini CLI

9.6%
按下载量换算87

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

继续浏览同类 Skills