Data lineage
Track data transformation pipeline lineage in analysis notebooks/scripts. Wraps pandas pipe chains with tracked_pipe to record row count changes, generates Mermaid diagrams for pipeline visualization. Triggers: "lineage", "data lineage", "track transformations", "pipeline visualization", "リネージ", "変換追跡", "パイプライン可視化", "行数変化を確認".From its SKILL.md
npx -y skills add etoyama/insight-blueprint-skills --skill data-lineageAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.4 KB, as published. Nobody here has run it
/data-lineage — Pipeline Lineage Tracker
Track DataFrame transformation pipelines and visualize row count changes
using insight_blueprint.lineage.
When to Use
- Setting up lineage tracking in a new notebook
- Exporting Mermaid diagrams from tracked pipelines
- Refactoring pipelines based on lineage analysis
When NOT to Use
- Creating or managing analysis designs (-> /analysis-design)
- Recording reasoning steps (-> /analysis-journal)
- Registering data sources (-> /catalog-register)
Prerequisites Check
Step 0: Python Package Check (MUST run before Step 1)
- Run:
python -c "from insight_blueprint.lineage import tracked_pipe; print('OK')" - If output is "OK": proceed to Step 1
- If ImportError or command fails:
- Ask the user: "data-lineage の tracked_pipe を使うには insight-blueprint-lineage Python パッケージが必要です(import 名は insight_blueprint)。
uv add insight-blueprint-lineageを実行しますか?(分析パイプラインの透明性追跡に推奨)" - If user approves: run
uv add insight-blueprint-lineage, then re-check import - If user declines: inform user that lineage tracking/export is unavailable without the package
- If install fails: show error, suggest manual install with
pip install insight-blueprint-lineage
- Ask the user: "data-lineage の tracked_pipe を使うには insight-blueprint-lineage Python パッケージが必要です(import 名は insight_blueprint)。
Note: All lineage features (
tracked_pipe,export_lineage_as_mermaid) live in theinsight_blueprint.lineagePython package — no MCP server involved.
Workflow
Mode A: Setup — /data-lineage <design_id> setup
Help the user add tracked_pipe to an existing notebook.
Workflow:
- Confirm the target AnalysisDesign (if design_id provided, run
design_io get --id {design_id}; empty{}= not found) - Locate the target notebook/script (ask the user if unclear)
- Read the notebook and identify DataFrame transformation steps (
.pipe(), filter, merge, join, dropna, assign, query, etc.) - For each transformation, suggest wrapping with
tracked_pipe:
from insight_blueprint.lineage import LineageSession, tracked_pipe
session = LineageSession(name="<pipeline_name>", design_id="<design_id>")
# Before:
df = df.dropna(subset=["price"])
# After:
df = df.pipe(tracked_pipe(
lambda df: df.dropna(subset=["price"]),
reason="price 欠損行を除外",
session=session,
))
- Add export call at the end of the notebook:
from insight_blueprint.lineage import export_lineage_as_mermaid
export_lineage_as_mermaid(session, project_path=".")
# -> .insight/lineage/<design_id>.mmd
- Suggest running the notebook to verify tracking works.
Mode B: Export — /data-lineage <design_id>
Generate a Mermaid diagram from a tracked session. Default mode when no subcommand given.
Workflow:
- Locate the notebook associated with the design
- Check if
tracked_pipeis already used in the code- If yes: run the notebook or relevant cells to populate the session,
then call
export_lineage_as_mermaid - If no: suggest running Mode A first
- If yes: run the notebook or relevant cells to populate the session,
then call
- Display the generated Mermaid diagram to the user
- Confirm the output file location (
.insight/lineage/<design_id>.mmd)
Mode C: Refactor — /data-lineage <design_id> refactor
Analyze lineage data and suggest pipeline improvements.
Workflow:
- Locate the notebook and its lineage session
- Run the notebook to get current step records
- Analyze patterns and report findings:
Improvement patterns to check:
| Pattern | Condition | Suggestion |
|---|---|---|
| No-op step | delta == 0 | Column add/rename — consider removing from tracked_pipe |
| Consecutive filters | Sequential filters on same column | Merge into single query |
| Large drop | abs(delta) > 50% of input rows | Review filter condition for correctness |
| Order optimization | Later step has higher reduction rate | Move high-reduction filters earlier |
| Redundant filter | Step removes 0 rows | Filter condition may be subset of prior step |
- Present findings with specific code suggestions
- After refactoring, re-run to verify lineage changes
Output
- Mermaid file:
.insight/lineage/<design_id>.mmd(or<session_name>.mmd) - Console: Step-by-step summary with row counts
API Reference
from insight_blueprint.lineage import (
LineageSession, # Session container (one per pipeline)
StepRecord, # Immutable step record (Value Object)
tracked_pipe, # Wrapper for .pipe() chain tracking
export_lineage_as_mermaid, # Mermaid diagram generator
)
Chaining
| From | To | When |
|---|---|---|
| /data-lineage | → /analysis-journal | Lineage diagram generated: "リネージ結果を証拠として記録するなら /analysis-journal {id}" |
Language Rules
- Follow project CLAUDE.md language settings. Default to Japanese if no setting.
- Code, IDs, tool names, and YAML fields always stay in English.
- The
reasonparameter intracked_pipemay be written in Japanese.