Token导航 LogoToken导航

Agent Skill · 开发

designing-multi-region-applications(设计多区域应用程序)

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

designing-multi-region-applications 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为只读;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 17,869。

总安装 374周安装 15GitHub Stars 9下载 121核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/cockroachlabs/cockroachdb-skills --skill designing-multi-region-applications

这个 Skill 是做什么的

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

该技能指导多区域 CockroachDB 应用设计,选择合适的数据分布模式。涵盖 REGIONAL BY ROW、GLOBAL 表与手动地理分区等方案对比与实施验证。适用于全球化部署场景,平衡读写延迟与数据一致性需求。安装前需确认数据库版本支持,注意可能影响事务行为,建议先在测试环境验证。

designing-multi-region-applications 属于开发类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/designing-multi-region-applications

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它标注为只读,先用只读任务试一次,确认行为符合预期再扩大使用范围。

常见问题

6 条

designing-multi-region-applications 怎么安装?

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

designing-multi-region-applications 支持哪些 AI 工具?

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

designing-multi-region-applications 需要什么权限?

权限级别是只读。该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

designing-multi-region-applications 是免费的吗?

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

designing-multi-region-applications 用的人多吗?

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

designing-multi-region-applications 安全吗?

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

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

值得选的地方

  • 同时适配 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有提醒
designing-multi-region-applications

设计多区域应用程序 · 本页

3749只读未明确通过

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

SKILL.md 原文

Designing Multi-Region Applications

Guides developers through selecting the right multi-region pattern for their CockroachDB application and implementing it with proper validation. Covers the decision model for choosing between regular regional tables, REGIONAL BY ROW, GLOBAL tables, and manual geo-partitioning, plus a hands-on demo framework for comparing approaches.

Complement to other skills: For transaction design patterns, see designing-application-transactions. For SQL syntax and schema design, see cockroachdb-sql.

When to Use This Skill

  • Deciding how to model multi-region read/write behavior in CockroachDB
  • Choosing between active-active and active-passive architectures
  • Evaluating REGIONAL BY ROW vs manual geo-partitioning
  • Understanding GLOBAL table behavior and trade-offs
  • Designing for local reads and writes in multiple regions
  • Building or presenting a multi-region demo or workshop
  • Validating leaseholder placement and zone configurations
  • Optimizing cross-region transaction latency

Do not use this skill when the question is only about SQL syntax, indexing, or generic schema design with no multi-region decision involved.

Prerequisites

  • Understanding of CockroachDB range architecture and leaseholder concepts
  • Multi-region cluster or cockroach demo with locality flags for testing
  • Knowledge of application write patterns (single-region vs multi-region)

Pattern Selection

Step 1: Identify the Application Write Model

Ask first: is there one write home, or many?

  • If the application has one primary region for read/write, start with a primary-region / regular regional-table model or a manually configured active-passive design.
  • If the application needs low-latency read/write in multiple regions, evaluate manual geo-partitioning or REGIONAL BY ROW.
  • If the table is mostly reference data that should read fast everywhere and the write path is not the main focus, consider GLOBAL tables.

Step 2: Choose the Pattern

A. Regular Regional Tables (Active-Passive)

Use when:

  • The application has one primary region for RW
  • Remote regions are secondary or read-mostly
  • Simplicity matters more than region-local writes everywhere

Characteristics:

  • All leaseholders stay in the active region
  • Replicas in other regions provide resiliency and single-region-failure survival
  • Indicative latency: ~20ms writes, ~2-5ms reads (local region)

Recommendation: Prefer the higher-level multi-region abstractions first unless the user explicitly needs manual control over partitions, voters, and lease preferences.

B. Manual Geo-Partitioning with Region-Specific Leaseholders

Use when:

  • The application is active-active
  • The data model is region-keyed
  • The team wants explicit operational control
  • Understanding internal mechanics (partitions, voters, lease preferences) is important

Characteristics:

  • Region-specific leaseholder pattern keeps writes around ~20ms and reads around ~2-5ms
  • The application must enforce reads and writes for a key in the same region
  • More DDL and operational burden
  • Best for teaching internals

Example DDL:

CREATE TABLE accounts_manual (
  account_id STRING(40),
  owner_id   STRING(40) NOT NULL,
  status     STRING(20) NOT NULL,
  region     STRING(10) NOT NULL,
  CONSTRAINT accounts_manual_pkey PRIMARY KEY (region, account_id)
);

ALTER INDEX accounts_manual_pkey
  PARTITION BY LIST (region) (
    PARTITION na_ne VALUES IN ('NA-NE'),
    PARTITION na_mw VALUES IN ('NA-MW'),
    PARTITION na_nw VALUES IN ('NA-NW')
  );

ALTER PARTITION na_ne OF INDEX accounts_manual_pkey
  CONFIGURE ZONE USING
    num_replicas      = 5,
    num_voters        = 5,
    voter_constraints = '{+region=NA-NE: 2, +region=NA-MW: 2, +region=NA-NW: 1}',
    lease_preferences = '[[+region=NA-NE]]';
C. REGIONAL BY ROW

Use when:

  • The workload is active-active
  • Each row naturally belongs to a region
  • The team wants local RW in multiple regions without hand-managing partition zone configs
  • The goal is the developer-facing multi-region abstraction

Characteristics:

  • All configured regions are possible home/leaseholder regions
  • Indicative latency: ~20ms writes, ~2-5ms reads (local region)
  • Less manual configuration than geo-partitioning
  • Default recommendation for region-affine application data

Example DDL:

CREATE DATABASE IF NOT EXISTS example_service_rbr;
ALTER DATABASE example_service_rbr PRIMARY REGION 'NA-NE';
ALTER DATABASE example_service_rbr ADD REGION 'NA-NW';
ALTER DATABASE example_service_rbr ADD REGION 'NA-MW';
ALTER DATABASE example_service_rbr SURVIVE REGION FAILURE;

USE example_service_rbr;

CREATE TABLE accounts_rbr (
  account_id STRING(40),
  owner_id   STRING(40) NOT NULL,
  status     STRING(20) NOT NULL,
  region     crdb_internal_region
    NOT NULL
    DEFAULT gateway_region()::crdb_internal_region,
  CONSTRAINT accounts_rbr_pkey PRIMARY KEY (region, account_id)
) LOCALITY REGIONAL BY ROW AS region;

Local allocation pattern:

WITH candidate AS (
  SELECT id, resource_code
  FROM resource_pool
  WHERE allocated_at IS NULL
    AND region = gateway_region()::crdb_internal_region
  ORDER BY random()
  LIMIT 1
  FOR UPDATE
)
UPDATE resource_pool
SET allocated_at = now()
WHERE id = (SELECT id FROM candidate);
D. GLOBAL Tables

Use when:

  • The table is global/reference-style data
  • The workload is primarily about broad read locality rather than region-owned writes

Important constraint: GLOBAL tables optimize for fast reads everywhere. Do not position them as an "RW everywhere" pattern without verifying product-specific behavior in the official documentation.

E. Survival Goals

Choose the survival goal based on the trade-off between write latency and durability:

-- Survive any single zone failure (default, 3+ zones required):
ALTER DATABASE mydb SURVIVE ZONE FAILURE;

-- Survive an entire region going down (3+ regions required):
ALTER DATABASE mydb SURVIVE REGION FAILURE;
GoalRequirementWrite LatencyData Safety
SURVIVE ZONE FAILURE3+ zonesLow (local consensus)Survives 1 zone outage
SURVIVE REGION FAILURE3+ regionsHigher (cross-region consensus)Survives 1 region outage

SURVIVE REGION FAILURE adds write latency because Raft consensus must span regions, but guarantees zero data loss even if an entire cloud region goes offline.

Pattern Comparison

AspectRegular RegionalManual Geo-PartitionREGIONAL BY ROWGLOBAL
Write modelSingle primary regionActive-active, region-keyedActive-active, row-affineWrite from primary region
Read localityLocal to primaryLocal to partitionLocal to row regionAll regions
Operational burdenLowHighMediumLow
ConfigurationMinimalExplicit partitions, zones, lease prefsDatabase-level abstractionsTable-level declaration
Best forSimple primary-region appsFull control over mechanicsDeveloper-facing multi-regionReference data

Live Demo Setup

For workshops and technical walkthroughs, use a 9-node local demo cluster to make multi-region locality observable.

Cluster Setup

cockroach demo \
  --nodes 9 \
  --no-example-database \
  --insecure \
  --demo-locality=\
region=NA-NE,zone=NA-NE-1:\
region=NA-NE,zone=NA-NE-2:\
region=NA-NE,zone=NA-NE-3:\
region=NA-MW,zone=NA-MW-1:\
region=NA-MW,zone=NA-MW-2:\
region=NA-MW,zone=NA-MW-3:\
region=NA-NW,zone=NA-NW-1:\
region=NA-NW,zone=NA-NW-2:\
region=NA-NW,zone=NA-NW-3

Demo Flow

Recommended presentation order:

  1. Start with the manual geo-partitioning path
  2. Show explicit partitioning and zone configuration
  3. Run validation queries and confirm lease homing
  4. Switch to REGIONAL BY ROW
  5. Run RBR validations
  6. Compare operational surface area

Validation Queries

Manual partitioning validation:

SHOW RANGES FROM INDEX accounts_manual_pkey WITH DETAILS;

Check that:

  • All expected partition values are present
  • Lease holder locality matches partition region
  • Mismatches return FAIL, otherwise PASS

RBR validation:

SHOW RANGES FROM TABLE accounts_rbr WITH DETAILS;

Check that:

  • Leaseholder locality coverage includes the expected regions
  • There are no unexpected lease regions

Demo Talking Points

Manual path:

  • Precise control over partitions, voters, replicas, and lease preferences
  • More DDL and operational burden
  • Best for teaching internals and understanding what the database does under the hood

RBR path:

  • Keeps application intent front and center
  • Less manual configuration
  • Easier to explain for app teams
  • Still grounded in the same topology

Cross-Region Latency Guidance

Transaction latency increases when the client is remote from the relevant leaseholder/quorum path.

Client LocationLocal RW LatencyCross-Region RW Latency
Same region as leaseholder~10-20ms—
Different region—~50-150ms+

Guidance:

  • Place latency-sensitive services close to their primary data locality
  • Use follower reads for non-critical display/reporting queries
  • Use multi-region table locality and zone configuration intentionally
  • Do not assume "distributed" means "same latency everywhere"

Output Expectations

A strong answer using this skill should include:

  1. The recommended pattern
  2. Why it fits the workload
  3. What the application must do (routing, row affinity, primary-region assumptions)
  4. What CockroachDB manages automatically vs manually
  5. Expected latency shape or locality behavior
  6. A warning when the user is asking for something the chosen pattern does not optimize for

Guardrails

  • Do not claim that regular primary-region tables provide symmetric low-latency writes from all regions
  • Do not claim that GLOBAL is the answer for all-region low-latency writes without supporting documentation
  • When comparing manual geo-partitioning vs REGIONAL BY ROW, explicitly call out control vs simplicity
  • When the user wants to understand internal mechanics, bias toward explaining the manual model first
  • When the user wants the best default application pattern, bias toward REGIONAL BY ROW for region-affine data
  • Keep region names and locality labels consistent across all SQL
  • Do not mix manual and abstraction approaches in the same explanation unless explicitly comparing them
  • Always include validation, not just DDL

Multi-Region Migration Checklist

For teams migrating from single-region PostgreSQL/Oracle to multi-region CockroachDB:

  1. Deploy nodes with --locality=region=<region>,zone=<zone>
  2. Set primary region: ALTER DATABASE <db> PRIMARY REGION '<region>'
  3. Add regions: ALTER DATABASE <db> ADD REGION '<region>' (for each)
  4. Set survival goal: ALTER DATABASE <db> SURVIVE ZONE|REGION FAILURE
  5. Classify tables: GLOBAL (reference data), REGIONAL BY ROW (row-affine), REGIONAL BY TABLE (default)
  6. Set localities: ALTER TABLE <t> SET LOCALITY <locality>
  7. Monitor leaseholder distribution in DB Console
  8. Test failover: kill a zone/region and verify survival goal holds

Safety Considerations

  • Multi-region configuration changes affect data placement across the cluster
  • Test multi-region configurations on demo or staging clusters before production
  • Validate leaseholder placement after configuration changes
  • Allow time for range rebalancing after topology changes

References

平台分布

Codex

35.99%
按下载量换算44

Claude

27.94%
按下载量换算34

Cursor

19.06%
按下载量换算23

Gemini CLI

8.86%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

继续浏览同类 Skills