Skip to content
Skill

Schema exploration

Lets an agent explore an unfamiliar PostgreSQL schema before writing SQL or answering data

Schema exploration is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
1.9K
Last commit
License
Apache-2.0
Listing updated

Similar skills

About Schema exploration

This skill guides an agent through reading an existing PostgreSQL database before it answers a data question. It starts with a small inventory of the server version, current role and relevant schemas, then narrows to the objects that match the question. The agent is directed to read metadata from pg_catalog using read-only queries, with separate reference notes for tables, partitioning and inheritance, foreign tables, views, routines, triggers, row-level security and extensions.

The workflow asks the agent to corroborate meaning from comments, keys and dependencies rather than trusting names alone. Data-derived statistics or sample rows are off limits until the user approves the specific columns and access method. When SQL is needed, the skill covers establishing join keys and grain and validating a query with a plain EXPLAIN, while avoiding running unknown functions, refreshing materialized views or using EXPLAIN ANALYZE.

It expects a PostgreSQL connection available to the agent, or schema files if no connection exists. The queries target PostgreSQL 18 with notes for older majors. The skill is not meant for schema design or migrations.

When your agent uses it

Explore an existing PostgreSQL database before answering questions about its data or writing SQL. Use this skill whenever a user asks for a query or a data-backed answer against an unfamiliar schema (counts, missing or failed records, recent changes), asks where a business concept lives, or asks how tables, joins, views, routines, triggers, RLS, or extensions work. Find the relevant objects with read-only pg_catalog queries, then request approval before inspecting data-derived statistics or rows. Not a schema-design or migration guide.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 13 files (50 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the pg plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add timescale/pg-aiguide
/plugin install pg@aiguide

Or copy only this skill to ~/.claude/skills/schema-exploration:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/schema-exploration &&
cp -R "$tmp/skills/schema-exploration" ~/.claude/skills/schema-exploration &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/schema-exploration inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/schema-exploration to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/schema-exploration &&
cp -R "$tmp/skills/schema-exploration" ~/.agents/skills/schema-exploration &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/schema-exploration inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/schema-exploration to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/schema-exploration &&
cp -R "$tmp/skills/schema-exploration" ~/.cursor/skills/schema-exploration &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/schema-exploration inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/timescale/pg-aiguide.git --path skills/schema-exploration

Or copy the folder to ~/.gemini/skills/schema-exploration yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/schema-exploration:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/timescale/pg-aiguide.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/schema-exploration &&
cp -R "$tmp/skills/schema-exploration" ~/.copilot/skills/schema-exploration &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/schema-exploration inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/timescale/pg-aiguide.git

Then copy pg-aiguide/skills/schema-exploration into your agent's skills folder as schema-exploration. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Database inventory
Checks the current database, server version, role and scope before choosing schemas to explore.
Read-only catalog queries
Finds relevant tables, views, routines, triggers and extensions through pg_catalog metadata.
Approval before data access
Requires user approval before inspecting data-derived statistics, sample rows or value distributions.
Join and grain checks
Establishes join keys and table grain before drafting SQL against an unfamiliar schema.
Safe query validation
Validates candidate queries with plain EXPLAIN and avoids running unknown functions or analyzing queries.
Limitations reporting
Separates observed facts from inferences and reports permission or version gaps instead of guessing.

Good for

  • Find where customer accounts and orders are stored in an unfamiliar database
  • Write a query counting failed payment records in a schema I have not used before
  • Explain how a set of views and triggers feed a reporting table
  • Check which tables a foreign key relationship connects before writing a join
  • Work out whether row-level security limits what a role can read

Schema exploration FAQ

Does the skill change my database?

No. It directs the agent to use read-only pg_catalog queries and a read-only transaction where the client supports it, and forbids changing schema, data, roles or session settings without authorization.

Can the agent look at my table data?

Not by default. Data-derived statistics and rows require approval for the specific columns and access method, and sampling should use explicit limits.

Which PostgreSQL versions are covered?

The queries target PostgreSQL 18, and version-sensitive sections note alternatives for older major versions. The agent is told to check server_version_num first.

Is Schema exploration for designing schemas or running migrations?

No. The skill states it is not a schema-design or migration guide; it is for exploring an existing database.

How do I install Schema exploration in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/schema-exploration to use it in all your projects, or to .claude/skills/schema-exploration in one project. Or install the pg plugin, which includes it: /plugin marketplace add timescale/pg-aiguide, then /plugin install pg@aiguide.

Does Schema exploration run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Schema exploration?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Schema exploration?

The closest alternatives to Schema exploration are Database migrations, Reviewing oracle to postgres migration, PostgreSQL code review, Dsql on rails and SQL code review.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from timescale/pg-aiguide

  1. Guides an agent in designing PostGIS spatial tables, types, SRIDs and indexes

    • Open source
    • 1.9K GitHub stars
    • Databases
  2. Guides an agent through PostgreSQL table design, types, constraints and indexing

    • Open source
    • 1.9K GitHub stars
    • Databases
  3. Scores existing PostgreSQL tables to find which should become TimescaleDB hypertables

    • Open source
    • 1.9K GitHub stars
    • Databases
  4. Guides an agent through pgvector setup, HNSW indexing and tuning for semantic search

    • Open source
    • 1.9K GitHub stars
    • Databases
  5. Guides an agent through PostgreSQL schema design, indexing, search, TimescaleDB

    • Open source
    • 1.9K GitHub stars
    • Databases