
Schema Exploration
Map an unfamiliar SQL database—tables, columns, types, and foreign keys—before writing queries or agent SQL tools.
Overview
Schema Exploration is an agent skill for the Build phase that lists SQL tables, describes columns and types, and maps foreign-key relationships using sql_db_list_tables and sql_db_schema.
Install
npx skills add https://github.com/langchain-ai/deepagents --skill schema-explorationWhat is this skill?
- 4-step workflow: list tables → inspect schema → map relationships → answer in plain language
- Uses sql_db_list_tables and sql_db_schema for columns, types, sample rows, PKs, and FKs
- Heuristic for relationships via *Id columns and parent-child links
- Oriented to Chinook-style demo DBs with concrete example responses
- Pairs with Deep Agents SQL tooling rather than raw CLI-only exploration
- 4-step exploration workflow
Adoption & trust: 673 installs on skills.sh; 24.2k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need to query or automate against a database but do not know which tables exist, what columns mean, or how rows link together.
Who is it for?
Agents with SQL tools attached who must answer schema, ERD, or “what tables exist?” questions before writing queries.
Skip if: Teams that need automated schema migrations, visual ERD exports, or production DDL change management without an attached SQL tool.
When should I use this skill?
User asks about database schema, table structure, column types, what tables exist, ERD, foreign keys, or how entities relate.
What do I get? / Deliverables
You get a clear inventory of tables, field semantics, sample rows, and relationship hints so follow-up SQL or agent queries stay accurate.
- Table list with stated purpose
- Column and type breakdown with sample rows
- Relationship map between entities
Recommended Skills
Journey fit
Schema discovery belongs in Build because solo builders need a grounded data model before backend queries, migrations, or agent database tooling. Backend is the canonical shelf for relational structure work that feeds APIs, ORMs, and sql_db_* agent tools.
How it compares
Use this procedural exploration workflow instead of guessing schema from chat memory or running ad-hoc DESCRIBE without a documented map.
Common Questions / FAQ
Who is schema-exploration for?
Solo builders and agents using Deep Agents (or similar) SQL list/schema tools who need fast, accurate database orientation before querying.
When should I use schema-exploration?
Use it during Build backend work when users ask about table structure, column types, foreign keys, or how entities relate; also in Operate when debugging data issues against an unfamiliar store.
Is schema-exploration safe to install?
It is documentation for read-oriented schema inspection; review the Security Audits panel on this page and ensure your agent’s SQL tools are scoped to appropriate databases and credentials.
SKILL.md
READMESKILL.md - Schema Exploration
# Schema Exploration Skill ## Workflow ### 1. List All Tables Use `sql_db_list_tables` tool to see all available tables in the database. This returns the complete list of tables you can query. ### 2. Get Schema for Specific Tables Use `sql_db_schema` tool with table names to examine: - **Column names** - What fields are available - **Data types** - INTEGER, TEXT, DATETIME, etc. - **Sample data** - 3 example rows to understand content - **Primary keys** - Unique identifiers for rows - **Foreign keys** - Relationships to other tables ### 3. Map Relationships Identify how tables connect: - Look for columns ending in "Id" (e.g., CustomerId, ArtistId) - Foreign keys link to primary keys in other tables - Document parent-child relationships ### 4. Answer the Question Provide clear information about: - Available tables and their purpose - Column names and what they contain - How tables relate to each other - Sample data to illustrate content ## Example: "What tables are available?" **Step 1:** Use `sql_db_list_tables` **Response:** ``` The Chinook database has 11 tables: 1. Artist - Music artists 2. Album - Music albums 3. Track - Individual songs 4. Genre - Music genres 5. MediaType - File formats (MP3, AAC, etc.) 6. Playlist - User-created playlists 7. PlaylistTrack - Tracks in playlists 8. Customer - Store customers 9. Employee - Store employees 10. Invoice - Customer purchases 11. InvoiceLine - Individual items in invoices ``` ## Example: "What columns does the Customer table have?" **Step 1:** Use `sql_db_schema` with table name "Customer" **Response:** ``` The Customer table has these columns: - CustomerId (INTEGER) - Primary key, unique customer ID - FirstName (NVARCHAR) - Customer's first name - LastName (NVARCHAR) - Customer's last name - Company (NVARCHAR) - Company name (optional) - Address, City, State, Country, PostalCode - Location fields - Phone (NVARCHAR) - Phone number - Fax (NVARCHAR) - Fax number - Email (NVARCHAR) - Email address - SupportRepId (INTEGER) - Foreign key to Employee table Sample data shows customers like: - Luís Gonçalves from Brazil - Leonie Köhler from Germany - François Tremblay from Canada ``` ## Example: "How do I find revenue by artist?" **Step 1:** Identify tables needed - Artist (has artist names) - Album (links artists to tracks) - Track (links albums to sales) - InvoiceLine (has sales data) - Invoice (has revenue totals) **Step 2:** Map relationships ``` Artist (ArtistId) ↓ 1:many Album (ArtistId, AlbumId) ↓ 1:many Track (AlbumId, TrackId) ↓ 1:many InvoiceLine (TrackId, UnitPrice, Quantity) ``` **Response:** ``` To find revenue by artist, you'll need to: 1. Start with the Artist table 2. JOIN to Album on ArtistId 3. JOIN to Track on AlbumId 4. JOIN to InvoiceLine on TrackId 5. SUM the revenue (UnitPrice * Quantity) 6. GROUP BY artist name This requires the query-writing skill to execute. ``` ## Quality Guidelines **For "list tables" questions:** - Show all table names - Add brief descriptions of what each contains - Group related tables (e.g., music catalog, transactions, people) **For "describe table" questions:** - List all columns with data types - Explain what each column contains - Show sample data for context - Note primary and foreign keys - Explain relationships to other tables **For "how do I query X" questions:** - Identify required tables - Map the JOIN path - Explain the relationship chain - Suggest next steps (use query-writing skill)