
File Processing
- 1 installs
- 90 repo stars
- Updated July 25, 2026
- aws-samples/sample-strands-agents-agentskills
file-processing is a Claude Code skill that processes and analyzes CSV, JSON, and text files with data cleaning, transformation, and export.
About
file-processing loads and processes structured CSV, JSON, and text files with cleaning, transformation, analysis, and export capabilities. A developer uses it to filter, sort, aggregate, merge datasets, run descriptive statistics, and convert between formats without writing bespoke code each time. It runs through shell using Python and a bundled process.py helper.
- Loads, cleans, transforms, and analyzes CSV, JSON, and text files
- Runs descriptive statistics, filtering, grouping, and format conversion
- Exports to CSV, JSON, markdown tables, and summary reports
File Processing by the numbers
- 1 all-time installs (skills.sh)
- Ranked #1,803 of 2,064 Data Science & ML skills by installs in the Skillselion catalog
- Data as of Jul 26, 2026 (Skillselion catalog sync)
file-processing capabilities & compatibility
Free; runs locally via shell with Python standard library.
- Capabilities
- data cleaning · data transformation · data analysis · format conversion
- Use cases
- data analysis
- Pricing
- Free
What file-processing says it does
Process and analyze CSV, JSON, and text files with data transformation, cleaning, analysis, and visualization capabilities
Descriptive statistics (mean, median, std, etc.)
npx skills add https://github.com/aws-samples/sample-strands-agents-agentskills --skill file-processingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 90 |
| Last updated | July 25, 2026 |
| Repository | aws-samples/sample-strands-agents-agentskills ↗ |
What it does
Clean, transform, analyze, and convert CSV/JSON/text data files without writing custom code each time.
Who is it for?
Ad hoc data cleaning, transformation, statistical analysis, and format conversion on tabular files.
Skip if: Large-scale distributed data engineering or database-backed pipelines; it works on individual files via shell.
When should I use this skill?
You need to load, clean, filter, aggregate, or convert CSV/JSON/text data without hand-writing the code.
What you get
Cleaned, transformed, and analyzed data output as CSV, JSON, markdown tables, or a summary report.
- cleaned dataset
- summary report
- markdown table
By the numbers
- 5 capability groups (loading, cleaning, transformation, analysis, export)
- 4 documented use cases
Files
File Processing Skill
Purpose
Process structured data files (CSV, JSON, text) with comprehensive capabilities for data cleaning, transformation, analysis, and export. This skill enables working with data files without requiring users to write code.
When to Use This Skill
Use this skill when you need to:
- Load and parse CSV or JSON files
- Clean and transform data
- Perform statistical analysis
- Filter, sort, or aggregate data
- Merge or join datasets
- Convert between formats (CSV ↔ JSON)
- Generate summary reports
Capabilities
1. Data Loading
Supported formats:
- CSV files: Any delimiter (comma, tab, semicolon, etc.)
- JSON files: Single objects or arrays of objects
- Text files: Custom delimited formats
2. Data Cleaning
Available operations:
- Remove duplicate rows
- Handle missing values (drop, fill, interpolate)
- Normalize text (trim whitespace, standardize case)
- Convert data types
- Remove outliers
- Validate data against rules
3. Data Transformation
Available operations:
- Filter: Select rows based on conditions
- Select: Choose specific columns
- Sort: Order by one or more columns
- Group: Aggregate data by categories
- Pivot: Reshape data (wide ↔ long format)
- Merge: Combine multiple datasets
- Calculate: Add derived columns
4. Data Analysis
Available analyses:
- Descriptive statistics (mean, median, std, etc.)
- Frequency distributions
- Correlation analysis
- Trend detection
- Missing data analysis
- Data quality assessment
5. Export
Output formats:
- CSV files
- JSON files (objects or arrays)
- Markdown tables
- Summary reports
Instructions for Execution
When this skill is activated, follow these steps:
Step 1: Understand the Request
Ask clarifying questions if needed:
- What file(s) need to be processed?
- What specific analysis or transformation is required?
- What output format is desired?
- Are there any specific requirements or constraints?
Step 2: Load the Data
Use shell to load and process data:
# For CSV files
import csv
# Read from file path
with open('data.csv', 'r') as f:
reader = csv.DictReader(f)
data = list(reader)
# For JSON files
import json
with open('data.json', 'r') as f:
data = json.load(f)Alternatively, use the supporting scripts:
# Execute the helper script
("scripts/process.py")Step 3: Perform Operations
Apply the requested transformations or analyses:
# Example: Filter and aggregate
filtered = [row for row in data if float(row['amount']) > 100]
# Example: Calculate statistics
from statistics import mean, median
amounts = [float(row['amount']) for row in data]
avg = mean(amounts)
med = median(amounts)Step 4: Generate Output
Format results according to user needs:
# As markdown table
def to_markdown_table(data, columns=None):
if not data:
return "No data"
if columns is None:
columns = list(data[0].keys())
# Header
header = "| " + " | ".join(columns) + " |"
separator = "| " + " | ".join(["---"] * len(columns)) + " |"
# Rows
rows = []
for row in data:
row_str = "| " + " | ".join(str(row.get(col, "")) for col in columns) + " |"
rows.append(row_str)
return "\n".join([header, separator] + rows)
print(to_markdown_table(filtered))Common Use Cases
Use Case 1: CSV Analysis
# Example: Analyze sales data
import csv
from io import StringIO
from statistics import mean, sum as total
# Load CSV
reader = csv.DictReader(StringIO(file_content))
data = list(reader)
# Calculate metrics
total_sales = sum(float(row['amount']) for row in data)
avg_sales = mean(float(row['amount']) for row in data)
unique_customers = len(set(row['customer_id'] for row in data))
print(f"Total Sales: ${total_sales:,.2f}")
print(f"Average Sale: ${avg_sales:,.2f}")
print(f"Unique Customers: {unique_customers}")Use Case 2: Data Filtering
# Example: Filter records by criteria
filtered = [
row for row in data
if row['status'] == 'active' and float(row['score']) >= 80
]
print(f"Found {len(filtered)} matching records")Use Case 3: Data Grouping
# Example: Group and aggregate
from collections import defaultdict
grouped = defaultdict(list)
for row in data:
grouped[row['category']].append(float(row['value']))
summary = {}
for category, values in grouped.items():
summary[category] = {
'count': len(values),
'total': sum(values),
'average': sum(values) / len(values)
}
for category, stats in summary.items():
print(f"{category}: {stats['count']} items, avg = {stats['average']:.2f}")Use Case 4: Format Conversion
# Example: CSV to JSON
import csv
import json
from io import StringIO
reader = csv.DictReader(StringIO(file_content))
data = list(reader)
# Convert to JSON
json_output = json.dumps(data, indent=2)
print(json_output)Supporting Scripts
scripts/process.py: Data processing utility functions
Data Processing Patterns
Pattern 1: ETL (Extract, Transform, Load)
# Extract
data = load_file(file_content)
# Transform
cleaned = remove_duplicates(data)
filtered = apply_filters(cleaned, conditions)
enriched = add_calculated_fields(filtered)
# Load (output)
output = format_as_markdown(enriched)
print(output)Pattern 2: Aggregation Pipeline
# Pipeline: filter → group → aggregate → sort
result = (
filter_data(data, conditions)
| group_by(key='category')
| aggregate(metrics=['sum', 'average'])
| sort_by(column='total', descending=True)
)Best Practices
1. Validate Input: Check file format and structure before processing 2. Handle Errors: Gracefully handle missing columns or invalid data 3. Show Progress: For large files, indicate what's being processed 4. Explain Results: Provide context for statistics and findings 5. Suggest Next Steps: Recommend additional analyses if relevant
Limitations
- File Size: Large files (>100MB) may be slow or cause memory issues
- Complex Operations: Very complex transformations may require multiple steps
- Performance: Pure Python processing; not optimized for big data
Tips for Users
- Provide Examples: Show a sample of your data format
- Be Specific: Clearly describe what transformation you need
- Start Simple: Begin with basic operations, then add complexity
- Check Output: Verify results make sense for your data
"""
Data Processing Utility Functions
This module provides reusable functions for common data processing tasks.
"""
import csv
import json
from io import StringIO
from typing import List, Dict, Any, Callable
from collections import defaultdict
from statistics import mean, median, stdev
def load_csv(content: str, delimiter: str = ',') -> List[Dict[str, str]]:
"""
Load CSV content into a list of dictionaries.
Args:
content: CSV file content as string
delimiter: Field delimiter (default: comma)
Returns:
List of dictionaries, one per row
Example:
>>> csv_data = "name,age\\nAlice,30\\nBob,25"
>>> data = load_csv(csv_data)
>>> print(data)
[{'name': 'Alice', 'age': '30'}, {'name': 'Bob', 'age': '25'}]
"""
reader = csv.DictReader(StringIO(content), delimiter=delimiter)
return list(reader)
def load_json(content: str) -> Any:
"""
Load JSON content.
Args:
content: JSON file content as string
Returns:
Parsed JSON data (dict or list)
Example:
>>> json_data = '[{"name": "Alice", "age": 30}]'
>>> data = load_json(json_data)
>>> print(data)
[{'name': 'Alice', 'age': 30}]
"""
return json.loads(content)
def remove_duplicates(data: List[Dict], key: str = None) -> List[Dict]:
"""
Remove duplicate rows from data.
Args:
data: List of dictionaries
key: Optional key to determine uniqueness (if None, checks entire row)
Returns:
List with duplicates removed
Example:
>>> data = [{'id': 1, 'name': 'Alice'}, {'id': 1, 'name': 'Alice'}, {'id': 2, 'name': 'Bob'}]
>>> unique = remove_duplicates(data)
>>> print(len(unique))
2
"""
if key:
seen = set()
result = []
for row in data:
if row.get(key) not in seen:
seen.add(row.get(key))
result.append(row)
return result
else:
# Remove duplicates based on entire row
seen = set()
result = []
for row in data:
row_tuple = tuple(sorted(row.items()))
if row_tuple not in seen:
seen.add(row_tuple)
result.append(row)
return result
def filter_data(data: List[Dict], condition: Callable[[Dict], bool]) -> List[Dict]:
"""
Filter data based on a condition function.
Args:
data: List of dictionaries
condition: Function that takes a row and returns True/False
Returns:
Filtered list
Example:
>>> data = [{'age': 30}, {'age': 25}, {'age': 35}]
>>> filtered = filter_data(data, lambda row: int(row['age']) >= 30)
>>> print(len(filtered))
2
"""
return [row for row in data if condition(row)]
def select_columns(data: List[Dict], columns: List[str]) -> List[Dict]:
"""
Select specific columns from data.
Args:
data: List of dictionaries
columns: List of column names to keep
Returns:
List with only selected columns
Example:
>>> data = [{'name': 'Alice', 'age': 30, 'city': 'NYC'}]
>>> selected = select_columns(data, ['name', 'age'])
>>> print(selected)
[{'name': 'Alice', 'age': 30}]
"""
return [{col: row.get(col) for col in columns} for row in data]
def sort_data(data: List[Dict], key: str, reverse: bool = False) -> List[Dict]:
"""
Sort data by a specific column.
Args:
data: List of dictionaries
key: Column name to sort by
reverse: If True, sort in descending order
Returns:
Sorted list
Example:
>>> data = [{'name': 'Bob', 'age': 25}, {'name': 'Alice', 'age': 30}]
>>> sorted_data = sort_data(data, 'age')
>>> print(sorted_data[0]['name'])
Bob
"""
def sort_key(row):
value = row.get(key)
# Try to convert to number for numeric sorting
try:
return float(value)
except (ValueError, TypeError):
return str(value).lower()
return sorted(data, key=sort_key, reverse=reverse)
def group_by(data: List[Dict], key: str) -> Dict[Any, List[Dict]]:
"""
Group data by a specific column.
Args:
data: List of dictionaries
key: Column name to group by
Returns:
Dictionary mapping group keys to lists of rows
Example:
>>> data = [
... {'category': 'A', 'value': 10},
... {'category': 'A', 'value': 20},
... {'category': 'B', 'value': 30}
... ]
>>> grouped = group_by(data, 'category')
>>> print(len(grouped['A']))
2
"""
result = defaultdict(list)
for row in data:
result[row.get(key)].append(row)
return dict(result)
def aggregate(data: List[Dict], group_key: str, value_key: str, operations: List[str] = None) -> List[Dict]:
"""
Aggregate data by group with specified operations.
Args:
data: List of dictionaries
group_key: Column to group by
value_key: Column to aggregate
operations: List of operations ('sum', 'mean', 'median', 'count', 'min', 'max')
Returns:
List of aggregated results
Example:
>>> data = [
... {'category': 'A', 'amount': 10},
... {'category': 'A', 'amount': 20},
... {'category': 'B', 'amount': 30}
... ]
>>> result = aggregate(data, 'category', 'amount', ['sum', 'mean', 'count'])
>>> # Returns: [{'category': 'A', 'sum': 30, 'mean': 15, 'count': 2}, {'category': 'B', ...}]
"""
if operations is None:
operations = ['sum', 'mean', 'count']
grouped = group_by(data, group_key)
results = []
for group, rows in grouped.items():
values = [float(row.get(value_key, 0)) for row in rows if row.get(value_key)]
result = {group_key: group}
for op in operations:
if op == 'sum':
result['sum'] = sum(values)
elif op == 'mean' or op == 'avg' or op == 'average':
result['mean'] = mean(values) if values else 0
elif op == 'median':
result['median'] = median(values) if values else 0
elif op == 'count':
result['count'] = len(values)
elif op == 'min':
result['min'] = min(values) if values else None
elif op == 'max':
result['max'] = max(values) if values else None
elif op == 'std' or op == 'stdev':
result['std'] = stdev(values) if len(values) > 1 else 0
results.append(result)
return results
def to_markdown_table(data: List[Dict], columns: List[str] = None) -> str:
"""
Convert data to markdown table format.
Args:
data: List of dictionaries
columns: Optional list of columns to include (default: all)
Returns:
Markdown formatted table string
Example:
>>> data = [{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}]
>>> table = to_markdown_table(data)
>>> print(table)
| name | age |
| --- | --- |
| Alice | 30 |
| Bob | 25 |
"""
if not data:
return "No data to display"
if columns is None:
columns = list(data[0].keys())
# Header
header = "| " + " | ".join(columns) + " |"
separator = "| " + " | ".join(["---"] * len(columns)) + " |"
# Rows
rows = []
for row in data:
values = [str(row.get(col, "")) for col in columns]
row_str = "| " + " | ".join(values) + " |"
rows.append(row_str)
return "\n".join([header, separator] + rows)
def to_csv(data: List[Dict], columns: List[str] = None) -> str:
"""
Convert data to CSV format.
Args:
data: List of dictionaries
columns: Optional list of columns to include (default: all)
Returns:
CSV formatted string
Example:
>>> data = [{'name': 'Alice', 'age': 30}, {'name': 'Bob', 'age': 25}]
>>> csv = to_csv(data)
>>> print(csv)
name,age
Alice,30
Bob,25
"""
if not data:
return ""
if columns is None:
columns = list(data[0].keys())
output = StringIO()
writer = csv.DictWriter(output, fieldnames=columns)
writer.writeheader()
writer.writerows(data)
return output.getvalue()
def to_json(data: List[Dict], pretty: bool = True) -> str:
"""
Convert data to JSON format.
Args:
data: List of dictionaries
pretty: If True, format with indentation
Returns:
JSON formatted string
Example:
>>> data = [{'name': 'Alice', 'age': 30}]
>>> json_str = to_json(data)
>>> print(json_str)
"""
if pretty:
return json.dumps(data, indent=2)
else:
return json.dumps(data)
def describe_data(data: List[Dict], numeric_columns: List[str] = None) -> Dict:
"""
Generate descriptive statistics for numeric columns.
Args:
data: List of dictionaries
numeric_columns: List of columns to analyze (auto-detect if None)
Returns:
Dictionary with statistics
Example:
>>> data = [{'age': 30, 'score': 85}, {'age': 25, 'score': 90}]
>>> stats = describe_data(data, ['age', 'score'])
>>> print(stats['age']['mean'])
27.5
"""
if not data:
return {}
if numeric_columns is None:
# Auto-detect numeric columns
first_row = data[0]
numeric_columns = []
for key, value in first_row.items():
try:
float(value)
numeric_columns.append(key)
except (ValueError, TypeError):
pass
results = {}
for col in numeric_columns:
values = []
for row in data:
try:
values.append(float(row.get(col, 0)))
except (ValueError, TypeError):
pass
if values:
results[col] = {
'count': len(values),
'mean': mean(values),
'median': median(values),
'min': min(values),
'max': max(values),
'std': stdev(values) if len(values) > 1 else 0
}
return results
Related skills
FAQ
What file formats are supported?
CSV files with any delimiter, JSON objects or arrays, and custom-delimited text files.
What outputs can it produce?
CSV, JSON, markdown tables, and summary reports.