database-analyst
Answer business questions from read-only connected databases using deterministic schema discovery and SQL evidence
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Answer business questions from read-only connected databases using deterministic schema discovery and SQL evidence
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | database-analyst |
| description | Answer business questions from read-only connected databases using deterministic schema discovery and SQL evidence |
| tags | ["database","connected-source","read-only","business-analysis"] |
| version | 1.0.0 |
Use this workflow when the user asks a business or analytical question and the project has a connected/read-only database source such as PostgreSQL, MySQL, DuckDB, or a warehouse catalog. This is the default path for "tap into my existing database" users.
Tools stay thin. The skill owns the workflow:
list_source_context / read_source_context load generated source docs,
column profiles, and relationship hints.list_sql_pairs / execute_sql_pair / read_sql_pair load and run
project-owned prompt→SQL examples.list_ask_tests / read_ask_test / run_ask_test inspect and run
project-owned QA oracles when the user asks about test coverage or failures.list_tables discovers queryable relations.describe_table inspects exact columns/types.execute_sql runs one read-only query at a time.execute_python is only for statistics/ML/visualization after SQL scopes the
dataset; do not use it for ordinary trend tables that SQL already answered.
A request for a "trend" means table/text analysis unless the user explicitly
asks for a chart, plot, dashboard, report, or visual.Do not invent schema. Do not suggest building pipelines unless the user asks for pipeline creation or durable transformation work.
Discover
list_source_context with a query derived from the
user's business terms and read the relevant SOURCE.md,
relationships.md, columns.md, or profiling.md.list_sql_pairs with the same business terms. SQL pairs are
authoritative business definitions, not optional examples.list_sql_pairs returns a file-level preview (one prompt
per file). A single file may contain many pairs. You MUST call
read_sql_pair for each potentially relevant file to inspect ALL
individual pairs inside before deciding there is no match. Never skip
this step — the matching pair may be buried inside a multi-pair file.execute_sql_pair so the pair's SQL runs
as-is. Do NOT rewrite, substitute columns, remove filters, or generate
ad-hoc SQL when a matching pair exists.list_ask_tests or
read_ask_test_result before proposing fixes.list_tables when generated context is absent, too broad, or needs
verification, unless the user already supplied a fully-qualified table
and columns.warehouse.analytics.orders when available.Inspect
describe_table for the most likely fact/view tables before writing joins or aggregations.describe_table confirms the column exists.Query
execute_sql_pair for a directly matching SQL pair — this is MANDATORY,
not optional. Only call execute_sql with ad-hoc SQL when no SQL pair
matches the user's question.execute_sql(sql="SELECT ...").query may be accepted as an alias, but prefer sql so tool calls are portable across providers.column ILIKE '%term%', not
function-style ILIKE(column, '%term%').CAST(SUM(revenue) AS DOUBLE) AS revenue.COALESCE(NULLIF(TRIM(CAST(column AS VARCHAR)), ''), 'Unknown').Recover
list_tables and retry with the discovered qualified name.describe_table and retry with the correct column.Answer
Carry forward the discovered source/table names in the conversation. When the user asks "now by region" or "compare with segment", reuse the prior table and only run the additional SQL needed. Do not re-ask what can be inferred from the previous turn.