Token导航 LogoToken导航

Agent Skill · 研究检索

using-ably(巧妙地使用)

using-ably 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

using-ably 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 38,370。

总安装 1,568周安装 66GitHub Stars 1下载 549核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/ably/agent-skills --skill using-ably

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。适用于根据关键词、任务场景或来源线索进行信息检索的场景。通过 npx skills add 命令从指定 GitHub 仓库安装使用。安装前需确认权限范围和维护状态,注意是否触发联网或文件读写操作。

using-ably 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

using-ably 怎么安装?

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

using-ably 支持哪些 AI 工具?

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

using-ably 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

using-ably 是免费的吗?

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

using-ably 用的人多吗?

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

using-ably 安全吗?

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

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

值得选的地方

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

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

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

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
using-ably

巧妙地使用 · 本页

1,5681接触敏感数据未明确有提醒

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

SKILL.md 原文

Using Ably

Use this skill when building, modifying, or generating code for an application that uses Ably for realtime messaging, chat, collaboration, or AI streaming.

What Ably Is

Ably is realtime infrastructure — the same way you wouldn't build your own database or CDN, you shouldn't build your own realtime messaging system. Ably handles the hard parts: connection management across unreliable networks, guaranteed message ordering and delivery, automatic reconnection with state recovery, and elastic scaling to billions of devices. It works across platforms (25+ SDKs) and protocols (WebSocket, MQTT, SSE, HTTP), so you can focus on your application logic rather than transport reliability.

Documentation

Always check the official docs at ably.com/docs for current API references. For LLM-optimized documentation, use ably.com/llms.txt. The guidance below covers architectural decisions and common mistakes that documentation alone doesn't prevent.


Before Writing Code

Always verify against current documentation before generating Ably code. Training data goes stale — methods get renamed, parameters change, new products launch. These three checks prevent the most common LLM code generation failures.

1. Fetch Current Docs First

Before generating code for any Ably feature:

  1. Fetch https://ably.com/llms.txt?source=using-ably to get the documentation URL index
  2. Fetch the relevant product and platform documentation pages
  3. Verify method names, parameters, return types, and package versions against the fetched docs
  4. If a feature or method doesn't appear in the docs, it probably doesn't exist — don't fabricate it

Never guess or construct doc URLs. Only use URLs from llms.txt or web search results. If a URL 404s, go back to llms.txt. Web search is also allowed as a complementary approach. If llms.txt is unreachable, fall back to web search or browse https://ably.com/docs?source=using-ably directly.

2. Confirm SDK Availability

Not all products are available on all platforms. Before generating code, confirm from the fetched docs that the product has an SDK for the user's platform.

If no SDK exists:

  • State clearly: "[Product] does not currently have an SDK for [platform]"
  • Don't fabricate an API
  • Offer alternatives: REST API directly, a different product that IS available, or MQTT/SSE protocol adapters for constrained devices

3. Post-Generation Check

After generating code, verify these common-mistake patterns:

  • API key in client code? Must use authUrl/authCallback with JWT or token auth (see Section 3)
  • Chat SDK: attach() before subscribing? Subscribe first to avoid messages being silently lost (see Section 7)
  • React: Ably client created inside a component without cleanup? Create once outside and pass via provider, or use useEffect with proper cleanup (see Section 8)
  • Server-side: Realtime SDK used when REST would suffice? Default to Ably.Rest for publishing, token generation, history (see Section 2)
  • Connection cleanup on unmount/exit? Call realtime.close() (see Section 5)
  • Reimplementing built-in behavior? Don't add custom debounce for typing indicators, custom throttling for cursors, or custom conflict resolution for LiveObjects (see Section 9)

1. Understand the Product and SDK Landscape

Ably is a multi-product platform, not a single SDK. Choosing the wrong product or SDK is the most common integration mistake.

Product Layer: What Are You Building?

ProductUse CaseSDK
Pub/SubCore messaging: live dashboards, notifications, IoT, event streamingably (Realtime or REST)
AI TransportStreaming LLM tokens, multi-agent coordination, resumable AI sessionsably (Realtime)
LiveObjectsShared mutable state: counters, key-value maps, collaborative dataably + LiveObjects plugin
LiveSyncDatabase-to-frontend sync (PostgreSQL change streams)@ably-labs/models + ADBC connector
ChatChat rooms, typing indicators, reactions, message history, moderation@ably/chat
SpacesCollaborative cursors, avatar stacks, member locations, component locking@ably/spaces

SDK Architecture: Two Layers

Layer 1 — Core SDKs (used directly for Pub/Sub, AI Transport, LiveObjects, LiveSync):

SDKUse WhenConnection
Ably.RealtimeClient needs to subscribe to messages, presence, or state changesPersistent WebSocket
Ably.RestServer-side publish only, token generation, history queriesStateless HTTP

These are the foundation. AI Transport, LiveObjects, and LiveSync all use the core Realtime SDK directly — they are patterns and plugins on top of Pub/Sub, not separate SDKs.

Layer 2 — Product SDKs (higher-level abstractions for specific use cases):

SDKPurpose
@ably/chatRooms, typing indicators, reactions, message history, moderation
@ably/spacesCursors, avatar stacks, member locations, component locking

These product SDKs depend on the core Realtime SDK. You pass an Ably.Realtime instance when creating them. The underlying Realtime knowledge (auth, channels, presence) still applies.

Decision Rules

Q: Is this server-side or client-side?
├── Server-side:
│   ├── Publishing, token generation, history → Use Ably.Rest (stateless HTTP)
│   └── Need persistent connection (AI token streaming, subscribing) → Use Ably.Realtime
└── Client-side → Use Ably.Realtime, then:
    ├── Building chat? → Use @ably/chat (pass Realtime instance)
    ├── Building collaboration? → Use @ably/spaces (pass Realtime instance)
    ├── Need shared state? → Use LiveObjects plugin with Realtime
    ├── Syncing database? → Use @ably-labs/models with ADBC connector
    └── Otherwise → Use Ably.Realtime directly (Pub/Sub, AI Transport)

Server-side rule of thumb: Default to Ably.Rest for server operations. Only use Ably.Realtime on the server when you genuinely need a persistent connection — for example, an AI agent streaming tokens to clients, or a backend service that subscribes to events.

Common Mistakes

// WRONG: Using REST SDK then polling for messages
const rest = new Ably.Rest({ key: '...' });
setInterval(async () => {
  const history = await rest.channels.get('updates').history();
}, 1000);

// RIGHT: Using Realtime SDK to subscribe
const realtime = new Ably.Realtime({ key: '...' });
realtime.channels.get('updates').subscribe((msg) => {
  console.log('Received:', msg.data);
});

// WRONG: Using raw Pub/Sub for chat when Chat SDK exists
const channel = realtime.channels.get('chat-room');
channel.subscribe((msg) => { /* manually handling typing, reactions, history... */ });

// RIGHT: Using Chat SDK which handles all chat patterns
import { ChatClient } from '@ably/chat';
const chat = new ChatClient(realtime);
const room = await chat.rooms.get('my-room');
room.messages.subscribe((msg) => console.log(msg.text));
await room.typing.keystroke(); // built-in typing indicators

2. Use Modern SDK Patterns (v2.x)

Ably's JavaScript SDK v2.x uses async/await. Never generate callback-style 1.x patterns.

// WRONG: Old 1.x callback pattern (deprecated)
const channel = realtime.channels.get('updates');
channel.subscribe('event', function(message) {
  console.log(message.data);
});
channel.publish('event', { text: 'hello' }, function(err) {
  if (err) console.error(err);
});

// RIGHT: Modern 2.x async/await pattern
const channel = realtime.channels.get('updates');
channel.subscribe('event', (message) => {
  console.log(message.data);
});
await channel.publish('event', { text: 'hello' });

Imports and initialization — keep it simple:

// RIGHT: Standard ESM import
import Ably from 'ably';
const realtime = new Ably.Realtime({ key: 'your-key' });
const rest = new Ably.Rest({ key: 'your-key' });

// RIGHT: Chat SDK import
import { ChatClient } from '@ably/chat';

// WRONG: Don't invent type-based initialization
const options: Ably.Types.ClientOptions = { ... }; // unnecessary

If you hit ESM/CommonJS import errors, check that your tsconfig.json has "moduleResolution": "bundler" or "node16", and that you're importing from 'ably' (not subpaths). Don't try multiple import strategies — check the SDK README for your environment.

Server-side: Default to REST SDK. Only use Ably.Realtime on the server when you need a persistent connection.

// WRONG: Realtime SDK on server just to publish
const realtime = new Ably.Realtime({ key: '...' }); // opens WebSocket unnecessarily
await realtime.channels.get('events').publish('update', data);

// RIGHT: REST SDK for server-side publish
const rest = new Ably.Rest({ key: '...' }); // stateless HTTP
await rest.channels.get('events').publish('update', data);

// RIGHT: Realtime on server for AI streaming (message-per-response pattern)
// See ably.com/docs/ai-transport/token-streaming/message-per-response?source=using-ably
const channel = realtime.channels.get('conversation:123');
const { serials: [msgSerial] } = await channel.publish({ name: 'response', data: '' });
for await (const event of llmStream) {
  if (event.type === 'token') {
    channel.appendMessage({ serial: msgSerial, data: event.text });
  }
}

3. Authentication

API keys are for server-side only. Never expose them to clients.

API keys don't expire. If leaked, attackers have indefinite access until you regenerate the key.

Recommended: JWT Authentication

JWT is the recommended authentication method for client-side applications.

Why JWT over Ably tokens:

  • No round-trip to Ably servers — your backend creates and signs the JWT directly
  • Integrates with existing auth systems — uses standard JWT libraries you already have
  • Capabilities defined per-token — not limited to what's configured on the API key
  • Works everywhere — including environments without an Ably SDK (MQTT, embedded devices)

JWT Claims:

  • kid (header): Your Ably API key name (e.g., xVLyHw.abcdef)
  • iat: Issued-at timestamp (seconds)
  • exp: Expiration timestamp (seconds)
  • x-ably-capability: JSON string of channel permissions
  • x-ably-clientId (optional): Client identity for presence
// Server-side: Create JWT for client
import jwt from 'jsonwebtoken';

app.post('/api/ably-auth', (req, res) => {
  const apiKey = process.env.ABLY_API_KEY; // 'appId.keyId:keySecret'
  const [keyName, keySecret] = apiKey.split(':');

  const token = jwt.sign(
    {
      'x-ably-capability': JSON.stringify({
        'room:*': ['subscribe', 'publish', 'presence'],
        [`notifications:${req.user.id}`]: ['subscribe'],
      }),
      'x-ably-clientId': req.user.id,
    },
    keySecret,
    {
      expiresIn: '1h',
      keyid: keyName,
    }
  );

  res.json(token);
});

// Client-side: Use JWT with Ably
const realtime = new Ably.Realtime({
  authUrl: '/api/ably-auth',
  authMethod: 'POST',
});

Alternative: Ably Token Requests

JWT is recommended for most use cases, but Ably tokens may be preferred when your capability list is too large for JWT size limits (JWTs must fit within HTTP headers, ~8KB), or when you need to keep capabilities confidential since JWTs can be decoded by clients. The trade-off is that Ably token integration is more involved and doesn't support all JWT functionality like channel-scoped claims and per-connection rate limits.

// Ably's native token system (requires round-trip to Ably servers from backend)
app.post('/api/ably-token', (req, res) => {
  const client = new Ably.Rest({ key: process.env.ABLY_API_KEY });
  client.auth.createTokenRequest({
    clientId: req.user.id,
    capability: { 'room:*': ['subscribe', 'publish'] },
  }).then(tokenRequest => res.json(tokenRequest));
});

Rules

  • Server-side: API key is fine ({key: 'appId.keyId:keySecret'})
  • Client-side: Always use authUrl or authCallback — never embed the API key or pass a static token directly (it won't auto-refresh on expiry)
  • Set clientId if you need presence features — it's required for presence
  • Use capabilities to restrict what channels and operations each client can access

4. Channel Design

Channels separate messages into topics. Get the naming right early — it's hard to change later.

Rules:

  • Use : as a hierarchy separator: chat:room-123, orders:user-456
  • Channel names are case-sensitive
  • Don't create one channel per message — channels are long-lived topics
  • Use rules in the dashboard to apply settings (e.g., persistence, push notifications) to groups of channels

Common patterns:

chat:room-{roomId}           # Chat rooms
notifications:user-{userId}  # Per-user notifications
cursors:doc-{docId}          # Collaborative editing
events:{eventType}           # Event streaming
conversation:{sessionId}     # AI Transport sessions

5. Connection Management

The Realtime SDK manages reconnection automatically. Don't fight it.

Rules:

  • Don't manually reconnect — the SDK handles transient failures with exponential backoff
  • Listen to connection state changes to update UI:
realtime.connection.on('connected', () => { /* online */ });
realtime.connection.on('disconnected', () => { /* temporarily offline */ });
realtime.connection.on('suspended', () => { /* offline for extended period */ });
  • Call realtime.close() when done (component unmount, page unload, etc.)
  • Messages published while disconnected are received on reconnection (within the 2-minute recovery window)
  • For AI Transport (client-side): use channel rewind to hydrate returning clients with recent messages:
const channel = realtime.channels.get('conversation:123', {
  params: { rewind: '2m' }  // Replay last 2 minutes on attach
});

6. Presence

Presence tracks which clients are on a channel. Use it for "who's online" features.

Rules:

  • Set clientId during auth — it's required for presence
  • Call channel.presence.enter() to join, channel.presence.update() to update data, channel.presence.leave() to depart
  • Use channel.presence.get() for current members, channel.presence.subscribe() for changes
  • If a client disconnects ungracefully, Ably removes them after ~15 seconds (not instantly)
  • Don't use presence for high-frequency data (cursor positions, typing coordinates) — use channels instead. Presence is for low-frequency state (online/offline, user status)
  • For Chat: use room.presence instead of raw channel presence
  • For Spaces: use space.enter() / useMembers() hook. Spaces has dedicated cursors API for cursor positions

7. Chat SDK: Critical Lifecycle

If using @ably/chat, these are the most common mistakes:

Always subscribe before calling attach(). Attaching without subscribing first causes silent message loss — the worst kind of bug.

const room = await chat.rooms.get('my-room');

// WRONG: Attach without subscribing first — messages silently lost
await room.attach();
room.messages.subscribe((msg) => console.log(msg.text)); // may miss messages during attach

// RIGHT: Subscribe first, then attach
room.messages.subscribe((msg) => console.log(msg.text));
await room.attach();

Use the actual API. The Chat SDK does NOT have: threading, read receipts, file attachments, or room.messages.broadcast(). Use room.messages.send() to send messages.

Don't mix Chat and Pub/Sub patterns. If you're using @ably/chat, use room.messages, room.typing, room.reactions — not raw channel.subscribe() / channel.publish().

Built-in behavior you don't need to reimplement:

  • Typing indicator frequency control is handled by the SDK automatically
  • Room reactions delivery is handled by the SDK
  • Message ordering and history pagination are built-in

8. React Integration

Ably provides React hooks for each product:

ProductPackageKey Hooks
Pub/Subably/reactuseChannel, usePresence, useConnectionStateListener
Chat@ably/chat/reactuseMessages, useTyping, usePresence, useRoomReactions
Spaces@ably/spaces/reactuseMembers, useCursors, useLocations, useLocks

Critical rule: Don't create a new Ably client on every render. This creates a new WebSocket connection each time — a memory leak.

// WRONG: Creates new connection every render — memory leak
function Chat() {
  const ably = new Ably.Realtime({ authUrl: '/api/ably-auth' });
  // ...
}

// RIGHT: Create client once, pass via provider
const ably = new Ably.Realtime({ authUrl: '/api/ably-auth' });

function App() {
  return (
    <AblyProvider client={ably}>
      <ChannelProvider channelName="chat:room-1">
        <Chat />
      </ChannelProvider>
    </AblyProvider>
  );
}

// ALSO RIGHT: Create in useEffect with proper cleanup
function App() {
  const [client, setClient] = useState(null);
  useEffect(() => {
    const ably = new Ably.Realtime({ authUrl: '/api/ably-auth' });
    setClient(ably);
    return () => ably.close();
  }, []);
  // ...
}

9. Spaces and LiveObjects: Built-in Behavior

When using Spaces (@ably/spaces):

  • Cursor position batching is built-in — don't implement custom throttling
  • Member location tracking is built-in via space.locations
  • Component locking handles contention automatically via space.locks

When using LiveObjects:

  • Available data structures are Maps and Counters only (no custom object types)
  • Conflict resolution is built-in — don't implement your own
  • State recovery after reconnection is automatic
  • Prefer the path-based API over the instance API for simplicity

10. LiveSync: Database-to-Frontend

LiveSync connects your database to frontends: Database → ADBC Connector → Ably Channels → Models SDK → Frontend.

Key constraints: PostgreSQL requires logical replication (14+, WAL level change needs restart). MongoDB requires a replica set (no standalone). The Database Connector handles channel mapping automatically once you configure an ingress rule.

Always fetch current LiveSync docs from ably.com/docs/livesync — database permissions and connector configuration change across versions.


11. Production Checklist

Before going to production, verify:

  • No API keys in client code — use JWT or token auth via authUrl/authCallback
  • Capabilities are scoped — don't grant {"*":["*"]} to clients; restrict to specific channels and operations
  • Connection cleanup — call realtime.close() on unmount/unload to avoid connection leaks
  • Error handling — listen to connection.on('failed') and handle auth failures gracefully
  • Channel detach — detach from channels you no longer need (channel.detach())
  • Message size — messages are limited to 64KB by default; if you're hitting this, split payloads or reconsider message design
  • Idempotent publishing — set unique message IDs when exactly-once delivery matters
  • echoMessages: false — set this if publishers don't need to receive their own messages (saves bandwidth and cost)
  • Rate limits — Ably enforces rate limits (e.g., 50 messages/second per channel, 200 channels per connection). If you're hitting them, check your publish frequency and channel fan-out. Read the limits documentation

Error Handling

Ably error codes can be broad (e.g., 40000, 50000) — always read the error message text, not just the code. Every error code has a help page at https://help.ably.io/error/{code}.


12. Quick Reference

Product docs: Pub/Sub | Chat | Spaces | LiveObjects | LiveSync | AI Transport

Platform SDKs: JavaScript, React, Python, Ruby, Java, Kotlin, Swift,.NET, Go, PHP, Flutter — ably.com/docs/sdks

Ably CLI: Install with npm install -g @ably/cli to publish test messages, subscribe to channels, and verify setup. Run ably --help to discover commands.

For API references, start at ably.com/docs.

平台分布

Codex

34.12%
按下载量换算187

Claude

27.33%
按下载量换算150

Cursor

20.68%
按下载量换算114

Gemini CLI

9.3%
按下载量换算51

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

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

继续浏览同类 Skills