Token导航 LogoToken导航TokenDH.com
运维和基础设施需要联网github未标认证来源可访问许可证需确认审计通过

ycqlycql 命令行

Agent Skill

ycql 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

240

周安装

10

GitHub Stars

3

下载量

80
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/yugabyte/yugabytedb-skills --skill ycql

简介

ycql 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合让 Agent 持续沉淀问题、修正和最佳实践。

  • 适用于运维和基础设施相关的错误记录与经验积累任务,可结合来源仓库和原始 README 核验具体用法。
  • 通过 npx skills add 命令从 GitHub 仓库安装,支持主流宿主环境集成。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • ycql 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

YugabyteDB YCQL Best Practices

YCQL is YugabyteDB's Cassandra-compatible API (port 9042). It provides global secondary indexes with strong consistency (ACID) — a key advantage over Apache Cassandra.

Schema Design

Partition Keys and Clustering Columns

Design partition keys for even data distribution and clustering columns for efficient range scans within a partition:

CREATE TABLE orders (
    customer_id UUID,
    order_date TIMESTAMP,
    order_id UUID,
    total DECIMAL,
    PRIMARY KEY ((customer_id), order_date DESC, order_id)
) WITH CLUSTERING ORDER BY (order_date DESC, order_id ASC);
  • Partition key (customer_id): Determines tablet placement. Choose for even distribution.
  • Clustering columns (order_date, order_id): Determine sort order within a partition.

Global Secondary Indexes

YCQL secondary indexes in YugabyteDB are global and strongly consistent (ACID), unlike Cassandra's local indexes:

CREATE INDEX idx_orders_date ON orders (order_date);

Covering Indexes

Use the INCLUDE clause to serve queries directly from the index without a table lookup:

CREATE INDEX idx_orders_customer ON orders (customer_id) INCLUDE (total, order_date);

Unique Indexes

CREATE UNIQUE INDEX idx_users_email ON users (email);

Data Types

  • JSONB: Supported for schema-less data, but use only for truly dynamic values. Regular columns outperform JSONB for frequent access patterns.
  • Counter increments: YugabyteDB supports integer increment/decrement with CAS operations in a single Raft round-trip (vs 4 in Apache Cassandra).
  • Collections: Design for small datasets. Large collections significantly impact performance.

Size Limits

  • Columns: Keep in the 2 MB range or less
  • Rows: Keep in the 32 MB range or less

TTL (Time-to-Live)

Automatic data expiration at table, row, or column level:

-- Table-level TTL
CREATE TABLE events (
    id UUID PRIMARY KEY,
    data TEXT
) WITH default_time_to_live = 86400;  -- 24 hours

-- Row-level TTL on insert
INSERT INTO events (id, data) VALUES (uuid(), 'event data') USING TTL 3600;

-- Column-level TTL
UPDATE events USING TTL 7200 SET data = 'updated' WHERE id = ?;

Note: TTL is not supported for transactional tables.

Consistency Levels

YugabyteDB YCQL supports only two consistency levels: QUORUM (default) and ONE. Writes are always strongly consistent (QUORUM). Use ONE for follower reads (stale, lower-latency reads from nearest replica).

// Default: QUORUM (strong consistency)
Statement stmt = SimpleStatement.newInstance("SELECT * FROM orders WHERE customer_id = ?", id)
    .setConsistencyLevel(ConsistencyLevel.ONE); // Read from nearest replica (may be stale)

Lightweight Transactions (Atomic Read-Modify-Write)

IF EXISTS / IF NOT EXISTS operations are much faster than in Apache Cassandra — 1 Raft round-trip vs 4 LWT round-trips:

-- Atomic insert-if-not-exists
INSERT INTO users (id, email, name) VALUES (?, ?, ?) IF NOT EXISTS;

-- Atomic conditional update
UPDATE accounts SET balance = ? WHERE id = ? IF balance >= ?;

Query Optimization

Prepared Statements (Always Use)

Prepared statements enable partition-aware routing — the driver calculates the partition hash and sends the query directly to the correct tablet leader:

PreparedStatement ps = session.prepare("SELECT * FROM orders WHERE customer_id = ?");
BoundStatement bs = ps.bind(customerId);
session.execute(bs);

Batching

Batch operations send all operations in a single RPC call:

BatchStatement batch = BatchStatement.newInstance(DefaultBatchType.UNLOGGED);
batch = batch.add(ps1.bind(...));
batch = batch.add(ps2.bind(...));
session.execute(batch);

Use batching to group operations that target the same partition for best performance.

Connection Pooling

Use a single cluster object to manage connections. Typically 1–2 connections per YB-TServer is sufficient for 64–128 threads. The driver handles token-aware routing automatically when using prepared statements.

Retry Policy

Default retry policy retries once on certain failures. For write-heavy workloads, configure a custom retry policy with backoff to handle transient tablet leader changes during load balancing.

Large Table Operations

Use partition_hash to parallelize scans across tablets:

SELECT * FROM large_table WHERE partition_hash(id) >= 0 AND partition_hash(id) < 5000;
SELECT * FROM large_table WHERE partition_hash(id) >= 5000 AND partition_hash(id) < 10000;

TRUNCATE vs DELETE

TRUNCATE is much faster than DELETE. DELETE inserts markers (tombstones) that require compaction. Use TRUNCATE for full-table cleanup.

Memory Configuration

For YCQL-only deployments, set --use_memory_defaults_optimized_for_ysql=false on yb-master to avoid reserving memory for the PostgreSQL layer.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.85%
按下载量换算30

Claude

28.03%
按下载量换算22

Cursor

17.33%
按下载量换算14

Gemini CLI

8.16%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills