Best use case
cockroachdb is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
CockroachDB distributed SQL database. Use for geo-distributed data.
Teams using cockroachdb should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/cockroachdb/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How cockroachdb Compares
| Feature / Agent | cockroachdb | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
CockroachDB distributed SQL database. Use for geo-distributed data.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# CockroachDB
CockroachDB is a cloud-native, distributed SQL database. It survives disk, machine, rack, and even datacenter failures with zero downtime. It speaks PostgreSQL.
## When to Use
- **Global/Multi-Region Apps**: "Geo-partitioning" ties data to specific locations for low latency and compliance (GDPR).
- **Financial Ledgers**: Strong consistency (Serializable Isolation) is the default.
- **Serverless (2025)**: Use CockroachDB Serverless for auto-scaling from zero to millions of requests without managing nodes.
## Quick Start
```sql
-- Create a table (Primary Key defaults to UUID in 2025 best practices)
CREATE TABLE accounts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
balance DECIMAL(19,4)
);
-- Distributed Transaction
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 'uuid-1';
UPDATE accounts SET balance = balance + 100 WHERE id = 'uuid-2';
COMMIT;
```
## Core Concepts
### Ranges
Data is broken into 512MB chunks called "Ranges". These are replicated (Raft consensus) across 3+ nodes.
### Geo-Partitioning
You can tell the DB: "Keep German users' data in EU servers, and US users in US servers" using SQL `ALTER TABLE ... PARTITION BY ...`.
### Follow-the-Workload
The database automatically moves "leaseholders" (read/write leaders) close to where the requests are coming from for low latency.
## Best Practices (2025)
**Do**:
- **Use UUIDs**: Sequential keys (1, 2, 3) cause "hot spots" (all writes go to one Range). UUIDs distribute load.
- **Use Serverless**: For most start-ups/mid-size apps, the Serverless consumption model is cheaper and easier than managing nodes.
- **Retry Transactions**: In a distributed system, contention happens. Use client libraries that retry 40001 (serialization failure) errors automatically.
**Don't**:
- **Don't use `SELECT *` without Limits**: In a distributed DB, this might scatter-gather from 100 nodes.
- **Don't use Foreign Keys excessively**: Cross-range FK checks can be expensive.
## References
- [CockroachDB Documentation](https://www.cockroachlabs.com/docs/)Related Skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.
turbopack
Turbopack Rust-powered bundler. Use for fast builds.