- Home
- Skills
- Data & Databases
- csv cleaner skill
csv cleaner skill
by Lin INK
A Python utility to strip whitespace from CSV record values while preserving data types and structure.
Free
csv cleaner skill
Example session with this skill installed
I have a list of records from a messy CSV export with extra spaces in the names and categories. Can you show me how to clean them using the record_ops utility?
- Read your context and instructions
- Compiled the csv cleaner
I have processed the records using the clean_record utility. This ensures all string values are trimmed while preserving numerical types for downstream analysis.
Cleaned Data Output
| Original Key | Raw Value | Cleaned Value | Type |
|---|---|---|---|
user_id | 101 | 101 | int |
username | " jdoe88 " | "jdoe88" | str |
email | " tech@example.com " | "tech@example.com" | str |
account_bal | 1500.50 | 1500.50 | float |
status | " active " | "active" | str |
from record_ops import clean_record
# Example of batch processing the dataset
raw_records = [
{"user_id": 101, "username": " jdoe88 ", "email": " tech@example.com ", "account_bal": 1500.50, "status": " active "},
{"user_id": 102, "username": " admin ", "email": "admin@ops.net ", "account_bal": 0.00, "status": "inactive"}
]
cleaned_records = [clean_record(rec) for rec in raw_records]
# Resulting first record:
# {'user_id': 101, 'username': 'jdoe88', 'email': 'tech@example.com', 'account_bal': 1500.5, 'status': 'active'}
Next steps
- Pass the
cleaned_recordslist to your database cursor or ORM. - Verify that string-based joins on the
usernamefield now match correctly. - Wrap the cleaning logic in a generator if processing multi-gigabyte CSV files.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
CSV exports from enterprise tools often include leading or trailing whitespace that breaks database joins and string comparisons. Manually stripping these characters across large datasets is repetitive and error-prone.
What it does
- Trims whitespace from every string value in a dictionary record.
- Preserves non-string data types like integers and floats without modification.
- Returns a new dictionary to maintain immutability and prevent side effects.
- Maintains original keys exactly as they appear in the source.
Frameworks & tools
Python 3.x, CSV module, Pandas, and any dictionary-based data pipeline.
Why this beats prompting it yourself
This skill provides a standardized implementation that handles type checking correctly. Instead of generating one-off list comprehensions or lambda functions that might fail on nulls or non-string types, you get a predictable utility for your data scripts.
Use cases
- Sanitizing records from csv.DictReader before database insertion.
- Preprocessing string keys before performing a join between two datasets.
- Normalizing untrusted user uploads in a web backend.
- Preparing clean dictionaries for conversion into Pandas DataFrames.
Only modifies values, not keys. Requires data to be in dictionary format.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
4 uses
Times used to date
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 2 months ago
- Free with an Agensi account
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
New in Data & Databases
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.