Teach Cursor YugabyteDB Best Practices with YugabyteDB Agent Skills

Cursor can help write SQL, review application code, and suggest indexes right inside your project. Giving its agent YugabyteDB-specific guidance makes those tasks more useful for distributed SQL.

In an earlier tip, we used YugabyteDB Agent Skills with Claude. You can use the same repository with Cursor.

🧠 Key insight: Install the YugabyteDB YSQL skill in your project, then ask Cursor to use it when reviewing schemas, queries, and application patterns. The guidance lives alongside your code and can be loaded when relevant.

What are YugabyteDB Agent Skills?

The official repository packages instructions and references for database tasks. Some useful starting points are:

SkillWhat it helps with
ysqlYSQL schema design, indexes, sharding, transactions, retries, and application development
ycqlYCQL partition keys, clustering columns, indexes, TTL, and batching
yb-k8s-operatorYugabyteDB Kubernetes Operator workflows
yba-apiYugabyteDB Anywhere REST API workflows
yb-perfPerformance investigation using plans, workload evidence, and metrics
yb-modelReviewing an existing YSQL data model from a captured evidence bundle

For this tip, we will focus on ysql.

Cursor supports Agent Skills in its editor and CLI. Skills use a SKILL.md entry point and may include supporting references or scripts. You can invoke a skill from the slash-command menu; the agent can also select relevant skills automatically.

Step 1: Install the YSQL skill for Cursor

Open your application project in Cursor, then open its integrated terminal at the project root.

You need Git and Node.js/npm. Use a Node.js version supported by the Skills CLI.

Install just the YSQL skill and explicitly target Cursor:

				
					npx skills add yugabyte/yugabytedb-skills --skill ysql --agent cursor
				
			

The explicit --agent cursor avoids relying on which agent the installer detects.

To make the skill available across your local projects instead:

				
					npx skills add yugabyte/yugabytedb-skills --skill ysql --agent cursor --global
				
			

Choose one scope for this walkthrough. Project scope is a useful choice when the guidance belongs with the application.

Check the installed skills:

				
					# Project installation
npx skills list --agent cursor

# Global installation
npx skills list --agent cursor --global
				
			

The current Skills CLI documents .agents/skills/ for Cursor project installations and ~/.cursor/skills/ for global installations. Check the installer’s output for the actual location rather than assuming it always writes to .cursor/skills/.

📁 Keep the complete skill: SKILL.md is the entry point. Supporting references and scripts may be part of the workflow, so preserve the whole skill folder.

Alternative: Copy the skill into the project

For a direct project-local setup, copy the complete folder into .cursor/skills/ysql/. From your project root, on macOS or Linux:

				
					yb_skills_tmp="$(mktemp -d)"
git clone --depth 1 https://github.com/yugabyte/yugabytedb-skills.git "$yb_skills_tmp/yugabytedb-skills"
mkdir -p .cursor/skills
cp -R "$yb_skills_tmp/yugabytedb-skills/skills/ysql" .cursor/skills/
				
			

Use this alternative in a project that does not already have an ysql skill installed. Its entry point should be:

				
					.cursor/skills/ysql/SKILL.md
				
			

Step 2: Confirm Cursor can use it

Start a new Agent chat. Type /, search for ysql, and select the skill.

Then ask:

				
					Use the YugabyteDB YSQL skill.

Tell me which skill file you loaded and summarize the guidance
you will apply when reviewing this project's SQL.
Do not modify files or connect to a database yet.
				
			

If the skill is missing, check that the folder is inside the project Cursor opened and that it contains SKILL.md. Reload the window and start a new Agent chat if discovery has not refreshed.

Skills supply guidance; they do not establish a database connection. The following prompts can be used without a running YugabyteDB cluster.

Demo 1: Review a PostgreSQL schema for YugabyteDB

Paste this prompt into Agent chat with the YSQL skill selected:

				
					Use the YugabyteDB YSQL skill.

Review this schema for a multi-tenant event application.
Most reads fetch the latest 100 events for one tenant.
Explain the tradeoffs before proposing changes.
Do not edit files or execute SQL yet.

CREATE TABLE events (
    id BIGSERIAL PRIMARY KEY,
    tenant_id UUID NOT NULL,
    event_ts TIMESTAMPTZ NOT NULL DEFAULT now(),
    event_type TEXT NOT NULL,
    payload JSONB
);

CREATE INDEX idx_events_event_ts
    ON events (event_ts DESC);

CREATE INDEX idx_events_tenant_ts
    ON events (tenant_id, event_ts DESC);

Distinguish hash-sharded and range-sharded access paths.
Do not assume BIGSERIAL automatically creates a write hotspot.
Identify any cluster settings or workload details you need.
				
			

A useful review should examine the tenant lookup pattern, index maintenance cost, timestamp ordering, data distribution, and whether cross-tenant time queries justify the standalone timestamp index.

It should also explain an important distinction: BIGSERIAL generates values; the key’s sharding determines where they are stored.

Check your environment:

				
					SHOW yb_use_hash_splitting_by_default;
				
			

With this setting on, an ordinary id BIGSERIAL PRIMARY KEY uses hash sharding. With it off, an unspecified key uses ascending range ordering. Explicit HASH, ASC, or DESC declarations make the intended layout clearer. Check the actual table and index definitions too: a current session setting does not prove how existing objects were created.

A tenant-hashed design can suit tenant-scoped reads, but one very busy tenant may still concentrate writes. Changing a primary key also changes uniqueness and lookup semantics, so a recommendation must account for the application’s use of id.

🔍 Review the reasoning: A convincing answer explains how the proposed keys support your queries and distribute active traffic. Replacing every sequential ID with a UUID is not a complete data-modeling strategy.

Demo 2: Ask for a covering index

Use the original events table and ask:

				
					Use the YugabyteDB YSQL skill.

Recommend an index for this query. Explain the key order,
which columns belong in INCLUDE, and the write/storage cost.
Compare the recommendation with idx_events_tenant_ts.

SELECT tenant_id, event_ts, event_type
FROM events
WHERE tenant_id = $1
  AND event_ts >= now() - interval '1 day'
ORDER BY event_ts DESC
LIMIT 100;

Do not execute DDL. Explain how I should validate the plan.
				
			

One candidate to evaluate is:

				
					CREATE INDEX idx_events_tenant_ts_cover
    ON events (tenant_id HASH, event_ts DESC)
    INCLUDE (event_type);
				
			

Here, tenant_id supports the equality lookup, event_ts DESC supports the time predicate and requested order, and event_type is available from the index.

The index covers this query and can enable an index-only plan, avoiding base-table fetches. That is a candidate to measure, rather than a guaranteed optimizer choice. Large JSONB payloads do not belong in every covering index just because they are available.

Also compare this index with the existing tenant/time index. If the covering index meets the workload’s needs, evaluate replacing the overlapping index rather than keeping both indefinitely.

Step 3: Validate on your YugabyteDB release

For execution, use a disposable test database with representative data. Capture the original plan, add the candidate index, refresh statistics, and capture the plan again.

Replace this example tenant UUID with one present in your test data:

				
					ANALYZE events;

EXPLAIN (ANALYZE, DIST, COSTS OFF)
SELECT tenant_id, event_ts, event_type
FROM events
WHERE tenant_id = '00000000-0000-0000-0000-000000000001'::uuid
  AND event_ts >= now() - interval '1 day'
ORDER BY event_ts DESC
LIMIT 100;
				
			

Compare the scan type, sorting, storage table/index read requests, rows scanned, and execution time. A tiny or empty table may produce a sequential scan and tells you little about production performance.

Feed both plans back to Cursor:

				
					Use the YugabyteDB YSQL skill.

Compare these before-and-after EXPLAIN (ANALYZE, DIST) plans.
Explain what changed in storage reads, sorting, and execution time.
Separate observations from hypotheses.
Do not invent performance improvements.
				
			

The prompts and index above are examples to run yourself; they are not a transcript of a measured Cursor session.

⚠️ Validate before adopting: Skills add useful context, but database behavior, query plans, and representative workload measurements determine whether a recommendation is right.

Final Takeaway

YugabyteDB Agent Skills give Cursor a reusable source of database-specific guidance inside your development workflow.

Install the skill, invoke it explicitly for a review, and give the agent your actual queries and environment details. Then use YugabyteDB plans and measurements to decide which recommendations to keep.

✅ Better context, better first drafts: Let Cursor help explain the options. Use workload evidence and expert review to choose the final design.

Useful Links

ResourceDescription
Original Claude tipThe earlier walkthrough using the same skill repository
YugabyteDB Agent SkillsOfficial skills and current catalog
Cursor Agent Skills announcementNative skills support and slash-menu invocation
Skills CLI commandsInstallation, scope, listing, and updates
Skills CLI agent pathsCurrent Cursor installation locations
YugabyteDB data shardingHash and range distribution
Secondary indexesIndex design and covering access
EXPLAIN with distributed metricsMeasuring query behavior

Have Fun!

At AWS re:Invent this year, we had a first-floor meeting room for customer conversations. On the wall, I spotted what I assumed was standard-issue IKEA art. Turns out, even the décor was giving a YugabyteDB pitch. 😂

These were created by Bronwyn Campbell, our Sr. Director of Demand Generation, who somehow made database architecture look like something you’d hang in your living room. Very creative… and a great touch for the space. I clearly need to read the fine print before judging the artwork!

Looking closely, the two prints highlight:

PrintWhat it represents
Context Everywhere
Meko by YugabyteDB
Agent memory and shared knowledge. The caption reads:
“Every agent keeps its own memory. What is worth sharing becomes knowledge.”
Postgres Anywhere
YugabyteDB AMP
Appears to represent a single PostgreSQL endpoint abstracting the infrastructure behind it.
The many connections converging on one point reinforce that idea.
The smaller caption is too blurry to read confidently.