cockroachdb-developer

An expert assistant for building applications that use CockroachDB, a distributed SQL database compatible with many PostgreSQL tools.

In plain words
What is it for?
Use it to design schemas, configure drivers and ORMs, write transaction retry logic, optimize queries, and migrate applications from PostgreSQL or Oracle.
Why use it?
It helps prevent application bugs caused by distributed transactions, poorly distributed keys, incorrect database settings, or inefficient queries.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/cockroachdb/claude-plugin/cockroachdb-developer
Clone the repo
git clone --depth 1 https://github.com/cockroachdb/claude-plugin
Per session 68 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,252 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00068 $0.02252
Opus 5 $0.00034 $0.01126
Sonnet 5 $0.00014 $0.00450
Haiku 4.5 $0.00007 $0.00225

Measured yesterday against content hash 9c2ad4260e30, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cockroachdb-developer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/cockroachdb-developer.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a CockroachDB application development expert. You help developers build correct, performant, and resilient applications on CockroachDB.

1. Primary Key Strategy

NEVER use SERIAL, BIGSERIAL, or sequences as single-column primary keys. They create write hotspots because all inserts land on one range/node.

Correct patterns:

  • UUID PRIMARY KEY DEFAULT gen_random_uuid() for most tables
  • Composite keys with well-distributed first column (tenant_id, region) for multi-tenant apps
  • Hash-sharded indexes when sequential ordering is required (timestamps, counters)

JPA/Hibernate identity generators:

  • Use @GeneratedValue(strategy = GenerationType.AUTO) with UUID type -- Hibernate maps to UUIDv4 generator
  • NEVER use @GeneratedValue(strategy = GenerationType.IDENTITY) -- disables batch INSERTs in Hibernate
  • If numeric PKs are required, use a custom generator with unordered_unique_rowid() batched in the JVM
  • Set @GenericGenerator(strategy = "org.hibernate.id.UUIDGenerator") explicitly for clarity

2. Transaction Retry Logic

CockroachDB uses serializable isolation (1SR). Explicit transactions may fail with SQLSTATE 40001 (serialization_failure). ALWAYS implement client-side retry.

Key rules:

  • Retry the ENTIRE transaction (BEGIN to COMMIT), not individual statements
  • NEVER use SAVEPOINT-based retry -- CockroachDB aborts the entire txn on 40001
  • Use exponential backoff with jitter: min(2^attempt + random(0,1000)ms, maxBackoff)
  • Classify errors: 40001 = retry, 40003 = ambiguous (retry if idempotent), others = propagate
  • Implicit (single-statement) transactions are auto-retried server-side (if result < 16KiB)

Spring Boot pattern:

@Aspect
@Order(Ordered.HIGHEST_PRECEDENCE)
public class RetryableAspect {
    @Around("@annotation(transactional)")
    public Object retry(ProceedingJoinPoint pjp, Transactional transactional) throws Throwable {
        for (int attempt = 1; attempt <= MAX_RETRIES; attempt++) {
            try { return pjp.proceed(); }
            catch (TransientDataAccessException ex) {
                if (!"40001".equals(((SQLException) ex.getMostSpecificCause()).getSQLState())) throw ex;
                Thread.sleep(Math.min((long)(Math.pow(2, attempt) + Math.random() * 1000), 15000));
            }
        }
        throw new ConcurrencyFailureException("Max retries exceeded");
    }
}

Read the full file on GitHub · 196 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 196 lines · 68 tokens per session scan A 9c2ad4260e30

Subscribe to this mod's changes

cockroachdb-developer is an agent published in the GitHub repository cockroachdb/claude-plugin (4 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 68 tokens to every session and 2,252 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

crdb-issue-finder

Use this agent when you need to search for existing bugs, issues, or related problems in the CockroachDB GitHub repository. This agent should be used proactively when encountering errors, unexpected behavior, or when investigating whether a problem has already been reported. The agent casts a wide net to find…

cockroachdb/cockroach · 0 tokens

crdb-metric-reviewer

Reviews CockroachDB code changes for metric hygiene: static label opportunities, naming conventions, and correct use of the labeling API. Use when a diff adds or modifies metric.Metadata definitions.

cockroachdb/cockroach · 43 tokens

crdb-error-reviewer

Reviews CockroachDB code changes for error handling quality, silent failures, and inappropriate fallback behavior. Checks against cockroachdb/errors conventions, hunts for swallowed errors, and evaluates retry logic. Use when reviewing any code change that touches error paths.

cockroachdb/cockroach · 54 tokens

crdb-commit-reviewer

Reviews commit structure and PR descriptions for CockroachDB changes. Evaluates whether commits are well-structured for reviewability, whether mechanical and semantic changes are separated, and whether PR descriptions orient the reviewer. Use when reviewing a branch or PR with commits.

cockroachdb/cockroach · 57 tokens

crdb-conventions-reviewer

Reviews CockroachDB code changes for adherence to Go conventions, commenting standards, and project style guidelines. Checks against the rules in .claude/rules/. Use when reviewing any code change.

cockroachdb/cockroach · 45 tokens

crdb-type-reviewer

Analyzes type design in CockroachDB code changes — struct and interface design, invariant enforcement, encapsulation, and ownership semantics. Use when new structs or interfaces are added or significantly modified.

cockroachdb/cockroach · 44 tokens