How I Used Claude to Build Custom Scripts (And Why You Should Too)

Date

Date

Date

November 9, 2025

November 9, 2025

November 9, 2025

Author

Author

Author

Lisa Zhao

Lisa Zhao

Lisa Zhao

I had 800 icon files that needed renaming. Each file had a number prefix, some had "copy" in the name, and none were capitalized consistently. I needed them cleaned up—fast.

My options:

  1. Rename 800 files manually (no thanks)

  2. Download a third-party file renaming app (but which one? Is it safe? Will it phone home with my data?)

  3. Ask Claude to write me a custom Python script

I chose option three. Here's why this approach is powerful—and why you should consider it for your own repetitive tasks.

The Security Advantage of Custom Scripts

When you download a third-party app to rename files, you're trusting that application with access to your file system. You don't know:

  • What data it's collecting

  • Where that data is going

  • What permissions it's requesting

  • Whether it's been audited for security

With a custom Python script that Claude writes for you:

  • The code is completely visible—you can see exactly what it does

  • It uses standard Python libraries (like os and re) that are well-established and safe

  • It runs locally on your machine with no internet connection required

  • You maintain complete control over what the script accesses

  • No third-party company has access to your file names, metadata, or folder structure

Is this foolproof? No. You should always review code before running it, especially if you're not familiar with programming. But it's far more transparent than a closed-source application with vague privacy policies.

From Specific Problem to Working Solution

Here's what made this interaction with Claude work so well—I didn't just say "help me rename files." I explained the specific rules I needed:

  1. Remove the numbers in front of the file name and the dash

  2. If files have the same name after cleaning, add (2), (3), etc. behind the file name

  3. Get rid of the word "copy"

  4. Capitalize the first letter of each word

This structured approach is key. When you're asking Claude to build something for you, think about:

What needs to change? Be specific about the transformation you want.

What are the edge cases? In my case, I needed to handle duplicates intelligently—only adding numbers when actual name conflicts occurred, not for every file.

What's the desired output? I wanted files like 016-meat copy.svg to become Meat.svg, and if I had two meat icons, the second should become Meat (2).svg.

By structuring my request around specific requirements rather than vague descriptions, Claude could build exactly what I needed.

The Iterative Process Matters

My first attempt didn't work perfectly. The script was adding (2) to every file because it was checking for existing files in the folder before the renaming happened—a logical error that's easy to miss.

Here's what I did instead of giving up:

I sent Claude a screenshot showing the problem: every file had (2) after it, which wasn't what I wanted. I said: "Now there is a (2) after everything. I only want there to be a bracket number after the title if the titles are the same for two separate files."

Claude rebuilt the logic:

  1. First pass: clean all filenames

  2. Second pass: identify which cleaned names are duplicates

  3. Only add numbering to actual duplicates

This iterative debugging process is where Claude really shines. You don't need to understand the underlying code logic—you just need to articulate what's wrong with the output.

Why This Approach Works for Non-Programmers

You don't need to be a developer to use this method. You just need to:

  1. Identify a repetitive task that follows consistent rules

  2. Describe what you want in clear, specific terms

  3. Test the script and report back what's not working

  4. Iterate until it does what you need

The barrier to entry is explaining your problem clearly, not writing code yourself.

Other Tasks You Could Automate This Way

Once you see how this works, you'll start noticing repetitive tasks everywhere:

  • Organizing photos by date, location, or camera settings

  • Batch converting files from one format to another

  • Cleaning up spreadsheet data with consistent formatting rules

  • Generating reports by pulling data from multiple sources

  • Sorting documents into folders based on content or metadata

  • Extracting specific information from multiple files at once

Each of these could be a custom script that runs locally, uses safe libraries, and does exactly what you need—without trusting a third-party application.

How to Run the Script Safely

Claude will give you instructions on running the script. For my file renaming task, it looked like this:

cd

Before you run any script, here's what to check:

  1. Read through the code (even if you don't fully understand it, you can often spot obvious red flags like network requests or file deletions)

  2. Check what libraries it imports (stick to standard Python libraries like os, re, pathlib, shutil)

  3. Test on a backup first if you're nervous about the changes

  4. Look for confirmation prompts (Claude's scripts often ask "Proceed with renaming?" before making changes)

The script Claude wrote for me showed a preview of every change before executing, which meant I could verify the logic before committing to 800 file renames.

The Real Power: Customization Without Compromise

Third-party apps are built for the masses. They have features most people need, but probably not the exact combination you need. And you're stuck with their interface, their workflow, their data practices.

With Claude-written scripts:

  • You get exactly what you asked for

  • You can modify the rules mid-project ("actually, can you also capitalize each word?")

  • You maintain complete visibility and control

  • You're not locked into a subscription or proprietary format

  • Your data never leaves your machine

My Results

After a few iterations, I had a script that:

  • Cleaned up all 800 filenames perfectly

  • Only added duplicate numbers where actual conflicts existed

  • Ran in seconds

  • Cost me nothing

  • Gave me complete transparency

The whole process—from first question to working script—took about 10 minutes. Manual renaming would have taken hours and been error-prone. A third-party app would have required research, download, installation, and trust.

Try It Yourself

Next time you face a repetitive task, before you reach for a third-party tool, try asking Claude:

"Help me write a Python script that can [describe your task]. I want to [list your specific requirements]. Then give me instructions on how to run it from the terminal."

Be specific. Be iterative. Be willing to report back what's not working.

You might be surprised at how quickly you can automate tasks you thought required specialized software—all while keeping your data secure and your workflow transparent.

Have you automated something unexpected with Claude? I'd love to hear about it in the comments.

Related posts

November 11, 2025

How to Automatically Share Your Ghost Blog Posts on LinkedIn, Twitter, and Facebook with N8N

Description

November 11, 2025

How to Automatically Share Your Ghost Blog Posts on LinkedIn, Twitter, and Facebook with N8N

Description

November 11, 2025

How to Automatically Share Your Ghost Blog Posts on LinkedIn, Twitter, and Facebook with N8N

Description

November 10, 2025

Compassionate Systems: Clear is Kind , Unclear is Unkind

Description

November 10, 2025

Compassionate Systems: Clear is Kind , Unclear is Unkind

Description

November 10, 2025

Compassionate Systems: Clear is Kind , Unclear is Unkind

Description

Got questions?

I’m always excited to collaborate on innovative and exciting projects!

Got questions?

I’m always excited to collaborate on innovative and exciting projects!

Got questions?

I’m always excited to collaborate on innovative and exciting projects!

Lisa Zhao, 2025

XX

Lisa Zhao, 2025

XX

Lisa Zhao, 2025

XX