with one click
schema-exploration
用于发现和理解数据库结构、表、列和关系,支持 M-Schema 格式输出,智能表过滤
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
用于发现和理解数据库结构、表、列和关系,支持 M-Schema 格式输出,智能表过滤
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
生成数据分析报告:探索表结构 → 多维度查询 → 智能深度分析归因 → 动态风格 HTML 可视化报告(ECharts)
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
所有联网操作必须通过此 skill 处理,包括:搜索、网页抓取、登录后操作、网络交互等。 触发场景:用户要求搜索信息、查看网页内容、访问需要登录的网站、操作网页界面、抓取社交媒体内容(小红书、微博、推特等)、读取动态渲染页面、以及任何需要真实浏览器环境的网络任务。
用于编写和执行 SQL 查询 - 支持多维度分析、多条 SQL 协同、智能图表推荐
| name | schema-exploration |
| description | 用于发现和理解数据库结构、表、列和关系,支持 M-Schema 格式输出,智能表过滤 |
当您需要以下操作时使用此技能:
使用 sql_db_list_tables 工具查看数据库中所有可用的表。
这将返回您可以查询的完整表列表。
当数据库表较多时,不要盲目获取所有表的 schema,而是先进行智能过滤:
内部思考模板:
用户问题:{user_question}
数据库所有表:
- {table1}, {table2}, ...
任务:从上述表中选出与用户问题直接相关的表。
考虑因素:
1. 表名是否与问题中的实体/指标匹配
2. 是否需要关联表来补充维度信息
3. 忽略明显无关的系统表、日志表
选出的相关表:[table1, table2, ...]
使用 sql_db_schema 工具配合表名来检查:
提示:可以一次传入多个表名(逗号分隔),减少工具调用次数。
使用 sql_db_table_relationship 工具获取表之间的外键/关联关系:
t_orders.customer_id = t_customers.id示例调用:
sql_db_table_relationship("t_orders, t_customers, t_products")
如果未配置表关系,可以通过以下方式推断:
当需要将 schema 信息传递给后续 SQL 生成步骤时,使用 M-Schema 格式组织信息:
【DB_ID】 {db_name}
【Schema】
# Table: {table_name}, {table_comment}
[
({column_name}:{column_type}, {column_comment}),
]
{foreign_key_1}
{foreign_key_2}
数据库特定规则:
schema.table_name 格式table_name引号规则:
| 数据库类型 | 引号 |
|---|---|
| MySQL | `反引号` |
| PostgreSQL | "双引号" |
| SQLite | "双引号" |
| SQL Server | [方括号] |
| Oracle | "双引号" |
| ClickHouse | "双引号" |
提供清晰的信息:
步骤 1: 使用 sql_db_list_tables
响应:
数据库包含多个表:
1. Customer - 存储客户信息
2. Employee - 存储员工信息
3. Invoice - 客户购买记录
4. InvoiceLine - 发票中的单个项目
...
步骤 1: 使用 sql_db_table_relationship("Customer, Invoice, InvoiceLine")
响应:
表之间的关系如下:
• Invoice.CustomerId = Customer.Id
• InvoiceLine.InvoiceId = Invoice.Id
✅ 表关系已获取完成。
步骤 1: sql_db_list_tables → 智能过滤出 orders, products, customers
步骤 2: sql_db_schema("orders, products, customers") → 获取完整 schema
步骤 3: sql_db_table_relationship("orders, products, customers") → 获取关系
步骤 4: 组织为 M-Schema 格式:
【DB_ID】 sales_db
【Schema】
# Table: orders, 订单表
[
(id:INTEGER, 订单ID),
(customer_id:INTEGER, 客户ID),
(product_id:INTEGER, 产品ID),
(amount:DECIMAL, 订单金额),
(order_date:DATETIME, 下单时间),
]
orders.customer_id = customers.id
orders.product_id = products.id
# Table: products, 产品表
[
(id:INTEGER, 产品ID),
(name:VARCHAR, 产品名称),
(category:VARCHAR, 产品类别),
(price:DECIMAL, 单价),
]
# Table: customers, 客户表
[
(id:INTEGER, 客户ID),
(name:VARCHAR, 客户名称),
(region:VARCHAR, 所属区域),
]
对于"列出表"问题:
对于"描述表"问题:
对于"如何查询 X"问题:
对于复杂查询准备:
"哪个表包含客户信息?" → 使用 list_tables,然后描述 Customer 表
"Invoice 表中有什么?" → 使用 schema 工具显示列和示例数据
"客户如何与发票关联?"
→ 使用 sql_db_table_relationship("Customer, Invoice, InvoiceLine") 获取关系
"我要分析各产品销售情况" → 智能过滤 → 获取 schema → 获取关系 → 输出 M-Schema