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
ALWAYS:
- Trace data from INPUT to STORAGE
- Show transformation stages and format changes
- Identify the single source of truth
- Distinguish read vs write operations
- BEFORE creating any diagram, LOAD the
/autoskillit:mermaid skill using the Skill tool - this is MANDATORY
Analysis Workflow
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: 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:
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---5
6# Data Lineage Architecture Lens
7
8**Cognitive Mode:** Data-Centric
9**Primary Question:** "Where is the data?"
10**Focus:** Information Flow, Transformations, Storage Locations, Format Conversions
11
12## When to Use
13
14- Need to understand how data flows through the system
15- Documenting data transformations and conversions
16- Identifying storage destinations and access patterns
17- User invokes `/autoskillit:arch-lens-data-lineage` or `/autoskillit:make-arch-diag data`
18
19## Critical Constraints
20
21**NEVER:**
22- Modify any source code files
23- Focus on runtime behavior (that's process flow lens)
24- Show static structure without data context
25
26**ALWAYS:**
27- Trace data from INPUT to STORAGE
28- Show transformation stages and format changes
29- Identify the single source of truth
30- Distinguish read vs write operations
31- BEFORE creating any diagram, LOAD the `/autoskillit:mermaid` skill using the Skill tool - this is MANDATORY
32
33---
34
35## Analysis Workflow
36
37### Step 1: Launch Parallel Exploration Subagents
38
39Spawn Explore subagents to investigate:
40
41**Data Origins (Inputs)**
42- Find user input handling
43- Identify external data sources
44- Look for: CLI args, API requests, file reads, imports, user input, data ingestion
45
46**Transformation Stages**
47- Find data conversion/transformation code
48- Identify adapters and converters
49- Look for: Adapter, Converter, transform, parse, serialize, from_*, to_*, mapping, conversion
50
51**Format Changes**
52- Find schema definitions and conversions
53- Identify format boundaries (JSON, XML, protobuf, etc.)
54- Look for: schema models, type definitions, serialization, deserialization, format conversion
55
56**Storage Destinations**
57- Find database operations
58- Identify file outputs
59- Look for: database operations, persistence, .save(), .create(), .write(), storage
60
61**Access Patterns**
62- Find data retrieval code
63- Identify query patterns
64- Look for: .get(), .query(), .find(), .load(), read operations, data access layer
65
66### Step 2: Map Data Flow
67
68Document the journey of key data entities:
69- **Origin**: Where does it come from?
70- **Transformations**: What changes happen?
71- **Storage**: Where is it persisted?
72- **Retrieval**: How is it accessed later?
73
74**CRITICAL - Analyze Read/Write Direction:**
75For EVERY storage location and data flow:
76- **Read sources (inputs)**: Components that READ from this location
77- **Write destinations (outputs)**: Components that WRITE to this location
78- **Read-write (primary storage)**: Both read and written by the system
79- **Write-only (artifacts)**: Written but NEVER read back by the system
80
81Clearly distinguish:
82- Primary storage (source of truth) - system reads AND writes
83- Write-only artifacts (debugging, logging) - system writes but never reads back
84- External inputs - system reads only
85
86Use different arrow styles:
87- Solid arrows for read/write primary storage
88- Dashed arrows for write-only artifacts
89
90### Step 3: Identify Conversion Boundaries
91
92Find format changes:
93- External format -> Internal format
94- Internal format -> Database format
95- Database format -> API response
96- Note naming convention changes
97
98### Step 4: Create the Diagram
99
100Use flowchart with:
101
102**Direction:** `LR` (left-to-right) for data flow, or `TB` for hierarchical
103
104**Subgraphs for Stages:**
105- Input/Origins
106- Transformation/Processing
107- Storage (primary)
108- Artifacts (secondary/write-only)
109- External Sync (if applicable)
110
111**Node Styling:**
112- `cli` class: Data origins, user input
113- `handler` class: Transformation, adapters
114- `stateNode` class: Database tables, primary storage
115- `output` class: Write-only artifacts, files
116- `integration` class: External sync, APIs
117
118**Connection Types:**
119- Solid arrows for primary data flow
120- Dashed arrows for write-only/secondary
121- Label with operation names
122
123**Database Nodes:**
124- Use cylinder shape: `[(Label)]`
125- Show table relationships
126
127### Step 5: Write Output
128
129Write the diagram to: `temp/arch-lens-data-lineage/arch_diag_data_lineage_{YYYY-MM-DD_HHMMSS}.md` (relative to the current working directory)
130
131After writing the diagram file, emit a structured output line:
132
133```
134diagram_path = {absolute_path_to_diagram_file}
135```
136
137---
138
139## Output Template
140
141```markdown
142# Data Lineage Diagram: {System Name}
143
144**Lens:** Data Lineage (Data-Centric)
145**Question:** Where is the data?
146**Date:** {YYYY-MM-DD}
147**Scope:** {What was analyzed}
148
149## Data Flow Overview
150
151| Stage | Format | Key Transformation |
152|-------|--------|-------------------|
153| Input | {format} | {description} |
154| Processing | {format} | {description} |
155| Storage | {format} | {description} |
156
157## Lineage Diagram
158
159```mermaid
160%%{init: {'flowchart': {'nodeSpacing': 50, 'rankSpacing': 60, 'curve': 'basis'}}}%%
161flowchart LR
162 %% CLASS DEFINITIONS %%
163 classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
164 classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
165 classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
166 classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
167 classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
168 classDef integration fill:#c62828,stroke:#ef9a9a,stroke-width:2px,color:#fff;
169
170 subgraph Input ["Data Origins"]
171 USER["User Input<br/>━━━━━━━━━━<br/>Source type<br/>Format"]
172 end
173
174 subgraph Transform ["Transformation"]
175 direction TB
176 ADAPTER["Adapter<br/>━━━━━━━━━━<br/>Conversion type"]
177 end
178
179 subgraph Storage ["Primary Storage (Source of Truth)"]
180 direction TB
181 DB[("Database Table<br/>━━━━━━━━━━<br/>Key fields")]
182 end
183
184 subgraph Artifacts ["Write-Only Artifacts"]
185 direction TB
186 FILE["output.json<br/>━━━━━━━━━━<br/>For debugging"]
187 end
188
189 %% FLOWS %%
190 USER -->|"input"| ADAPTER
191 ADAPTER -->|"save()"| DB
192 DB -.->|"write-only"| FILE
193
194 %% CLASS ASSIGNMENTS %%
195 class USER cli;
196 class ADAPTER handler;
197 class DB stateNode;
198 class FILE output;
199```
200
201**Color Legend:**
202| Color | Category | Description |
203|-------|----------|-------------|
204| Dark Blue | Input | Data origins (user, external) |
205| Orange | Transform | Format conversion and adapters |
206| Teal | Storage | Primary storage (source of truth) |
207| Dark Teal | Artifacts | Write-only outputs |
208| Red | Sync | External sync services |
209
210## Data Transformation Summary
211
212| Stage | Format | Key Conversion |
213|-------|--------|----------------|
214| {stage} | {format} | {conversion} |
215
216## Storage Destinations
217
218| Entity | Primary Storage | Secondary | Access Pattern |
219|--------|-----------------|-----------|----------------|
220| {entity} | {location} | {artifact} | {how accessed} |
221
222## Critical Design Principle
223
224> **Source of Truth**: {e.g., "Database is single source of truth. File outputs are write-only."}
225```
226
227---
228
229## Pre-Diagram Checklist
230
231Before creating the diagram, verify:
232
233- [ ] LOADED `/autoskillit:mermaid` skill using the Skill tool
234- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)
235- [ ] Diagram will include a color legend table
236
237---
238
239## Related Skills
240
241- `/autoskillit:make-arch-diag` - Parent skill for lens selection
242- `/autoskillit:mermaid` - MUST BE LOADED before creating diagram
243- `/autoskillit:arch-lens-c4-container` - For container-level storage view