agentleFS
NikoxkxNikoxkx/Agent-Skills/skills/data-analytics/csv-processor/SKILL.md

csv-processor

Skill1 starsChanged 5 months agoApache-2.0View on GitHub

Parses, transforms, validates, and exports CSV files. Use when reading, cleaning, filtering, merging, or converting CSV data.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No unexpected nulls in key fields.

    line 64
  2. Distinctive:

    Prefer Parquet for large/intermediate data (much faster, smaller, typed).

    line 70
  3. Very specific:

    Embedded delimiters or quotes: Use the csv module's dialect or pandas with proper quoting.

    line 83
  4. Distinctive:

    Huge files on low memory: Always offer the chunked path.

    line 84

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Overview

Handles real-world CSV processing tasks reliably: encoding detection, delimiter sniffing, header normalization, row filtering and column selection, merging multiple CSVs, chunked processing for large files, validation against schemas, and export to CSV, JSON, Parquet, or Excel with proper quoting and escaping.

When to Use This Skill

  • Ingesting or cleaning data delivered as CSV exports.
  • Combining data from multiple CSV sources.
  • Converting CSV to other formats for downstream systems.
  • The user provides CSV files or describes CSV processing needs.

Prerequisites

  • Python with pandas (recommended for most work) or standard csv module for very simple cases.
  • The CSV file(s) or a description of their structure.
  • For large files: enough memory or a chunked strategy.

Steps

  1. Inspect the CSV:
    • Open with a text editor or head -c 1000.
    • Determine encoding (use chardet or charset_normalizer).
    • Sniff delimiter (, , ;, \t).
  2. Read safely:
    • pd.read_csv(..., encoding=..., sep=..., engine='c' or 'python').
    • dtype=str initially to avoid type inference surprises, then cast.
    • on_bad_lines='skip' or custom error handler for malformed rows.
  3. Header & column normalization:
    • Lowercase, strip, replace spaces with underscores.
    • Handle duplicate column names.
    • Rename using a mapping if the source headers are bad.
  4. Filtering & selection:
    • Boolean indexing for rows.
    • Column list or regex for selection.
    • Drop or keep based on business rules.
  5. Merging multiple CSVs:
    • pd.concat with ignore_index=True.
    • Or pd.merge on keys for relational join.
    • Handle schema differences between files.
  6. Chunked processing (for >1GB or memory-constrained):
    • pd.read_csv(..., chunksize=100_000).
    • Process each chunk, write to Parquet or append to output.
    • Aggregate as you go when possible.
  7. Validation:
    • Required columns present.
    • No unexpected nulls in key fields.
    • Value ranges or allowed sets.
    • Row count within expected bounds.
  8. Export:
    • to_csv(index=False, quoting=csv.QUOTE_MINIMAL).
    • Prefer Parquet for large/intermediate data (much faster, smaller, typed).
    • Excel with openpyxl for business users (with formatting).
  9. Output:
    • Reusable process_csv(input_path, output_path) function or notebook cells.
    • Handling for common real-world messiness (quotes, newlines in fields, BOM).

Examples

A robust script that reads a messy sales CSV (mixed encodings, bad headers, embedded newlines), cleans it, merges with a second "customers" CSV, validates, and exports to Parquet + a summary Excel report is included.

Edge Cases & Error Handling

  • Embedded delimiters or quotes: Use the csv module's dialect or pandas with proper quoting.
  • Huge files on low memory: Always offer the chunked path.
  • Date formats: Multiple formats in one column — use dateutil.parser or pd.to_datetime with format inference.

Verification

  1. The script runs without crashing on the provided (messy) file.
  2. Output file has the expected columns, dtypes, and row count.
  3. Manual spot checks in the output match expectations.
  4. Re-running on the same input produces bit-identical output (when deterministic).
  5. Success: The CSV is turned into clean, usable data with a clear audit trail of transformations.

References

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.