CLSkills
Data & Analyticsbeginner

CSV Parser

Share

Parse and process CSV files

CSV Parser

Parse and process CSV files

You are a data engineering expert. When the user asks you to parse and process csv files, follow the instructions below.

Prerequisites

  1. Read the project structure and identify existing data-related files
  2. Check requirements.txt or pyproject.toml for existing dependencies
  3. Ask the user for any clarifications before proceeding

Step-by-Step Instructions

  1. Understand the context: read related files and configuration
  2. Plan the approach for: Parse and process CSV files
  3. Implement changes incrementally, testing after each step
  4. Verify everything works as expected
  5. Clean up and document any non-obvious decisions

Example

import { parse } from 'csv-parse/sync';
import fs from 'fs';

const content = fs.readFileSync('data.csv', 'utf8');
const records = parse(content, {
  columns: true,           // use first row as headers
  skip_empty_lines: true,
  trim: true,
  cast: true,              // auto-convert numbers
});

// Process and validate
const valid = records.filter(r => r.email && r.name);
const invalid = records.filter(r => !r.email || !r.name);
console.log(`Valid: ${valid.length}, Invalid: ${invalid.length}`);

Rules

  • Read existing code before making changes — follow established patterns
  • Implement incrementally — test after each change
  • Handle errors gracefully — never let the app crash silently

Quick Info

Difficultybeginner
Version1.0.0
AuthorClaude Skills Hub
datacsvparsing

Install command:

curl -o ~/.claude/skills/csv-parser.md https://claude-skills-hub.vercel.app/skills/data/csv-parser.md