rename-patterns

Build rename patterns using batch-renamer's pattern variable syntax for bulk file renaming. Use when constructing or understanding rename pattern strings, combining variables like {name}, {ext}, {index:N}, {date}. Triggers include "rename pattern", "pattern variables", "{name} {ext}", "rename syntax", "file naming pattern".

7 stars

Best use case

rename-patterns is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Build rename patterns using batch-renamer's pattern variable syntax for bulk file renaming. Use when constructing or understanding rename pattern strings, combining variables like {name}, {ext}, {index:N}, {date}. Triggers include "rename pattern", "pattern variables", "{name} {ext}", "rename syntax", "file naming pattern".

Teams using rename-patterns should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/rename-patterns/SKILL.md --create-dirs "https://raw.githubusercontent.com/heldernoid/agentic-build-templates/main/projects/cli-tools/batch-renamer/skills/rename-patterns/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/rename-patterns/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How rename-patterns Compares

Feature / Agentrename-patternsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Build rename patterns using batch-renamer's pattern variable syntax for bulk file renaming. Use when constructing or understanding rename pattern strings, combining variables like {name}, {ext}, {index:N}, {date}. Triggers include "rename pattern", "pattern variables", "{name} {ext}", "rename syntax", "file naming pattern".

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# rename-patterns

Reference guide for batch-renamer pattern variable syntax.

## Pattern Syntax

Patterns are string templates with `{variable}` placeholders. Everything outside `{}` is literal text.

```
prefix_{name}{ext}       ->  prefix_photo.jpg
{name}_v2{ext}           ->  photo_v2.jpg
{index:3}_{name}{ext}    ->  001_photo.jpg
{date}_{name}{ext}       ->  2026-03-20_photo.jpg
```

## Variable Reference

### File Variables

```
{name}     filename without extension
           photo.jpg  ->  photo
           report.2026.pdf  ->  report.2026

{ext}      extension with leading dot
           photo.jpg  ->  .jpg
           archive.tar.gz  ->  .gz

{dir}      immediate parent directory name
           /home/user/photos/beach/img.jpg  ->  beach
```

### Index Variables

```
{index}    1-based sequence number, no padding
           1, 2, 3, ... 25

{index:N}  zero-padded to N digits
           {index:3}  ->  001, 002, ... 025
           {index:4}  ->  0001, 0002, ... 0025
           {index:2}  ->  01, 02, ... 99
```

### Date Variables

Date is captured once at operation start - consistent across all files.

```
{date}     full date YYYY-MM-DD
           2026-03-20

{year}     four-digit year
           2026

{month}    two-digit month with zero-padding
           03

{day}      two-digit day with zero-padding
           20
```

### Regex Capture Groups

Only available in `--regex` mode.

```
{1}        first capture group
{2}        second capture group
{name}     named group (?<name>...)
```

## Pattern Examples by Use Case

### Add prefix

```
{date}_{name}{ext}        2026-03-20_photo.jpg
backup_{name}{ext}        backup_photo.jpg
{year}_{name}{ext}        2026_photo.jpg
```

### Add suffix

```
{name}_final{ext}         photo_final.jpg
{name}_{date}{ext}        photo_2026-03-20.jpg
{name}_{index:3}{ext}     photo_001.jpg
```

### Number files

```
{index:3}_{name}{ext}     001_photo.jpg
{index:4}{ext}            0001.jpg
{date}_{index:3}{ext}     2026-03-20_001.jpg
```

### Organize into subdirectories

```
{year}/{name}{ext}        2026/photo.jpg
{year}/{month}/{name}{ext}  2026/03/photo.jpg
{dir}/{index:3}_{name}{ext}  beach/001_photo.jpg
```

### Replace entire filename

```
{index:4}{ext}            0001.jpg, 0002.jpg
{date}_{index:3}{ext}     2026-03-20_001.jpg
```

## Regex Mode Patterns

```bash
# Input regex    Output pattern
# Capture groups {1}, {2} etc.

# Remove prefix
ren --regex "^OLD_(.*)" "{1}" "*.txt"
# OLD_report.txt  ->  report.txt

# Reorder date parts YYYY-MM-DD -> DD-MM-YYYY
ren --regex "^(\d{4})-(\d{2})-(\d{2})" "{3}-{2}-{1}" "*.log"
# 2026-03-20_app.log  ->  20-03-2026_app.log

# Extract number and reformat
ren --regex "IMG_(\d+)" "photo_{1}" "*.jpg"
# IMG_0042.jpg  ->  photo_0042.jpg

# Named groups (more readable)
ren --regex "(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})" "{day}.{month}.{year}" "*.jpg"
# 2026-03-20_shot.jpg  ->  20.03.2026_shot.jpg
```

## Rules and Edge Cases

**No-op detection** - If from and to are the same, the file is marked skipped (not an error).

**Conflict detection** - If two source files map to the same destination, both are flagged as conflicts.

**Pattern with no variables** - If the pattern produces the same name for every file, it is an error (all files would conflict).

**Extension handling** - `{ext}` includes the dot. To change extension, omit `{ext}` and write the new extension literally: `{name}.bak`.

**Empty extension** - Files without extensions have `{ext}` expand to empty string.

**Index ordering** - Files are sorted alphabetically before indexing. Index 1 is the alphabetically first file.

**Subdirectory creation** - If the pattern produces a path containing a directory separator, the directory is created automatically if it does not exist.

## Combining with Flags

```bash
# Pattern + recursive
ren --recursive "**/*.jpg" "{date}_{name}{ext}"

# Pattern + dry-run (preview only)
ren "*.txt" "{index:3}_{name}{ext}" --dry-run

# Regex + recursive + yes
ren --regex "^IMG_(\d+)" "photo_{1}" "**/*.jpg" --recursive --yes
```

Related Skills

regex-patterns

7
from heldernoid/agentic-build-templates

Implement and test regex patterns for detecting secrets in source code.

batch-renamer

7
from heldernoid/agentic-build-templates

Rename files in bulk using pattern-based rules, regex capture groups, numbering sequences, case conversions, and date-based renaming. Use when renaming multiple files at once, adding prefixes/suffixes, numbering files, or organizing files by date. Triggers include "rename files", "bulk rename", "add prefix to files", "number files", "rename with pattern", "ren command".

Skill: Uptime Monitoring

7
from heldernoid/agentic-build-templates

## Overview

Skill: Status Page

7
from heldernoid/agentic-build-templates

## Overview

Skill: unit-conversion

7
from heldernoid/agentic-build-templates

## Overview

Skill: recipe-scaler

7
from heldernoid/agentic-build-templates

## Overview

reading-list

7
from heldernoid/agentic-build-templates

Operate the reading-list API to save, manage, tag, search, and export articles.

email-digest

7
from heldernoid/agentic-build-templates

Configure, test, and troubleshoot the reading-list daily email digest delivered via nodemailer.

websocket-realtime

7
from heldernoid/agentic-build-templates

Use the WebSocket connection in poll-builder to receive live vote updates. Use when you need to stream real-time poll results, monitor a poll for new votes, or build a live dashboard. Triggers include "live results", "real-time updates", "stream votes", "watch poll", or "WebSocket".

poll-builder

7
from heldernoid/agentic-build-templates

Self-hosted poll creation tool with real-time results. Use when you need to create a poll, check vote counts, close a poll, export results, or get the shareable link for a poll. Triggers include "create poll", "vote", "poll results", "survey", "collect votes", "share poll", or any task involving polling or voting.

Skill: personal-finance

7
from heldernoid/agentic-build-templates

## Overview

Skill: csv-import

7
from heldernoid/agentic-build-templates

## Overview