agentleFS
agentsdanceagentsdance/agentskills/skills/csv-processor/SKILL.md

csv-processor

Skill3 starsChanged 11 months agoApache-2.0View on GitHub

Process and analyze CSV files. Use when the user needs to parse, filter, aggregate, or transform CSV data.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

CSV Processor

Parse, transform, and analyze CSV files.

Node.js (csv-parse)

import { parse } from 'csv-parse';
import { stringify } from 'csv-stringify';
import fs from 'fs';

// Read and process CSV
const records = [];
fs.createReadStream('input.csv')
  .pipe(parse({
    columns: true,
    skip_empty_lines: true,
    trim: true
  }))
  .on('data', (row) => {
    // Transform each row
    records.push({
      ...row,
      total: parseFloat(row.price) * parseInt(row.quantity)
    });
  })
  .on('end', () => {
    console.log(`Processed ${records.length} records`);
  });

// Write CSV
const output = stringify(records, { header: true });
fs.writeFileSync('output.csv', output);

Python (pandas)

import pandas as pd

# Read CSV
df = pd.read_csv('data.csv', parse_dates=['date'])

# Filter
filtered = df[df['status'] == 'active']

# Aggregate
summary = df.groupby('category').agg({
    'sales': 'sum',
    'quantity': 'mean',
    'price': ['min', 'max']
}).round(2)

# Add calculated column
df['total'] = df['price'] * df['quantity']

# Handle missing values
df['name'].fillna('Unknown', inplace=True)
df.dropna(subset=['required_field'], inplace=True)

# Sort
df.sort_values(['date', 'amount'], ascending=[True, False], inplace=True)

# Save
df.to_csv('output.csv', index=False)

Shell (csvkit)

# View CSV
csvlook data.csv

# Filter rows
csvgrep -c status -m "active" data.csv > filtered.csv

# Select columns
csvcut -c name,email,phone data.csv > contacts.csv

# Sort
csvsort -c amount -r data.csv > sorted.csv

# Statistics
csvstat data.csv

# SQL query on CSV
csvsql --query "SELECT name, SUM(amount) FROM data GROUP BY name" data.csv

Large File Processing

# Process in chunks
chunk_size = 10000
for chunk in pd.read_csv('large.csv', chunksize=chunk_size):
    process(chunk)

# Stream processing (memory efficient)
import csv
with open('large.csv', 'r') as f:
    reader = csv.DictReader(f)
    for row in reader:
        process_row(row)

Common Operations

Operationpandascsvkit
Viewdf.head()csvlook
Filterdf[condition]csvgrep
Selectdf[['col1','col2']]csvcut
Sortdf.sort_values()csvsort
Joindf.merge()csvjoin

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.