instantdbReal-time database integration with InstantDB. Use this skill when working with InstantDB apps to perform admin operations (create/update/delete entities, link/unlink relationships, query data) and subscribe to real-time data changes. Triggers include mentions of InstantDB, real-time updates, database sync, entity operations, or when OpenClaw needs to send action updates visible to humans in real-time.
Install via ClawdBot CLI:
clawdbot install ubyjerome/instantdbNode.js integration for InstantDB enabling OpenClaw to perform admin operations and monitor real-time data changes via WebSocket subscriptions.
Install dependencies:
npm install
Set environment variables:
export INSTANTDB_APP_ID="your-app-id"
export INSTANTDB_ADMIN_TOKEN="your-admin-token"
Fetch data using InstantDB's query syntax:
const { InstantDBClient } = require('./scripts/instantdb.js');
const client = new InstantDBClient(appId, adminToken);
const result = await client.query({
tasks: {
$: {
where: { status: 'active' }
}
}
});
CLI:
./scripts/instantdb.js query '{"tasks": {}}'
Add new entities to a namespace:
const { entityId, result } = await client.createEntity('tasks', {
title: 'Process data',
status: 'pending',
priority: 'high'
});
CLI:
./scripts/instantdb.js create tasks '{"title": "Process data", "status": "pending"}'
Optional entity ID:
./scripts/instantdb.js create tasks '{"title": "Task"}' custom-entity-id
Modify existing entity attributes:
await client.updateEntity(entityId, 'tasks', {
status: 'completed'
});
CLI:
./scripts/instantdb.js update <entity-id> tasks '{"status": "completed"}'
Remove entities:
await client.deleteEntity(entityId, 'tasks');
CLI:
./scripts/instantdb.js delete <entity-id> tasks
Create relationships between entities:
await client.linkEntities(taskId, assigneeId, 'assignees');
CLI:
./scripts/instantdb.js link <parent-id> <child-id> assignees
Remove relationships:
await client.unlinkEntities(taskId, assigneeId, 'assignees');
CLI:
./scripts/instantdb.js unlink <parent-id> <child-id> assignees
Monitor data changes via WebSocket:
const subscriptionId = client.subscribe(
{ tasks: { $: { where: { status: 'active' } } } },
(data) => {
console.log('Data updated:', data);
},
(error) => {
console.error('Subscription error:', error);
}
);
// Later: client.unsubscribe(subscriptionId);
CLI (listens for specified duration):
./scripts/instantdb.js subscribe '{"tasks": {}}' 60 # Listen for 60 seconds
Execute multiple operations atomically using the tx builder:
const { tx, id } = require('@instantdb/admin');
await client.transact([
tx.tasks[id()].update({ title: 'Task 1' }),
tx.tasks[id()].update({ title: 'Task 2' })
]);
CLI:
./scripts/instantdb.js transact '[{"op": "update", "id": "...", "data": {...}}]'
Send real-time progress to human observers:
const { id } = require('@instantdb/admin');
// Create status entity
const actionId = id();
await client.createEntity('actions', {
type: 'file_processing',
status: 'started',
progress: 0,
timestamp: Date.now()
}, actionId);
// Update progress
await client.updateEntity(actionId, 'actions', {
progress: 50,
status: 'processing'
});
// Mark complete
await client.updateEntity(actionId, 'actions', {
progress: 100,
status: 'completed'
});
Track complex operations:
const { tx, id } = require('@instantdb/admin');
const workflowId = id();
const steps = ['Extract', 'Transform', 'Validate', 'Load', 'Verify'];
// Initialize workflow with linked steps
const txs = [
tx.workflows[workflowId].update({
name: 'Data Pipeline',
status: 'running',
currentStep: 1,
totalSteps: steps.length
})
];
const stepIds = steps.map((name, i) => {
const stepId = id();
txs.push(
tx.steps[stepId].update({
name,
order: i + 1,
status: 'pending'
}),
tx.workflows[workflowId].link({ steps: stepId })
);
return stepId;
});
await client.transact(txs);
// Update as steps complete
for (let i = 0; i < stepIds.length; i++) {
await client.updateEntity(stepIds[i], 'steps', {
status: 'completed'
});
await client.updateEntity(workflowId, 'workflows', {
currentStep: i + 2
});
}
Humans subscribe to watch OpenClaw's actions:
// Human's frontend code
import { init } from '@instantdb/react';
const db = init({ appId });
function ActionMonitor() {
const { data } = db.useQuery({
actions: {
$: {
where: { status: { in: ['started', 'processing'] } }
}
}
});
return data?.actions?.map(action => (
<div key={action.id}>
{action.type}: {action.progress}%
</div>
));
}
For long-running operations, stream updates:
const { id } = require('@instantdb/admin');
async function processLargeDataset(items) {
const progressId = id();
await client.createEntity('progress', {
total: items.length,
completed: 0,
status: 'running'
}, progressId);
for (let i = 0; i < items.length; i++) {
// Process item...
await processItem(items[i]);
// Update every 10 items
if (i % 10 === 0) {
await client.updateEntity(progressId, 'progress', {
completed: i + 1,
percentage: Math.round(((i + 1) / items.length) * 100)
});
}
}
await client.updateEntity(progressId, 'progress', {
completed: items.length,
percentage: 100,
status: 'completed'
});
}
See references/transactions.md for detailed transaction patterns including:
All operations return promises that reject on failure:
try {
const result = await client.createEntity('tasks', data);
} catch (error) {
console.error('Operation failed:', error.message);
}
See references/query_syntax.md for comprehensive query examples including:
references/query_syntax.mdreferences/transactions.mdAI Usage Analysis
Analysis is being generated⦠refresh in a few seconds.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection