| name | analyzing-data |
| description | Queries data warehouse and answers business questions about data. Handles questions requiring database/warehouse queries including "who uses X", "how many Y", "show me Z", "find customers", "what is the count", data lookups, metrics, trends, or SQL analysis. |
Data Analysis
Answer business questions by querying the data warehouse. The kernel auto-starts on first exec call.
All CLI commands below are relative to this skill's directory. Before running any scripts/cli.py command, cd to the directory containing this file.
Workflow
-
Pattern lookup — Check for a cached query strategy:
uv run scripts/cli.py pattern lookup "<user's question>"
If a pattern exists, follow its strategy. Record the outcome after executing:
uv run scripts/cli.py pattern record <name> --success
-
Concept lookup — Find known table mappings:
uv run scripts/cli.py concept lookup <concept>
-
Table discovery — If cache misses, search the codebase (Grep pattern="<concept>" glob="**/*.sql") or query INFORMATION_SCHEMA. See reference/discovery-warehouse.md.
-
Execute query:
uv run scripts/cli.py exec "df = run_sql('SELECT ...')"
uv run scripts/cli.py exec "print(df)"
-
Cache learnings — Always cache before presenting results:
uv run scripts/cli.py concept learn <concept> <TABLE> -k <KEY_COL>
uv run scripts/cli.py pattern learn <name> -q "question" -s "step" -t "TABLE" -g "gotcha"
-
Present findings to user.
Kernel Functions
| Function | Returns |
|---|
run_sql(query, limit=100) | Polars DataFrame |
run_sql_pandas(query, limit=100) | Pandas DataFrame |
pl (Polars) and pd (Pandas) are pre-imported.
CLI Reference
Kernel
uv run scripts/cli.py warehouse list
uv run scripts/cli.py start [-w name]
uv run scripts/cli.py exec "..."
uv run scripts/cli.py status
uv run scripts/cli.py restart
uv run scripts/cli.py stop
uv run scripts/cli.py install <pkg>
Concept Cache
uv run scripts/cli.py concept lookup <name>
uv run scripts/cli.py concept learn <name> <TABLE> -k <KEY_COL>
uv run scripts/cli.py concept list
uv run scripts/cli.py concept import -p /path/to/warehouse.md
Pattern Cache
uv run scripts/cli.py pattern lookup "question"
uv run scripts/cli.py pattern learn <name> -q "..." -s "..." -t "TABLE" -g "gotcha"
uv run scripts/cli.py pattern record <name> --success
uv run scripts/cli.py pattern list
uv run scripts/cli.py pattern delete <name>
Table Schema Cache
uv run scripts/cli.py table lookup <TABLE>
uv run scripts/cli.py table cache <TABLE> -c '[...]'
uv run scripts/cli.py table list
uv run scripts/cli.py table delete <TABLE>
Cache Management
uv run scripts/cli.py cache status
uv run scripts/cli.py cache clear [--stale-only]
References