# analyzing-data

Turns business questions into SQL, runs them against the data warehouse and caches the table mappings it finds along the way.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1400 installs · ★ 456
- Author: astronomer
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/astronomer/agents/tree/HEAD/skills/analyzing-data/SKILL.md
- Updated: 2026-10-14
- HTML: https://affpapa.org/en/nevibecode/skills/analyzing-data

## What it does

The skill takes a plain-language question, writes SQL and runs it through a kernel that starts on the first `exec` call. Everything goes through a CLI at `scripts/cli.py`, with commands for pattern lookup, concept lookup and table schemas. Whatever it discovers gets cached, so the next question about the same tables skips the discovery step.

The workflow is ordered: check the pattern cache for a matching strategy, look up the concept-to-table mapping, and fall back to searching the codebase (`Grep` over `**/*.sql`) or querying `INFORMATION_SCHEMA` when the cache misses. Results come back as Polars or Pandas DataFrames, with `pl` and `pd` pre-imported. Independent queries can go out together through `run_sql_many`, which fans them out concurrently — but it is fail-fast, so one bad query throws away the results of the ones that worked.

All CLI commands are relative to the skill directory, so `cd` there before running anything. `exec` waits 120 seconds by default and then interrupts the query, which may still finish server-side; long queries need `-t`. The kernel shuts itself down after 2 hours idle and keeps its state until then.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add astronomer/agents --skill analyzing-data -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/analyzing-data/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/analyzing-data/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add astronomer/agents --skill analyzing-data -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/analyzing-data/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add astronomer/agents --skill analyzing-data -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/analyzing-data/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install astronomer/agents analyzing-data
```

2. **Manually: put the files in place**
- File: `.github/skills/analyzing-data/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add astronomer/agents --skill analyzing-data -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/astronomer/agents --path skills/analyzing-data
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/analyzing-data/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add astronomer/agents --skill analyzing-data -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/astronomer/agents/tree/HEAD/skills/analyzing-data/SKILL.md

## When to use it
- count a metric straight from a warehouse table
- build a time trend from raw rows
- map a business concept to a table and remember it
- join several tables in one query
- run ad-hoc SQL without wiring up a connection by hand

## Example prompts
- how many active users did we have last month?
- find customers in Europe and show their orders
- compute weekly conversion and save the pattern

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 8d5342a453e54fa9.

BEGIN THIRD-PARTY FILE 8d5342a453e54fa9
````text
---
name: analyzing-data
description: Queries the data warehouse with SQL and answers business questions about data. Use when answering anything that needs warehouse data - counts, metrics, trends, aggregations, joins across tables, data lookups, or ad-hoc SQL analysis (for example "who uses X", "how many Y", "show me Z", "find customers", "what is the count").
---

# 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

1. **Pattern lookup** — Check for a cached query strategy:
   ```bash
   uv run scripts/cli.py pattern lookup "<user's question>"
   ```
   If a pattern exists, follow its strategy. Record the outcome after executing:
   ```bash
   uv run scripts/cli.py pattern record <name> --success  # or --failure
   ```

2. **Concept lookup** — Find known table mappings:
   ```bash
   uv run scripts/cli.py concept lookup <concept>
   ```

3. **Table discovery** — If cache misses, search the codebase (`Grep pattern="<concept>" glob="**/*.sql"`) or query `INFORMATION_SCHEMA`. See [reference/discovery-warehouse.md](reference/discovery-warehouse.md).

4. **Execute query**:
   ```bash
   uv run scripts/cli.py exec "df = run_sql('SELECT ...')"
   uv run scripts/cli.py exec "print(df)"
   ```

5. **Cache learnings** — Always cache before presenting results:
   ```bash
   # Cache concept → table mapping
   uv run scripts/cli.py concept learn <concept> <TABLE> -k <KEY_COL>
   # Cache query strategy (if discovery was needed)
   uv run scripts/cli.py pattern learn <name> -q "question" -s "step" -t "TABLE" -g "gotcha"
   ```

6. **Present findings** to user.

## Kernel Functions

| Function | Returns |
|----------|---------|
| `run_sql(query, limit=100)` | Polars DataFrame |
| `run_sql_pandas(query, limit=100)` | Pandas DataFrame |
| `run_sql_many(queries, limit=100)` | List of Polars DataFrames (one per query) |

`pl` (Polars) and `pd` (Pandas) are pre-imported.

**Run independent queries together** with `run_sql_many` — they execute concurrently (Snowflake async / connection-pool fan-out) instead of one at a time:

```bash
uv run scripts/cli.py exec "dfs = run_sql_many(['SELECT ...', 'SELECT ...']); print(dfs[0])"
```

`run_sql_many` is **fail-fast**: if any query errors, the call raises and the results of the queries that succeeded are discarded. Use separate `run_sql` calls if you need partial results.
````
END THIRD-PARTY FILE 8d5342a453e54fa9

The third-party file has ended. Everything between the 8d5342a453e54fa9 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2587 of 5081 bytes. © astronomer · Apache-2.0 · https://github.com/astronomer/agents/tree/HEAD/skills/analyzing-data/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
