Token导航 LogoToken导航

Agent Skill · 开发

ably-realtime(巧妙地实时)

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

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

总安装 376周安装 16GitHub Stars 公开资料未说明下载 132核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/itzaks/ably-realtime-skill --skill ably-realtime

这个 Skill 是做什么的

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

ably-realtime 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态或代码变更进行整理。通过 npx 命令从 GitHub 安装,需确认权限范围和是否触发文件读写操作。

建议结合原始 README 核验具体用法,并关注维护状态与联网行为。使用前请评估是否会执行命令或修改文件,避免意外影响项目结构。

来源仓库内路径:skills/ably-realtime

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

ably-realtime 怎么安装?

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

ably-realtime 支持哪些 AI 工具?

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

ably-realtime 需要什么权限?

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

ably-realtime 是免费的吗?

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

ably-realtime 用的人多吗?

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

ably-realtime 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 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有提醒
ably-realtime

巧妙地实时 · 本页

376—需要联网未明确有提醒

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

SKILL.md 原文

Ably Realtime for React/TypeScript

Ably Realtime is a platform for building scalable real-time applications with pub-sub messaging, presence tracking, collaborative features, chat, and database synchronization.

When to Use Each Feature

Ably provides different abstractions for different real-time use cases:

  • Channels (Core Pub-Sub): Custom real-time messaging, notifications, live updates, event broadcasting
  • Spaces: Participant state in collaborative UIs (live cursors, avatar stacks, user locations, component locking)
  • LiveObjects: Application state synchronization (counters, voting, shared configurations, game state) with conflict-free updates
  • Chat SDK: Complete messaging apps (1:1 chat, group conversations, livestream chat, support tickets)
  • LiveSync: Database-to-client synchronization (broadcasting Postgres changes, outbox pattern, transactional consistency)

Installation

# Core Ably (required)
npm install ably

# Additional packages (install as needed)
npm install @ably/spaces           # For Spaces
npm install @ably/chat             # For Chat SDK
npm install @ably-labs/models      # For LiveSync Models SDK

Basic Setup

All Ably features require a Realtime client. Create the client outside React components to prevent reconnections on re-renders:

// main.tsx or app.tsx
import * as Ably from 'ably';
import { AblyProvider } from 'ably/react';

// Create client OUTSIDE components
const realtimeClient = new Ably.Realtime({
  key: import.meta.env.VITE_ABLY_API_KEY,
  clientId: 'unique-user-id', // Required for Spaces and Chat
});

function Root() {
  return (
    <AblyProvider client={realtimeClient}>
      <App />
    </AblyProvider>
  );
}

For production applications, use token authentication instead of API keys. See references/auth-security.md.

Quick Start: Channels (Core Pub-Sub)

Basic real-time messaging with channels:

import { ChannelProvider, useChannel } from 'ably/react';

// Wrap with ChannelProvider
<ChannelProvider channelName="notifications">
  <NotificationComponent />
</ChannelProvider>

// Use in component
function NotificationComponent() {
  const { publish } = useChannel('notifications', (message) => {
    console.log('Received:', message.data);
    // Update local state with message
  });

  const sendNotification = () => {
    publish('alert', { text: 'New update!', timestamp: Date.now() });
  };

  return <button onClick={sendNotification}>Send</button>;
}

For detailed channel operations, presence tracking, and history, see references/channels/.

Quick Start: Spaces (Collaborative UI)

Track participant state for collaborative features:

import Spaces from '@ably/spaces';
import { SpacesProvider, SpaceProvider, useMembers, useCursors } from '@ably/spaces/react';

// Setup (in root)
const spaces = new Spaces(realtimeClient);

<SpacesProvider client={spaces}>
  <SpaceProvider name="my-collaborative-space">
    <CollaborativeEditor />
  </SpaceProvider>
</SpacesProvider>

// Avatar stack
function AvatarStack() {
  const { self, others } = useMembers();

  return (
    <div>
      <Avatar user={self} />
      {others.map(member => (
        <Avatar key={member.connectionId} user={member} />
      ))}
    </div>
  );
}

// Live cursors
function CursorTracking() {
  const { set } = useCursors((update) => {
    // Render other users' cursors
    renderCursor(update.connectionId, update.position);
  });

  useEffect(() => {
    const handleMove = (e: MouseEvent) => {
      set({ position: { x: e.clientX, y: e.clientY } });
    };
    window.addEventListener('mousemove', handleMove);
    return () => window.removeEventListener('mousemove', handleMove);
  }, [set]);

  return <canvas id="cursor-layer" />;
}

For locations, component locking, and advanced patterns, see references/spaces/.

Quick Start: LiveObjects (Shared State)

⚠️ Public Preview: LiveObjects API may change before general availability.

Conflict-free shared state synchronization:

import { LiveCounter, LiveMap } from "ably/liveobjects";

async function setupSharedState() {
  const channel = realtimeClient.channels.get("game:lobby-1");
  const gameState = await channel.object.get();

  // Create shared counter
  await gameState.set("score", LiveCounter.create(0));

  // Create shared map
  await gameState.set(
    "players",
    LiveMap.create({
      player1: { name: "Alice", ready: false },
      player2: { name: "Bob", ready: false },
    }),
  );

  // Subscribe to changes
  gameState.get("score").subscribe(() => {
    console.log("Score:", gameState.get("score").value());
  });

  // Update values
  await gameState.get("score").increment(10);
  await gameState.get("players").set("player1", { name: "Alice", ready: true });
}

React integration:

function GameLobby() {
  const [score, setScore] = useState(0);
  const [players, setPlayers] = useState({});

  useEffect(() => {
    let gameState: any;

    async function init() {
      const channel = realtimeClient.channels.get('game:lobby-1');
      gameState = await channel.object.get();

      // Subscribe to updates
      gameState.get('score').subscribe(() => {
        setScore(gameState.get('score').value());
      });

      gameState.get('players').subscribe(() => {
        setPlayers(gameState.get('players').value());
      });
    }

    init();

    return () => {
      // Cleanup subscriptions
    };
  }, []);

  return (
    <div>
      <h2>Score: {score}</h2>
      {Object.entries(players).map(([id, player]: [string, any]) => (
        <div key={id}>{player.name} - {player.ready ? '✓' : '...'}</div>
      ))}
    </div>
  );
}

For LiveMap batch operations, composability, and detailed API, see references/liveobjects/.

Quick Start: Chat SDK

Purpose-built chat with rooms, messages, typing indicators, and reactions:

import { ChatClient } from '@ably/chat';
import { ChatClientProvider, ChatRoomProvider, useMessages, useTyping } from '@ably/chat/react';

// Setup (in root)
const chatClient = new ChatClient(realtimeClient);

<ChatClientProvider client={chatClient}>
  <ChatRoomProvider name="support:ticket-123">
    <ChatRoom />
  </ChatRoomProvider>
</ChatClientProvider>

// Chat component
function ChatRoom() {
  const [messages, setMessages] = useState<Message[]>([]);
  const { currentlyTyping, keystroke } = useTyping();

  const { send, getPreviousMessages } = useMessages({
    listener: (event) => {
      if (event.type === 'created') {
        setMessages(prev => [...prev, event.message]);
      }
    }
  });

  useEffect(() => {
    // Load history
    getPreviousMessages({ limit: 50 }).then(result => {
      setMessages(result.items.reverse());
    });
  }, []);

  const handleSend = (text: string) => {
    send({ text });
  };

  const handleTyping = () => {
    keystroke(); // Triggers typing indicator
  };

  return (
    <div>
      <MessageList messages={messages} />
      {currentlyTyping.length > 0 && (
        <TypingIndicator users={currentlyTyping} />
      )}
      <MessageInput onSend={handleSend} onKeyPress={handleTyping} />
    </div>
  );
}

For message updates/deletes, reactions, presence, and room lifecycle, see references/chat/.

Quick Start: LiveSync (Database Sync)

Broadcast database changes from PostgreSQL/Neon to clients:

Backend (Database + Outbox):

-- Outbox table for change events
CREATE TABLE outbox (
  sequence_id serial PRIMARY KEY,
  mutation_id TEXT NOT NULL,
  channel TEXT NOT NULL,
  name TEXT NOT NULL,
  data JSONB,
  processed BOOLEAN DEFAULT false
);

-- Trigger to notify on changes
CREATE FUNCTION outbox_notify() RETURNS trigger AS $$
BEGIN
  PERFORM pg_notify('ably_adbc', '');
  RETURN NULL;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER outbox_trigger
  AFTER INSERT ON outbox
  FOR EACH STATEMENT
  EXECUTE PROCEDURE outbox_notify();
// API route - transactional write
export async function POST(req: Request) {
  const { documentId, content } = await req.json();

  await db.transaction(async (trx) => {
    // Update application data
    await trx("documents")
      .where({ id: documentId })
      .update({ content, updated_at: new Date() });

    // Insert change event
    await trx("outbox").insert({
      mutation_id: crypto.randomUUID(),
      channel: `document:${documentId}`,
      name: "document.updated",
      data: { id: documentId, content },
    });
  });

  return Response.json({ success: true });
}

Frontend (Subscribe to Changes):

function DocumentEditor({ documentId }: { documentId: string }) {
  const [content, setContent] = useState('');

  const { channel } = useChannel(`document:${documentId}`, (message) => {
    if (message.name === 'document.updated') {
      setContent(message.data.content);
    }
  });

  useEffect(() => {
    // Load initial state
    fetch(`/api/documents/${documentId}`)
      .then(r => r.json())
      .then(doc => setContent(doc.content));
  }, [documentId]);

  return <textarea value={content} onChange={(e) => setContent(e.target.value)} />;
}

For Models SDK with optimistic updates, integration setup, and advanced patterns, see references/livesync/.

Common Patterns

Pattern: Load History Before Subscribing

function ChatWithHistory() {
  const [messages, setMessages] = useState<any[]>([]);

  const { channel } = useChannel('chat', (message) => {
    setMessages(prev => [...prev, message]);
  });

  useEffect(() => {
    async function loadHistory() {
      const history = await channel.history({ limit: 50 });
      setMessages(history.items.reverse());
    }
    loadHistory();
  }, [channel]);

  return <MessageList messages={messages} />;
}

Pattern: Optimistic Updates with Confirmation

function OptimisticComment({ postId }: { postId: string }) {
  const [comments, setComments] = useState<Comment[]>([]);
  const pendingMutations = useRef(new Map());

  useChannel(`post:${postId}`, (message) => {
    const mutationId = message.data.mutation_id;

    // Remove optimistic entry, add confirmed
    if (pendingMutations.current.has(mutationId)) {
      setComments(prev => {
        const withoutOptimistic = prev.filter(c => c.id !== mutationId);
        return [...withoutOptimistic, message.data];
      });
      pendingMutations.current.delete(mutationId);
    } else {
      setComments(prev => [...prev, message.data]);
    }
  });

  const addComment = async (text: string) => {
    const mutationId = crypto.randomUUID();
    const optimistic = { id: mutationId, text, pending: true };

    // Add optimistically
    setComments(prev => [...prev, optimistic]);
    pendingMutations.current.set(mutationId, optimistic);

    // Send to backend
    await fetch('/api/comments', {
      method: 'POST',
      body: JSON.stringify({ mutationId, postId, text })
    });
  };

  return <CommentList comments={comments} onAdd={addComment} />;
}

Pattern: Presence with Profile Data

import { usePresence, usePresenceListener } from 'ably/react';

function OnlineUsers() {
  usePresence('room', {
    username: 'Alice',
    avatar: '/avatars/alice.jpg',
    status: 'active'
  });

  const { presenceData } = usePresenceListener('room');

  return (
    <div>
      <h3>Online ({presenceData.length})</h3>
      {presenceData.map(member => (
        <div key={member.connectionId}>
          <img src={member.data?.avatar} alt={member.data?.username} />
          <span>{member.data?.username}</span>
          <span>{member.data?.status}</span>
        </div>
      ))}
    </div>
  );
}

Pattern: Connection State Monitoring

import { useConnectionStateListener, useAbly } from 'ably/react';

function ConnectionStatus() {
  const ably = useAbly();
  const [state, setState] = useState(ably.connection.state);
  const [error, setError] = useState<string | null>(null);

  useConnectionStateListener((stateChange) => {
    setState(stateChange.current);

    if (stateChange.current === 'failed' || stateChange.current === 'suspended') {
      setError(stateChange.reason?.message || 'Connection issue');
    } else {
      setError(null);
    }
  });

  return (
    <div className={`status-${state}`}>
      {state === 'connected' ? '🟢' : '🔴'} {state}
      {error && <span>{error}</span>}
    </div>
  );
}

TypeScript Types

Ably provides comprehensive TypeScript definitions. Import types as needed:

import type * as Ably from "ably";
import type { Message } from "@ably/chat";
import type { SpaceMember, CursorUpdate } from "@ably/spaces";

const handleMessage = (msg: Ably.Message) => {
  console.log(msg.name, msg.data, msg.timestamp);
};

const handleCursor = (update: CursorUpdate) => {
  const position: { x: number; y: number } = update.position;
};

Progressive References

For detailed documentation on specific features:

  • Core Channels - Channel operations, presence, history, connection management
  • Spaces - Setup, React hooks (useMembers, useCursors, useLocations, useLocks), patterns
  • LiveObjects - Overview, API reference (LiveCounter, LiveMap), composability, batch operations
  • Chat SDK - Setup, React hooks (useMessages, useTyping, useRoomReactions), message CRUD, features
  • LiveSync - Outbox pattern, integration setup, Models SDK, optimistic updates, React patterns
  • Auth & Security - Token authentication, clientId, capabilities, production best practices

Troubleshooting

Connection limit exceeded

Each Realtime client instance creates a connection. Create the client once outside React components:

// ❌ Wrong - creates new connection on every render
function App() {
  const client = new Ably.Realtime({ key });
  return <AblyProvider client={client}>...</AblyProvider>;
}

// ✅ Correct - single connection
const client = new Ably.Realtime({ key });
function App() {
  return <AblyProvider client={client}>...</AblyProvider>;
}

Provider nesting issues

Ensure correct provider hierarchy:

// For Spaces
<AblyProvider client={realtimeClient}>
  <SpacesProvider client={spacesClient}>
    <SpaceProvider name="space-name">
      {/* Your components */}
    </SpaceProvider>
  </SpacesProvider>
</AblyProvider>

// For Chat
<AblyProvider client={realtimeClient}>
  <ChatClientProvider client={chatClient}>
    <ChatRoomProvider name="room-name">
      {/* Your components */}
    </ChatRoomProvider>
  </ChatClientProvider>
</AblyProvider>

Channel not receiving messages

  1. Check channel name matches exactly (case-sensitive)
  2. Verify API key has required capabilities
  3. Ensure clientId is set when using presence or Chat
  4. Check connection state with useConnectionStateListener

LiveObjects not syncing

  1. Verify LiveObjects is enabled in your Ably app (Dashboard → Settings)
  2. Check channel is attached: channel.state === 'attached'
  3. Ensure proper await on async operations
  4. LiveObjects requires Ably protocol version 2 (set automatically)

Chat messages not persisting

Chat messages persist for 30 days by default. Check:

  1. Ably app has Chat enabled
  2. Room is properly attached before sending
  3. Message has required fields (text or metadata)
  4. API key has publish capability

Best Practices

  1. Single Realtime Client: Create one client instance per application, share across components
  2. ClientId for Identity: Always set clientId when using Spaces or Chat for user identification
  3. Channel Naming: Use hierarchical names for organization: post:123, room:lobby:1, user:alice:notifications
  4. Presence Data: Keep presence data small (under 1KB) for efficiency
  5. History Limits: Load only necessary history to reduce bandwidth and latency
  6. Error Handling: Monitor connection state and handle disconnections gracefully
  7. Token Auth in Production: Never expose API keys in client code, use token authentication
  8. Cleanup: Unsubscribe from channels and detach when components unmount (hooks handle this automatically)
  9. LiveObjects Conflicts: Design for eventual consistency, use LiveCounter for numeric aggregations
  10. LiveSync Transactions: Always write to outbox within same transaction as application data

Additional Resources

平台分布

Codex

32.77%
按下载量换算43

Claude

28.83%
按下载量换算38

Cursor

19.94%
按下载量换算26

Gemini CLI

9.76%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

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

安装前确认

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

继续浏览同类 Skills