schema-exploration — скилл для Claude Code
Скилл schema-exploration для Claude Code изучает существующую базу данных PostgreSQL перед написанием запросов и ответов о данных.
Apache-2.0 113 установок ★ 1 886 обновлён 2026-10-22
npx skills add timescale/pg-aiguide --skill schema-exploration -a claude-codeЧто делает schema-exploration
Агент обращается к каталогу PostgreSQL через запросы pg_catalog, находит нужные таблицы, представления, триггеры, рутины и расширения. Перед осмотром данных или статистики требуется явное разрешение пользователя. Запросы ориентированы на PostgreSQL 18, при этом нельзя менять структуру, роли и настройки сеанса, а также запускать функции или EXPLAIN ANALYZE на неизвестных запросах.
Рабочий процесс включает проверку версии сервера, выбор схем, сверку ключей и зависимостей, а также валидацию запросов через EXPLAIN. Скрипты используют параметризацию через $1 и $2, а подстановка ненадёжных имен в виде сырого SQL запрещена. Вся работа ведётся в рамках разрешенной базы данных без создания руководств по миграциям.
Какие задачи решает
- исследовать структуру неизвестной базы PostgreSQL перед написанием SQL
- найти нужные таблицы, представления, триггеры и расширения в каталоге
- проверить связи, ключи и зависимости между объектами схемы
- проверить корректность плана запроса через EXPLAIN
Примеры запросов агенту
- Исследуй схему базы данных PostgreSQL и найди таблицы, связанные с заказами
- Покажи структуру таблицы orders и её внешние ключи
- Напиши безопасный запрос для выборки последних записей по клиентам
Как установить schema-exploration
1Через Skills CLI (Vercel)
npx skills add timescale/pg-aiguide --skill schema-exploration -a claude-code2Вручную: положить файлы
~/.claude/skills/schema-exploration/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/schema-exploration/
1Через Skills CLI (Vercel)
npx skills add timescale/pg-aiguide --skill schema-exploration -a codex2Вручную: положить файлы
.agents/skills/schema-exploration/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add timescale/pg-aiguide --skill schema-exploration -a cursor2Вручную: положить файлы
.cursor/skills/schema-exploration/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install timescale/pg-aiguide skills/schema-exploration2Вручную: положить файлы
.github/skills/schema-exploration/SKILL.md1Через Skills CLI (Vercel)
npx skills add timescale/pg-aiguide --skill schema-exploration -a gemini-cli2Командой платформы
gemini skills install https://github.com/timescale/pg-aiguide --path skills/schema-explorationВручную: положить файлы
.devin/skills/schema-exploration/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add timescale/pg-aiguide --skill schema-exploration -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о schema-exploration
Как установить schema-exploration в Claude Code?
Выполните команду npx skills add timescale/pg-aiguide --skill schema-exploration -a claude-code, затем обратитесь к файлу ~/.claude/skills/schema-exploration/SKILL.md.
Что делает скилл schema-exploration?
Он помогает агенту изучать структуру PostgreSQL через каталог pg_catalog и составлять запросы без изменения данных и схем.
Что нужно для работы schema-exploration?
Требуется доступ к базе данных PostgreSQL и разрешение пользователя на просмотр табличных данных или статистики.
Исходный текст
SKILL.md · Apache-2.0
--- name: schema-exploration description: | 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. license: Apache-2.0 metadata: author: tigerdata --- # Explore a PostgreSQL database Start with the user's question, not a full-database audit unless that is the explicit ask. Use the database connection already available to you; if none is available, ask for access or work from provided schema files. Stay within the database and schemas the user has authorized. Catalog metadata can reveal sensitive names or source code: do not export it unnecessarily. ## Workflow 1. Establish the current database, server version, role, and scope. Use [overview](references/overview.md) for a small inventory. Choose relevant schemas; do not assume `public` contains the application. 2. Pick the most promising object(s) and read **only** the matching drill-down reference: [tables](references/tables.md), [partitioning/inheritance](references/partitioning-and-inheritance.md), [foreign tables](references/foreign-tables.md), [views](references/views.md), [routines](references/routines.md), [triggers](references/triggers.md), [security/RLS](references/security.md), or [extensions](references/extensions.md). Follow cross-references only when the question requires them. 3. Corroborate meaning with comments, definitions, keys, and known dependencies. Names are clues, not proof of business meaning. If data-derived values would help, use [data-derived values](references/data-values.md) **only after obtaining approval** for the specific columns and access method. Ask the user when semantics remain ambiguous. 4. If the user wants SQL, follow [query authoring](references/query-authoring.md): establish join keys and grain, then validate a vetted read-only query with plain `EXPLAIN` where authorized. Do not mistake a valid plan for proof of business semantics. 5. Stop once you can answer. Report the specific schema-qualified objects and evidence, distinguish observations from inferences, and state limitations (permissions, stale statistics, missing dependencies, unknown application logic). ## Example finding Illustrative only; report facts verified in the target database: - **Observed:** `sales.orders` has a primary key on `order_id` and a foreign key from `account_id` to `sales.accounts.account_id`. - **Inferred:** `sales.orders` likely records one row per order; the keys support this, but do not establish what the business calls an “order.” - **Unresolved:** The catalog does not show whether canceled orders remain in this table. Confirm with the application owner before assuming they do. ## Safety and execution - Prefer structural catalog queries; `pg_stats` is data-derived and requires approval too. Do not change schema, data, roles, or session-wide settings without authorization. Never call discovered functions or procedures, refresh materialized views, or run `EXPLAIN ANALYZE` on unknown queries. A function marked `STABLE` or `IMMUTABLE` is not a safety guarantee. - If your client supports transactions, use a read-only transaction and a reasonable statement timeout for exploration. Metadata queries are not a license to run full-table counts or unrestricted scans. Ask before sampling data; sample only when necessary, with explicit limits and a clear understanding of table size and access controls. - All reference queries are plain PostgreSQL SQL. Bind `$1`, `$2`, etc. as values using your client's API. `psql` users can follow the optional [psql adapter](references/psql.md). **Never interpolate an untrusted object name as raw SQL**; placeholders cannot replace SQL identifiers in data queries. - Queries target PostgreSQL 18. Each version-sensitive section notes alternatives for older majors where applicable. Check `server_version_num` first. If a query fails due to permissions or version differences, report the limitation instead of guessing.
© tigerdata · Apache-2.0 · timescale/pg-aiguide