tracing-upstream-lineage — скилл для Claude Code: откуда приходят
Скилл для агента, который отвечает на вопрос «откуда взялись эти данные»: ищет DAG, читает исходники и строит цепочку до внешних систем.
npx skills add astronomer/agents --skill tracing-upstream-lineage -a claude-codeЧто делает tracing-upstream-lineage
Скилл разбирает происхождение данных по шагам. Сначала определяет, что именно трассируем: таблицу, колонку или DAG. Потом ищет DAG, который наполняет таблицу, через af dags list, читает его код командой af dags source <dag_id> и смотрит задачи через af tasks list <dag_id>. Дальше по FROM-клаузам и операторам вроде S3Operator, PostgresOperator, SalesforceOperator находит источники и рекурсивно идёт вверх по цепочке.
На выходе — отчёт: однострочный ответ, схема потока данных, таблица источников с типом подключения и свежестью, описание преобразований и список рисков вроде единственной точки отказа. Для колонок скилл отдельно ищет прямые маппинги, COALESCE и агрегаты.
Работает это на Airflow. На Astro есть вкладка Lineage в интерфейсе, и скилл советует смотреть туда вместо ручного поиска по коду. В OSS Airflow такой панели нет, поэтому трассировка идёт по исходникам DAG и логам задач. Свежесть источников скилл передаёт в скилл checking-freshness, отладку DAG — в debugging-dags.
Какие задачи решает
- найти DAG, который наполняет конкретную таблицу
- проследить, откуда приходит отдельная колонка после преобразований
- собрать цепочку от витрины до внешнего API или базы
- отметить устаревшие источники и точки отказа в пайплайне
- понять, какие DAG читают данные из S3 или Salesforce
Примеры запросов агенту
- Откуда берутся данные в таблице analytics.orders_daily?
- Проследи происхождение колонки total_amount в fct.orders
- Какие источники питают DAG etl_daily_orders?
Как установить tracing-upstream-lineage
1Через Skills CLI (Vercel)
npx skills add astronomer/agents --skill tracing-upstream-lineage -a claude-code2Вручную: положить файлы
~/.claude/skills/tracing-upstream-lineage/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/tracing-upstream-lineage/
1Через Skills CLI (Vercel)
npx skills add astronomer/agents --skill tracing-upstream-lineage -a codex2Вручную: положить файлы
.agents/skills/tracing-upstream-lineage/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add astronomer/agents --skill tracing-upstream-lineage -a cursor2Вручную: положить файлы
.cursor/skills/tracing-upstream-lineage/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install astronomer/agents tracing-upstream-lineage2Вручную: положить файлы
.github/skills/tracing-upstream-lineage/SKILL.md1Через Skills CLI (Vercel)
npx skills add astronomer/agents --skill tracing-upstream-lineage -a gemini-cli2Командой платформы
gemini skills install https://github.com/astronomer/agents --path skills/tracing-upstream-lineageВручную: положить файлы
.devin/skills/tracing-upstream-lineage/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add astronomer/agents --skill tracing-upstream-lineage -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора23
Похожие
Рядом в теме «Данные и базы»
Все скиллы по теме «Данные и базы» →Вопросы о tracing-upstream-lineage
Как установить tracing-upstream-lineage в Claude?
Одной командой: npx skills add astronomer/agents --skill tracing-upstream-lineage -a claude-code. После этого файл скилла лежит в ~/.claude/skills/tracing-upstream-lineage/SKILL.md.
Что делает tracing-upstream-lineage?
Трассирует происхождение данных вверх по пайплайну: находит DAG-производитель, читает его исходники, определяет источники и строит цепочку до внешних систем. Завершается отчётом со схемой, таблицей источников и преобразованиями.
С какими инструментами работает скилл?
С Airflow: команды af dags list, af dags source <dag_id>, af tasks list <dag_id>, af dags stats. На Astro он опирается на вкладку Lineage, в OSS Airflow трассировка идёт по коду DAG и логам задач.
Исходный текст
SKILL.md · Apache-2.0
---
name: tracing-upstream-lineage
description: Trace upstream data lineage. Use when the user asks where data comes from, what feeds a table, upstream dependencies, data sources, or needs to understand data origins.
---
# Upstream Lineage: Sources
Trace the origins of data - answer "Where does this data come from?"
## Lineage Investigation
### Step 1: Identify the Target Type
Determine what we're tracing:
- **Table**: Trace what populates this table
- **Column**: Trace where this specific column comes from
- **DAG**: Trace what data sources this DAG reads from
### Step 2: Find the Producing DAG
Tables are typically populated by Airflow DAGs. Find the connection:
1. **Search DAGs by name**: Use `af dags list` and look for DAG names matching the table name
- `load_customers` -> `customers` table
- `etl_daily_orders` -> `orders` table
2. **Explore DAG source code**: Use `af dags source <dag_id>` to read the DAG definition
- Look for INSERT, MERGE, CREATE TABLE statements
- Find the target table in the code
3. **Check DAG tasks**: Use `af tasks list <dag_id>` to see what operations the DAG performs
### On Astro
If you're running on Astro, the **Lineage tab** in the Astro UI provides visual lineage exploration across DAGs and datasets. Use it to quickly trace upstream dependencies without manually searching DAG source code.
### On OSS Airflow
Use DAG source code and task logs to trace lineage (no built-in cross-DAG UI).
### Step 3: Trace Data Sources
From the DAG code, identify source tables and systems:
**SQL Sources** (look for FROM clauses):
```python
# In DAG code:
SELECT * FROM source_schema.source_table # <- This is an upstream source
```
**External Sources** (look for connection references):
- `S3Operator` -> S3 bucket source
- `PostgresOperator` -> Postgres database source
- `SalesforceOperator` -> Salesforce API source
- `HttpOperator` -> REST API source
**File Sources**:
- CSV/Parquet files in object storage
- SFTP drops
- Local file paths
### Step 4: Build the Lineage Chain
Recursively trace each source:
```
TARGET: analytics.orders_daily
^
+-- DAG: etl_daily_orders
^
+-- SOURCE: raw.orders (table)
| ^
| +-- DAG: ingest_orders
| ^
| +-- SOURCE: Salesforce API (external)
|
+-- SOURCE: dim.customers (table)
^
+-- DAG: load_customers
^
+-- SOURCE: PostgreSQL (external DB)
```
### Step 5: Check Source Health
For each upstream source:
- **Tables**: Check freshness with the **checking-freshness** skill
- **DAGs**: Check recent run status with `af dags stats`
- **External systems**: Note connection info from DAG code
## Lineage for Columns
When tracing a specific column:
1. Find the column in the target table schema
2. Search DAG source code for references to that column name
3. Trace through transformations:
- Direct mappings: `source.col AS target_col`
- Transformations: `COALESCE(a.col, b.col) AS target_col`
- Aggregations: `SUM(detail.amount) AS total_amount`
## Output: Lineage Report
### Summary
One-line answer: "This table is populated by DAG X from sources Y and Z"
### Lineage Diagram
```
[Salesforce] --> [raw.opportunities] --> [stg.opportunities] --> [fct.sales]
| |
DAG: ingest_sfdc DAG: transform_sales
```
### Source Details
| Source | Type | Connection | Freshness | Owner |
|--------|------|------------|-----------|-------|
| raw.orders | Table | Internal | 2h ago | data-team |
| Salesforce | API | salesforce_conn | Real-time | sales-ops |
### Transformation Chain
Describe how data flows and transforms:
1. Raw data lands in `raw.orders` via Salesforce API sync
2. DAG `transform_orders` cleans and dedupes into `stg.orders`
3. DAG `build_order_facts` joins with dimensions into `fct.orders`
### Data Quality Implications
- Single points of failure?
- Stale upstream sources?
- Complex transformation chains that could break?
### Related Skills
- Check source freshness: **checking-freshness** skill
- Debug source DAG: **debugging-dags** skill
- Trace downstream impacts: **tracing-downstream-lineage** skill
- Add manual lineage annotations: **annotating-task-lineage** skill
- Build custom lineage extractors: **creating-openlineage-extractors** skill
© astronomer · Apache-2.0 · astronomer/agents