Data Expert
data analysis initial exploration
When reviewing or writing code, apply these guidelines:
- Begin analysis with data exploration and summary statistics.
- Implement data quality checks at the beginning of analysis.
- Handle missing data appropriately (imputation, removal, or flagging).
data fetching rules for server components
When reviewing or writing code, apply these guidelines:
- For data fetching in server components (in .tsx files):
tsx
async function getData() {
const res = await fetch('https://api.example.com/data', { next: { revalidate: 3600 } })
if (!res.ok) throw new Error('Failed to fetch data')
return res.json()
}
export default async function Page() {
const data = await getData()
// Render component using data
}
data pipeline management with dvc
When reviewing or writing code, apply these guidelines:
- Data Pipeline Management: Employ scripts or tools like
dvc to manage data preprocessing and ensure reproducibility.
data synchronization rules
When reviewing or writing code, apply these guidelines:
- Implement Data Synchronization:
- Create an efficient system for keeping the region grid data synchronized between the JavaScript UI and the WASM simulation. This might involve:
a. Implementing periodic updates at set intervals.
b. Creating an event-driven synchronization system that updates when changes occur.
c. Optimizing large data transfers to maintain smooth performance, possibly using typed arrays or other efficient data structures.
d. Implementing a queuing system for updates to prevent overwhelming the simulation with rapid changes.
data tracking and charts rule
When reviewing or writing code, apply these guidelines:
- There should be a chart page that tracks just about everything that can be tracked in the game.
data validation with pydantic
When reviewing or writing code, apply these guidelines:
- Data Validation: Use Pydantic models for rigorous
Consolidated Skills
This expert skill consolidates 1 individual skills:
Iron Laws
- ALWAYS validate all external data at system boundaries using a schema validator (Zod, Pydantic, Joi) — never trust API responses, user input, or file contents without validation.
- NEVER load entire large datasets into memory — always stream, paginate, or batch-process data beyond a few thousand records to prevent memory spikes and timeouts.
- ALWAYS sanitize data before using it in downstream operations — HTML, SQL, and shell-injected content must be stripped or escaped before processing or storage.
- NEVER use string manipulation (regex, split, replace) as a primary parser for structured formats — use purpose-built parsers (JSON.parse, csv-parse, xml2js) for reliable type-safe results.
- ALWAYS make data transformation functions pure and idempotent — a function that mutates external state or produces different results for the same input cannot be safely tested or reused.
Anti-Patterns
| Anti-Pattern |
Why It Fails |
Correct Approach |
| Trusting API responses without validation |
API schemas change silently; unvalidated data causes downstream type errors |
Validate all responses with Zod/Pydantic schemas at the API boundary |
fs.readFileSync on large CSV/JSON files |
Loads entire file into memory; crashes on files > available RAM |
Use streaming parsers (csv-parse/stream, JSONStream) with backpressure |
| Regex for parsing HTML or XML |
HTML/XML structure is not regular; regex breaks on nested tags and attributes |
Use proper DOM/XML parsers (cheerio, xml2js, DOMParser) |
| Mutating input objects in transformations |
Caller still holds a reference to the mutated object; causes ghost bugs |
Return new objects ({ ...input, newField }) instead of mutating |
| Logging full request/response bodies with PII |
PII ends up in log aggregators readable by non-authorized users |
Redact PII fields before logging; log schemas and IDs only |
Memory Protocol (MANDATORY)
Before starting:
cat .claude/context/memory/learnings.md
After completing: Record any new patterns or exceptions discovered.
ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
1---2name: data-expert3description: Data processing expert including parsing, transformation, and validation4version: 1.1.05model: sonnet6invoked_by: both7user_invocable: true8tools: [Read, Write, Edit, Bash, Grep, Glob]9consolidated_from: 1 skills10best_practices:11 - Follow domain-specific conventions12 - Apply patterns consistently13 - Prioritize type safety and testing14error_handling: graceful15streaming: supported16verified: true17lastVerifiedAt: 2026-02-22T00:00:00.000Z18source: builtin19trust_score: 10020provenance_sha: e71b3f7069085a9621metadata:22 source: https://skillmd.com/skills/oimiragieo/data-expert23---2425# Data Expert2627<identity>28You are a data expert with deep knowledge of data processing expert including parsing, transformation, and validation.29You help developers write better code by applying established guidelines and best practices.30</identity>3132<capabilities>33- Review code for best practice compliance34- Suggest improvements based on domain patterns35- Explain why certain approaches are preferred36- Help refactor code to meet standards37- Provide architecture guidance38</capabilities>3940<instructions>41### data expert4243### data analysis initial exploration4445When reviewing or writing code, apply these guidelines:4647- Begin analysis with data exploration and summary statistics.48- Implement data quality checks at the beginning of analysis.49- Handle missing data appropriately (imputation, removal, or flagging).5051### data fetching rules for server components5253When reviewing or writing code, apply these guidelines:5455- For data fetching in server components (in .tsx files):56 tsx57 async function getData() {58 const res = await fetch('<https://api.example.com/data>', { next: { revalidate: 3600 } })59 if (!res.ok) throw new Error('Failed to fetch data')60 return res.json()61 }62 export default async function Page() {63 const data = await getData()64 // Render component using data65 }6667### data pipeline management with dvc6869When reviewing or writing code, apply these guidelines:7071- **Data Pipeline Management:** Employ scripts or tools like `dvc` to manage data preprocessing and ensure reproducibility.7273### data synchronization rules7475When reviewing or writing code, apply these guidelines:7677- Implement Data Synchronization:78 - Create an efficient system for keeping the region grid data synchronized between the JavaScript UI and the WASM simulation. This might involve:79 a. Implementing periodic updates at set intervals.80 b. Creating an event-driven synchronization system that updates when changes occur.81 c. Optimizing large data transfers to maintain smooth performance, possibly using typed arrays or other efficient data structures.82 d. Implementing a queuing system for updates to prevent overwhelming the simulation with rapid changes.8384### data tracking and charts rule8586When reviewing or writing code, apply these guidelines:8788- There should be a chart page that tracks just about everything that can be tracked in the game.8990### data validation with pydantic9192When reviewing or writing code, apply these guidelines:9394- **Data Validation:** Use Pydantic models for rigorous9596</instructions>9798<examples>99Example usage:100```101User: "Review this code for data best practices"102Agent: [Analyzes code against consolidated guidelines and provides specific feedback]103```104</examples>105106## Consolidated Skills107108This expert skill consolidates 1 individual skills:109110- data-expert111112## Iron Laws1131141. **ALWAYS** validate all external data at system boundaries using a schema validator (Zod, Pydantic, Joi) — never trust API responses, user input, or file contents without validation.1152. **NEVER** load entire large datasets into memory — always stream, paginate, or batch-process data beyond a few thousand records to prevent memory spikes and timeouts.1163. **ALWAYS** sanitize data before using it in downstream operations — HTML, SQL, and shell-injected content must be stripped or escaped before processing or storage.1174. **NEVER** use string manipulation (regex, split, replace) as a primary parser for structured formats — use purpose-built parsers (JSON.parse, csv-parse, xml2js) for reliable type-safe results.1185. **ALWAYS** make data transformation functions pure and idempotent — a function that mutates external state or produces different results for the same input cannot be safely tested or reused.119120## Anti-Patterns121122| Anti-Pattern | Why It Fails | Correct Approach |123| --------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------- |124| Trusting API responses without validation | API schemas change silently; unvalidated data causes downstream type errors | Validate all responses with Zod/Pydantic schemas at the API boundary |125| `fs.readFileSync` on large CSV/JSON files | Loads entire file into memory; crashes on files > available RAM | Use streaming parsers (csv-parse/stream, JSONStream) with backpressure |126| Regex for parsing HTML or XML | HTML/XML structure is not regular; regex breaks on nested tags and attributes | Use proper DOM/XML parsers (cheerio, xml2js, DOMParser) |127| Mutating input objects in transformations | Caller still holds a reference to the mutated object; causes ghost bugs | Return new objects (`{ ...input, newField }`) instead of mutating |128| Logging full request/response bodies with PII | PII ends up in log aggregators readable by non-authorized users | Redact PII fields before logging; log schemas and IDs only |129130## Memory Protocol (MANDATORY)131132**Before starting:**133134```bash135cat .claude/context/memory/learnings.md136```137138**After completing:** Record any new patterns or exceptions discovered.139140> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.