warehouse-init
Initialize warehouse schema discovery. Generates .astro/warehouse.md with all table metadata for instant lookups. Run once per project, refresh when schema changes. Use when user says "/astronomer-data:warehouse-init" or asks to set up data discovery.
By astronomer · 752 installs
npx skills add astronomer/agents --skill warehouse-init
Source repository · Upstream listing
Initialize Warehouse Schema
Generate a comprehensive, user editable schema reference file for the data warehouse.
Scripts: ../analyzing data/scripts/ — All CLI commands below are relative to the analyzing data skill's directory. Before running any scripts/cli.py command, cd to ../analyzing data/ relative to this file.
What This Does
1. Discovers all databases, schemas, tables, and columns from the warehouse
2. Enriches with codebase context (dbt models, gusty SQL, schema docs)
3. Records row counts and identifies large tables
4. Generates .astro/warehouse.md a version controllable, team shareable reference
5. Enables instant concept→table lookups without warehouse queries
Process
Step 1: Read Warehouse Configuration
Get the list of databases to discover (e.g., databases: [HQ, ANALYTICS, RAW] ).
Step 2: Search Codebase for Context (Parallel)
Launch a subagent to find business context in code:
Step 3: Parallel Warehouse Discovery
Launch one subagent per database using the Task tool:
Run all subagents in parallel (single message with multiple Task calls).
Step 4: Discover Categorical Value Families
For key categorical columns (like OPERATOR, STATUS, TYPE, FEATURE), discover value families:
Group related values into families by common prefix/suffix (e.g., Export for ExportCSV, ExportJSON, ExportParquet).
Step 5: Merge Results
Combine warehouse metadata + codebase context:
1. Quick Reference table concept → table mappings (pre populated from code if found)
2. Categorical Columns value families for key filter columns
3. Database sections one per database
4. Schema subsections tables grouped by schema
5. Table details columns, row counts, descriptions from code , warnings
Step 6: Generate warehouse.md
Write the file to:
.astro/warehouse.md (default project specific, version controllable)
~/.astro/agents/warehouse.md (if global flag)
Output Format
{Inferred relationships based on column names like ID}
Command Options
Option Effect
/astronomer data:warehouse init Generate .astro/warehouse.md
/astronomer data:warehouse init refresh Regenerate, preserving user edits
/astronomer data:warehouse init database HQ Only discover specific database
/astronomer data:warehouse init global Write to ~/.astro/agents/ instead
Step 7: Pre populate Cache
After generating warehouse.md, populate the concept cache:
Step 8: Offer CLAUDE.md Integration (Ask User)
Ask the user:
Would you like to add the Quick Reference table to your CLAUDE.md file?
This ensures the schema mappings are always in context for data queries, improving accuracy from ~25% to ~100% for complex queries.
Options:
1. Yes, add to CLAUDE.md (Recommended) Append Quick Reference section
2. No, skip Use warehouse.md and cache only
If user chooses Yes:
1. Check if .claude/CLAUDE.md or CLAUDE.md exists
2. If exists, append the Quick Reference section (avoid duplicates)
3. If not exists, create .claude/CLAUDE.md with just the Quick Reference
Quick Reference section to add:
If yes: Append the Quick Reference section to .claude/CLAUDE.md or CLAUDE.md .
After Generation
Tell the user:
Refresh Behavior
When refresh is specified:
1. Read existing warehouse.md
2. Preserve all HTML comments ( <! ... )
3. Preserve Quick Reference table entries (user added)
4. Preserve user added descriptions
5. Update row counts and add new tables
6. Mark removed tables with <! REMOVED comment
Cache Staleness & Schema Drift
The runtime cache has a 7 day TTL by default. After 7 days, cached entries expire and will be re discovered on next use.
When to Refresh
Run /astronomer data:warehouse init refresh when:
Schema changes : Tables added, renamed, or removed
Column changes : New columns added or types changed
After deployments : If your data pipeline deploys schema migrations
Weekly : As a good practice, even if no known changes
Signs of Stale Cache
Watch for these indicators:
Queries fail with "table not found" errors
Results seem wrong or outdated
New tables aren't being discovered
Manual Cache Reset
If you suspect cache issues:
Codebase Patterns Recognized
Pattern Source What We Extract
/models/ / .yml dbt table/column descriptions, tests
/dags/ / .sql gusty YAML frontmatter (description, primary key)
AGENTS.md , CLAUDE.md docs data layer hierarchy, conventions
/docs/ / .md docs business context
Example Session