Data Lineage Architecture Lens
Cognitive Mode: Data-Centric
Primary Question: "Where is the data?"
Focus: Information Flow, Transformations, Storage Locations, Format Conversions
When to Use
- Need to understand how data flows through the system
- Documenting data transformations and conversions
- Identifying storage destinations and access patterns
- User invokes
/autoskillit:arch-lens-data-lineage or /autoskillit:make-arch-diag data
Critical Constraints
NEVER:
- Modify any source code files
- Focus on runtime behavior (that's process flow lens)
- Show static structure without data context
- Run subagents in the background (
run_in_background: true is prohibited)
ALWAYS:
Arguments
/autoskillit:arch-lens-data-lineage [context_path]
- context_path (optional) — Absolute path to a PR context file containing new files
(★-prefixed) and modified files (●-prefixed) from the PR diff. When provided, read
this file before beginning analysis and focus the diagram on the architectural areas
affected by these specific files. When absent, explore the full CWD.
Analysis Workflow
Step 0: Read PR context (when provided)
If a context_path positional argument is present:
- Read the file at
context_path
- Extract: new files list (★-prefixed), modified files list (●-prefixed)
- Focus Step 1 exploration on the modules/components these files belong to
- Apply ★ prefix on diagram nodes representing new files/components
- Apply ● prefix on diagram nodes representing modified files/components
If no context_path is provided, skip this step and explore the full CWD in Step 1.
Step 1: Launch Parallel Exploration Subagents
Spawn Explore subagents to investigate:
Data Origins (Inputs)
- Find user input handling
- Identify external data sources
- Look for: CLI args, API requests, file reads, imports, user input, data ingestion
Transformation Stages
- Find data conversion/transformation code
- Identify adapters and converters
- Look for: Adapter, Converter, transform, parse, serialize, from_*, to_*, mapping, conversion
Format Changes
- Find schema definitions and conversions
- Identify format boundaries (JSON, XML, protobuf, etc.)
- Look for: schema models, type definitions, serialization, deserialization, format conversion
Storage Destinations
- Find database operations
- Identify file outputs
- Look for: database operations, persistence, .save(), .create(), .write(), storage
Access Patterns
- Find data retrieval code
- Identify query patterns
- Look for: .get(), .query(), .find(), .load(), read operations, data access layer
Step 2: Map Data Flow
Document the journey of key data entities:
- Origin: Where does it come from?
- Transformations: What changes happen?
- Storage: Where is it persisted?
- Retrieval: How is it accessed later?
CRITICAL - Analyze Read/Write Direction:
For EVERY storage location and data flow:
- Read sources (inputs): Components that READ from this location
- Write destinations (outputs): Components that WRITE to this location
- Read-write (primary storage): Both read and written by the system
- Write-only (artifacts): Written but NEVER read back by the system
Clearly distinguish:
- Primary storage (source of truth) - system reads AND writes
- Write-only artifacts (debugging, logging) - system writes but never reads back
- External inputs - system reads only
Use different arrow styles:
- Solid arrows for read/write primary storage
- Dashed arrows for write-only artifacts
Step 3: Identify Conversion Boundaries
Find format changes:
- External format -> Internal format
- Internal format -> Database format
- Database format -> API response
- Note naming convention changes
Step 4: Create the Diagram
Use flowchart with:
Direction: LR (left-to-right) for data flow, or TB for hierarchical
Subgraphs for Stages:
- Input/Origins
- Transformation/Processing
- Storage (primary)
- Artifacts (secondary/write-only)
- External Sync (if applicable)
Node Styling:
cli class: Data origins, user input
handler class: Transformation, adapters
stateNode class: Database tables, primary storage
output class: Write-only artifacts, files
integration class: External sync, APIs
Connection Types:
- Solid arrows for primary data flow
- Dashed arrows for write-only/secondary
- Label with operation names
Database Nodes:
- Use cylinder shape:
[(Label)]
- Show table relationships
Step 5: Write Output
Write the diagram to: {{AUTOSKILLIT_TEMP}}/arch-lens-data-lineage/arch_diag_data_lineage_{YYYY-MM-DD_HHMMSS}.md (relative to the current working directory)
After writing the diagram file, emit a structured output line:
IMPORTANT: Emit the structured output tokens as literal plain text with no
markdown formatting on the token names. Do not wrap token names in **bold**,
*italic*, or any other markdown. The adjudicator performs a regex match on the
exact token name — decorators cause match failure.
diagram_path = {absolute_path_to_diagram_file}
Output Template
# Data Lineage Diagram: {System Name}
**Lens:** Data Lineage (Data-Centric)
**Question:** Where is the data?
**Date:** {YYYY-MM-DD}
**Scope:** {What was analyzed}
## Data Flow Overview
| Stage | Format | Key Transformation |
|-------|--------|-------------------|
| Input | {format} | {description} |
| Processing | {format} | {description} |
| Storage | {format} | {description} |
## Lineage Diagram
```mermaid
%%{init: {'flowchart': {'nodeSpacing': 50, 'rankSpacing': 60, 'curve': 'basis'}}}%%
flowchart LR
%% CLASS DEFINITIONS %%
classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef integration fill:#c62828,stroke:#ef9a9a,stroke-width:2px,color:#fff;
subgraph Input ["Data Origins"]
USER["User Input<br/>━━━━━━━━━━<br/>Source type<br/>Format"]
end
subgraph Transform ["Transformation"]
direction TB
ADAPTER["Adapter<br/>━━━━━━━━━━<br/>Conversion type"]
end
subgraph Storage ["Primary Storage (Source of Truth)"]
direction TB
DB[("Database Table<br/>━━━━━━━━━━<br/>Key fields")]
end
subgraph Artifacts ["Write-Only Artifacts"]
direction TB
FILE["output.json<br/>━━━━━━━━━━<br/>For debugging"]
end
%% FLOWS %%
USER -->|"input"| ADAPTER
ADAPTER -->|"save()"| DB
DB -.->|"write-only"| FILE
%% CLASS ASSIGNMENTS %%
class USER cli;
class ADAPTER handler;
class DB stateNode;
class FILE output;
Color Legend:
| Color |
Category |
Description |
| Dark Blue |
Input |
Data origins (user, external) |
| Orange |
Transform |
Format conversion and adapters |
| Teal |
Storage |
Primary storage (source of truth) |
| Dark Teal |
Artifacts |
Write-only outputs |
| Red |
Sync |
External sync services |
Data Transformation Summary
| Stage |
Format |
Key Conversion |
| {stage} |
{format} |
{conversion} |
Storage Destinations
| Entity |
Primary Storage |
Secondary |
Access Pattern |
| {entity} |
{location} |
{artifact} |
{how accessed} |
Critical Design Principle
Source of Truth: {e.g., "Database is single source of truth. File outputs are write-only."}
---
## Pre-Diagram Checklist
Before creating the diagram, verify:
- [ ] LOADED `/autoskillit:mermaid` skill using the Skill tool
- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)
- [ ] Diagram will include a color legend table
---
## Related Skills
- `/autoskillit:make-arch-diag` - Parent skill for lens selection
- `/autoskillit:mermaid` - MUST BE LOADED before creating diagram
- `/autoskillit:arch-lens-c4-container` - For container-level storage view
1---2name: arch-lens-data-lineage3description: Create Data Lineage architecture diagram showing information flow, transformations, and storage destinations. Data-centric lens answering "Where is the data?"4---56# Data Lineage Architecture Lens78**Cognitive Mode:** Data-Centric9**Primary Question:** "Where is the data?"10**Focus:** Information Flow, Transformations, Storage Locations, Format Conversions1112## When to Use1314- Need to understand how data flows through the system15- Documenting data transformations and conversions16- Identifying storage destinations and access patterns17- User invokes `/autoskillit:arch-lens-data-lineage` or `/autoskillit:make-arch-diag data`1819## Critical Constraints2021**NEVER:**22- Modify any source code files23- Focus on runtime behavior (that's process flow lens)24- Show static structure without data context25- Run subagents in the background (`run_in_background: true` is prohibited)2627**ALWAYS:**28- Trace data from INPUT to STORAGE29- Show transformation stages and format changes30- Identify the single source of truth31- Distinguish read vs write operations32- BEFORE creating any diagram, LOAD the `/autoskillit:mermaid` skill using the Skill tool - this is MANDATORY33- If the Skill tool cannot be used (disable-model-invocation) or refuses this invocation, do NOT proceed with diagram creation. Abort this step and omit the diagram from output.34- After writing the diagram file, emit the **absolute path** as a structured output35 token as your final output. Resolve the relative `temp/arch-lens-data-lineage/...`36 save path to absolute by prepending the full CWD:37 ```38 diagram_path = /absolute/cwd/temp/arch-lens-data-lineage/{filename}.md39 ```40 This token is MANDATORY — the pipeline cannot proceed without it.4142## Arguments4344`/autoskillit:arch-lens-data-lineage [context_path]`4546- **context_path** (optional) — Absolute path to a PR context file containing new files47 (★-prefixed) and modified files (●-prefixed) from the PR diff. When provided, read48 this file before beginning analysis and focus the diagram on the architectural areas49 affected by these specific files. When absent, explore the full CWD.5051---5253## Analysis Workflow5455### Step 0: Read PR context (when provided)5657If a `context_path` positional argument is present:581. Read the file at `context_path`592. Extract: new files list (★-prefixed), modified files list (●-prefixed)603. Focus Step 1 exploration on the modules/components these files belong to614. Apply ★ prefix on diagram nodes representing new files/components625. Apply ● prefix on diagram nodes representing modified files/components6364If no `context_path` is provided, skip this step and explore the full CWD in Step 1.6566### Step 1: Launch Parallel Exploration Subagents6768Spawn Explore subagents to investigate:6970**Data Origins (Inputs)**71- Find user input handling72- Identify external data sources73- Look for: CLI args, API requests, file reads, imports, user input, data ingestion7475**Transformation Stages**76- Find data conversion/transformation code77- Identify adapters and converters78- Look for: Adapter, Converter, transform, parse, serialize, from_*, to_*, mapping, conversion7980**Format Changes**81- Find schema definitions and conversions82- Identify format boundaries (JSON, XML, protobuf, etc.)83- Look for: schema models, type definitions, serialization, deserialization, format conversion8485**Storage Destinations**86- Find database operations87- Identify file outputs88- Look for: database operations, persistence, .save(), .create(), .write(), storage8990**Access Patterns**91- Find data retrieval code92- Identify query patterns93- Look for: .get(), .query(), .find(), .load(), read operations, data access layer9495### Step 2: Map Data Flow9697Document the journey of key data entities:98- **Origin**: Where does it come from?99- **Transformations**: What changes happen?100- **Storage**: Where is it persisted?101- **Retrieval**: How is it accessed later?102103**CRITICAL - Analyze Read/Write Direction:**104For EVERY storage location and data flow:105- **Read sources (inputs)**: Components that READ from this location106- **Write destinations (outputs)**: Components that WRITE to this location107- **Read-write (primary storage)**: Both read and written by the system108- **Write-only (artifacts)**: Written but NEVER read back by the system109110Clearly distinguish:111- Primary storage (source of truth) - system reads AND writes112- Write-only artifacts (debugging, logging) - system writes but never reads back113- External inputs - system reads only114115Use different arrow styles:116- Solid arrows for read/write primary storage117- Dashed arrows for write-only artifacts118119### Step 3: Identify Conversion Boundaries120121Find format changes:122- External format -> Internal format123- Internal format -> Database format124- Database format -> API response125- Note naming convention changes126127### Step 4: Create the Diagram128129Use flowchart with:130131**Direction:** `LR` (left-to-right) for data flow, or `TB` for hierarchical132133**Subgraphs for Stages:**134- Input/Origins135- Transformation/Processing136- Storage (primary)137- Artifacts (secondary/write-only)138- External Sync (if applicable)139140**Node Styling:**141- `cli` class: Data origins, user input142- `handler` class: Transformation, adapters143- `stateNode` class: Database tables, primary storage144- `output` class: Write-only artifacts, files145- `integration` class: External sync, APIs146147**Connection Types:**148- Solid arrows for primary data flow149- Dashed arrows for write-only/secondary150- Label with operation names151152**Database Nodes:**153- Use cylinder shape: `[(Label)]`154- Show table relationships155156### Step 5: Write Output157158Write the diagram to: `{{AUTOSKILLIT_TEMP}}/arch-lens-data-lineage/arch_diag_data_lineage_{YYYY-MM-DD_HHMMSS}.md` (relative to the current working directory)159160After writing the diagram file, emit a structured output line:161162> **IMPORTANT:** Emit the structured output tokens as **literal plain text with no163> markdown formatting on the token names**. Do not wrap token names in `**bold**`,164> `*italic*`, or any other markdown. The adjudicator performs a regex match on the165> exact token name — decorators cause match failure.166167```168diagram_path = {absolute_path_to_diagram_file}169```170171---172173## Output Template174175```markdown176# Data Lineage Diagram: {System Name}177178**Lens:** Data Lineage (Data-Centric)179**Question:** Where is the data?180**Date:** {YYYY-MM-DD}181**Scope:** {What was analyzed}182183## Data Flow Overview184185| Stage | Format | Key Transformation |186|-------|--------|-------------------|187| Input | {format} | {description} |188| Processing | {format} | {description} |189| Storage | {format} | {description} |190191## Lineage Diagram192193```mermaid194%%{init: {'flowchart': {'nodeSpacing': 50, 'rankSpacing': 60, 'curve': 'basis'}}}%%195flowchart LR196 %% CLASS DEFINITIONS %%197 classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;198 classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;199 classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;200 classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;201 classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;202 classDef integration fill:#c62828,stroke:#ef9a9a,stroke-width:2px,color:#fff;203204 subgraph Input ["Data Origins"]205 USER["User Input<br/>━━━━━━━━━━<br/>Source type<br/>Format"]206 end207208 subgraph Transform ["Transformation"]209 direction TB210 ADAPTER["Adapter<br/>━━━━━━━━━━<br/>Conversion type"]211 end212213 subgraph Storage ["Primary Storage (Source of Truth)"]214 direction TB215 DB[("Database Table<br/>━━━━━━━━━━<br/>Key fields")]216 end217218 subgraph Artifacts ["Write-Only Artifacts"]219 direction TB220 FILE["output.json<br/>━━━━━━━━━━<br/>For debugging"]221 end222223 %% FLOWS %%224 USER -->|"input"| ADAPTER225 ADAPTER -->|"save()"| DB226 DB -.->|"write-only"| FILE227228 %% CLASS ASSIGNMENTS %%229 class USER cli;230 class ADAPTER handler;231 class DB stateNode;232 class FILE output;233```234235**Color Legend:**236| Color | Category | Description |237|-------|----------|-------------|238| Dark Blue | Input | Data origins (user, external) |239| Orange | Transform | Format conversion and adapters |240| Teal | Storage | Primary storage (source of truth) |241| Dark Teal | Artifacts | Write-only outputs |242| Red | Sync | External sync services |243244## Data Transformation Summary245246| Stage | Format | Key Conversion |247|-------|--------|----------------|248| {stage} | {format} | {conversion} |249250## Storage Destinations251252| Entity | Primary Storage | Secondary | Access Pattern |253|--------|-----------------|-----------|----------------|254| {entity} | {location} | {artifact} | {how accessed} |255256## Critical Design Principle257258> **Source of Truth**: {e.g., "Database is single source of truth. File outputs are write-only."}259```260261---262263## Pre-Diagram Checklist264265Before creating the diagram, verify:266267- [ ] LOADED `/autoskillit:mermaid` skill using the Skill tool268- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)269- [ ] Diagram will include a color legend table270271---272273## Related Skills274275- `/autoskillit:make-arch-diag` - Parent skill for lens selection276- `/autoskillit:mermaid` - MUST BE LOADED before creating diagram277- `/autoskillit:arch-lens-c4-container` - For container-level storage view