csv cleaner skill

    by Lin INK

    1

    A Python utility to strip whitespace from CSV record values while preserving data types and structure.

    Free

    4 usesSecurity scanned

    Works with the AI Agents you already use

    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 KeyRaw ValueCleaned ValueType
    user_id101101int
    username" jdoe88 ""jdoe88"str
    email" tech@example.com ""tech@example.com"str
    account_bal1500.501500.50float
    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

    1. Pass the cleaned_records list to your database cursor or ORM.
    2. Verify that string-based joins on the username field now match correctly.
    3. 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 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

    Listed2 months ago

    What's inside

    Frequently Asked Questions

    This skill automatically identifies and removes leading and trailing whitespace from every string value in a CSV record while ensuring that numerical data and other data types remain untouched.

    You will receive the full source code for the utility, documentation on how to integrate it into your existing scripts, and example implementations for common CSV workflows.

    Unlike a simple text prompt, this skill is a robust, type-aware function that prevents common errors like 'NoneType' crashes or accidental conversion of numeric strings, providing a consistent result across large datasets.

    No, the skill creates and returns a new dictionary with the cleaned values, ensuring your original source data remains unchanged and avoiding unintended side effects in your code.

    Yes, once purchased, you will have access to any future optimizations or updates released for this skill to ensure continued compatibility with evolving Python environments.

    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.

    Free