Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

CockroachDB CLI

$ cockroach Official High Risk
Cockroach Labs · Database & Data · CockroachDB Software License (BSL-derived) · macos / linux

The cockroach CLI serves both as the database binary and the operational client (cockroach sql, cockroach node status, cockroach cert). Supports --execute one-shot SQL queries, --format=json/tsv/csv, and TLS certificate flags.

FCRS-1.0 Score
82 /100
Good
Medium Confidence
Zero-Friction Install
brew install cockroachdb/tap/cockroach
CLI vs MCP Decision CLI Only

cockroach sql --execute and cockroach node status --format=json give direct distributed cluster telemetry and SQL access without an MCP wrapper.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Supports --execute one-shot SQL, --format=json/csv/tsv, and COCKROACH_URL env auth.

  • Supports cockroach sql --execute --format=json and node status --format=json
Trust & Safety 19 / 25

Requires TLS certs by default for secure clusters, though cockroach sql executes arbitrary DDL/DML if user privileges allow.

  • Default TLS cert enforcement on secure clusters; no client-side --readonly flag
Setup & Portability 12 / 15

Heavy monolithic binary distributed via Homebrew/tarball for macOS and Linux; no native Windows binary.

  • Large ~150MB+ binary limited to macOS and Linux
Utility & Efficiency 13 / 15

Combines distributed SQL client, node ops, cert generation, and in-memory single-node testing.

  • All-in-one binary covers client SQL, node ops, and start-single-node
Maintenance & Lineage 9 / 10

Official cockroachdb/cockroach binary maintained by Cockroach Labs.

  • Official cockroachdb/cockroach repository
Docs & Verifiability 8 / 10

Detailed command reference across SQL, cluster, and certificate subcommands.

  • Official docs at cockroachlabs.com/docs/stable/cockroach-commands

Security, Auth & Guardrails

Auth Modes
Env API Key Config File
Credential Storage

Connection URIs via COCKROACH_URL or --url; client TLS certs in ~/.cockroach-certs or --certs-dir.

Side Effects
Read-Only Local Write Remote Write Destructive
Cost & Quotas

Binary is free for self-hosted dev/testing under CockroachDB Software License; enterprise clusters require commercial licensing.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# CockroachDB CLI Agent Rules
- Always pass `--execute "<sql>"` and `--format=json` to `cockroach sql` (never open interactive shell).
- Prefer `SHOW` / `EXPLAIN` / `SELECT ... LIMIT` before mutating tables.
- NEVER run `cockroach quit`, `DROP DATABASE`, or `node decommission` autonomously.

Agent-Ready Command Recipes

Safe Read-Only Queries

Run a read-only SQL check as JSON
cockroach sql --url "$COCKROACH_URL" --format=json --execute "SHOW DATABASES;"

Executes a single SQL metadata statement non-interactively and formats rows as JSON.

Inspect cluster node status as JSON
cockroach node status --url "$COCKROACH_URL" --format=json

Reports live node liveness, ranges, and cluster health without mutating state.

Controlled Writes & Previews

Spin up a single-node local dev cluster
cockroach start-single-node --insecure --store=type=mem,size=1GiB --background

Starts an ephemeral in-memory local CockroachDB node for integration testing.

Strengths for Agents

  • + --execute plus --format=json enables clean non-interactive SQL and cluster status queries.
  • + start-single-node --store=type=mem spins up a fast local cluster for CI tests.
  • + Postgres wire compatibility lets psql also work alongside cockroach.

Caveats & Pitfalls

  • ! Binary footprint is large because client and server ship together.
  • ! No native Windows build; Windows users rely on WSL or containers.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI