home / skills / aidotnet / moyucode / csv-processor

csv-processor skill

/skills/tools/csv-processor

This skill helps you read, transform, and analyze CSV data, enabling filtering, sorting, aggregation, and format conversion for insights.

npx playbooks add skill aidotnet/moyucode --skill csv-processor

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.1 KB
---
name: csv-processor
description: 读取、写入、转换和分析CSV文件,支持过滤、排序、聚合和格式转换。
metadata:
  short-description: 处理CSV文件
source:
  repository: https://github.com/pandas-dev/pandas
  license: BSD-3-Clause
---

# CSV Processor Tool

## Description
Process CSV files with powerful data manipulation capabilities including filtering, sorting, aggregation, and format conversion.

## Trigger
- `/csv` command
- User needs to process CSV data
- User wants to transform or analyze tabular data

## Usage

```bash
# Read and display CSV
python scripts/csv_processor.py read data.csv

# Filter rows
python scripts/csv_processor.py filter data.csv --column "status" --value "active"

# Sort by column
python scripts/csv_processor.py sort data.csv --by "date" --desc

# Convert to JSON
python scripts/csv_processor.py convert data.csv --format json --output data.json

# Aggregate data
python scripts/csv_processor.py aggregate data.csv --group "category" --sum "amount"
```

## Tags
`csv`, `data`, `transform`, `analysis`, `pandas`

## Compatibility
- Codex: ✅
- Claude Code: ✅

Overview

This skill provides a compact CSV processor for reading, writing, converting, and analyzing CSV files. It supports filtering, sorting, aggregation, and format conversion to help you manipulate tabular data quickly. Designed for command-style use, it works well with scripts and automation workflows.

How this skill works

The tool inspects CSV files and performs row-level operations like filtering and sorting, column-level transformations, and group aggregations. It can convert CSV to other formats (for example JSON) and write results to disk or stdout. Commands accept column names, filter values, sort directions, and aggregation specs to produce deterministic outputs.

When to use it

  • Clean and prepare CSVs before importing into databases or analytics tools.
  • Quickly filter large CSVs to extract relevant rows or columns.
  • Sort datasets by date, numeric or textual fields for reporting.
  • Aggregate transactions by category, sum amounts, or compute counts and averages.
  • Convert CSVs to JSON for APIs or downstream processing.

Best practices

  • Specify exact column names to avoid ambiguous matches and unexpected results.
  • Preview changes on a subset of rows before running full-file operations to avoid costly mistakes.
  • Use explicit sort directions (asc/desc) when ordering results to ensure reproducible output.
  • When aggregating, validate numeric columns and handle missing values explicitly.
  • Write converted or transformed outputs to a new file rather than overwriting originals until results are verified.

Example use cases

  • Filter a user export to only include active accounts and write the subset to a new CSV.
  • Sort transaction logs by timestamp and convert the top N rows to JSON for an API payload.
  • Aggregate sales by product category to produce summary reports and totals.
  • Convert legacy CSV reports into JSON for ingestion by a modern data pipeline.
  • Chain filter → sort → aggregate to prepare a reporting dataset for visualization.

FAQ

What input formats are supported?

Primary input is standard CSV. It expects comma-delimited files but can handle quoted fields. For other delimiters, convert or specify settings if available.

Can I run multiple operations in one command?

Yes. Common workflows chain filter, sort, and aggregate steps. Use the command sequence or pipeline options to apply multiple transformations before output.

How are missing or non-numeric values handled in aggregation?

Non-numeric values are typically ignored for numeric aggregates. Missing values should be cleaned or filled before aggregation for accurate totals.