Repren - Multi-Pattern Search and Replace

VerifiedCaution

Multi-pattern search and replace tool for bulk code refactoring, file renaming, and case-preserving transformations. Supports simultaneous replacements, regex patterns, dry-run previews, and automatic backups for safe refactoring.

Sby Skills Guide Bot
DevelopmentIntermediate
2/28/2026
Claude Code
#refactoring#search-replace#bulk-rename#regex#cli

Recommended for

Automated summary

Performs multi-pattern search-and-replace, file and directory renaming, and case-preserving refactors across a codebase.

Strengths

  • Applies multiple patterns in a single pass, including circular swaps such as foo↔bar.
  • Preserves case variants (my_var, myVar, MyVar, MY_VAR) when renaming identifiers.
  • Includes dry-run previews, .orig backups, and an --undo option for validation and rollback.
  • Can rename matching files and directories in addition to changing file contents.

Limitations

  • No semantic or AST awareness: regex patterns may change unintended code.
  • Requires a shell with uvx or a local repren installation.
  • Regex patterns must be reviewed with --dry-run before execution.
When to use it

For bulk identifier renames or consistent multi-pattern replacements across many files.

When not to use it

For a one-off edit in a single file or a semantic refactor that requires an AST tool.

Security analysis

Caution
Quality score82/100

The skill is a straightforward wrapper around a legitimate open-source refactoring CLI. It contains no exfiltration, obfuscation, curl|sh piping, or destructive system commands, and it actively promotes dry-run previews and automatic backups. The risk profile is that of a powerful bulk file-mutation tool executed via an unpinned `uvx ...@latest` invocation, which warrants caution rather than a clean 'safe' rating.

Findings
  • •Uses `uvx repren@latest`, which downloads and executes the newest unpublished-pin release from PyPI on every invocation — a supply-chain and reproducibility risk (no version pinning or hash verification).
  • •Performs bulk in-place content rewriting and file/directory renaming across an entire codebase; a mis-scoped pattern or path could cause widespread, unintended modifications (partially mitigated by documented `--dry-run` and automatic `.orig` backups).
  • •Writes and deletes files, including removing `.orig` backups via `--clean-backups`, which is irreversible once backups are gone.
How this analysis is made

Examples

Bulk identifier rename
Rename the identifier OldService to NewService across src/ using repren, preserve case variants, and show me a dry-run first.
Multi-pattern refactor
Use repren with a patterns file to rename old_function to new_function and OldClass to NewClass across Python files in src/, then run the dry-run before applying.
Swap names safely
Swap the names foo and bar throughout the codebase in one repren pass, with dry-run and backups.

name: repren description: Performs simultaneous multi-pattern search-and-replace, file/directory renaming, and case-preserving refactoring across codebases. Use for bulk refactoring, global find-and-replace, or when user mentions repren, multi-file rename, or pattern-based transformations. allowed-tools: Bash(repren:), Bash(uvx repren@latest:), Read, Write

Repren - Multi-Pattern Search and Replace

Full documentation: Run uvx repren@latest --docs for all options, flags, and advanced usage.

Multi-pattern search/replace tool for bulk refactoring with simultaneous replacements, file/directory renaming, and case-preserving transformations.

Quick Start

Always start with dry-run to preview changes:

uvx repren@latest --from='old_name' --to='new_name' --full --dry-run src/

Then execute if output looks correct:

uvx repren@latest --from='old_name' --to='new_name' --full src/

When to Use Repren

Use repren for:

  • Large-scale code refactoring (renaming across many files)
  • Simultaneous multi-pattern replacements
  • File and directory renaming based on content patterns
  • Case-preserving identifier transformations
  • Operations requiring dry-run validation and backups
  • Swapping or circular renames (foo↔bar)

Don’t use repren for:

  • Single-file small edits or replacements (use Edit tool instead)
  • Language-aware semantic refactoring (use AST tools like ast-grep, ts-morph)
  • Operations requiring precise line-by-line control (use Edit tool)

Core Features

Simultaneous Multi-Pattern Replacement

Create a patterns file with tab-separated pairs:

old_function	new_function
OldClass	NewClass
CONSTANT_OLD	CONSTANT_NEW

Apply all patterns at once:

uvx repren@latest --patterns=patterns.txt --full src/

Repren handles overlapping patterns intelligently: you can swap names (foo↔bar) in a single pass.

Case-Preserving Transformations

Handle all case variants automatically:

uvx repren@latest --from='my_var' --to='my_function' --preserve-case --full src/

Transforms: my_var→my_function, myVar→myFunction, MyVar→MyFunction, MY_VAR→MY_FUNCTION.

File and Directory Renaming

With --full, in addition to searching and replacing content, repren will rename files and directories matching the patterns.

uvx repren@latest --from='old_module' --to='new_module' --full src/

Renames files and directories, creating parent directories as needed. Files never clobber: numeric suffixes are added if conflicts arise.

Regex Patterns with Capture Groups

Use full Python regex syntax with backreferences:

uvx repren@latest --from='figure ([0-9]+)' --to='Figure \1' --full docs/

Pattern file example:

def (\w+)\(self\)	def \1(self, context)
class Old(\w+)	class New\1

Safety and Backup Management

Atomic Operations with Backups

All modifications create .orig backup files automatically. Original files never truncated on errors.

Dry Run

Always preview changes first:

uvx repren@latest --dry-run --patterns=patterns.txt --full mydir/

Shows exactly what would change without modifying files.

Undo Changes

Restore from backups if needed:

uvx repren@latest --undo --from='old' --to='new' --full src/

Clean Backups

Remove backups when satisfied:

uvx repren@latest --clean-backups src/

Common Workflows

Large Codebase Refactoring

  1. Preview changes:
uvx repren@latest --from='OldName' --to='NewName' --preserve-case --word-breaks --full --dry-run src/
  1. Execute if output looks correct:
uvx repren@latest --from='OldName' --to='NewName' --preserve-case --word-breaks --full src/
  1. Review changes, test, then clean backups:
uvx repren@latest --clean-backups src/

Filtering Files

Include only specific file types:

uvx repren@latest --patterns=patterns.txt --include='.*\.(py|pyi)$' --full src/

Exclude directories:

uvx repren@latest --patterns=patterns.txt --exclude='tests|node_modules|__pycache__' --full src/

Word Boundaries

Match only at word boundaries (safer for variable names):

uvx repren@latest --from='var' --to='variable' --word-breaks --full src/

Literal Patterns

Treat patterns as literal strings (not regex):

uvx repren@latest --from='file.txt' --to='data.txt' --literal --full docs/

Multi-Line Patterns

Process entire files at once for patterns spanning lines:

uvx repren@latest --patterns=patterns.txt --at-once --full src/

Machine-Readable Output

Use JSON format for programmatic processing:

uvx repren@latest --format=json --from='old' --to='new' --full src/

Returns structured data about all changes made.

Key Flags

Most important flags (run uvx repren@latest --docs for complete list):

| Flag | Purpose | | --- | --- | | --full | Apply to files AND rename them (not just stdin/stdout) | | --dry-run, -n | Preview without modifying | | --patterns=FILE | Use multi-pattern file instead of single --from/--to | | --preserve-case | Handle camelCase, snake_case, PascalCase, UPPER_CASE variants | | --word-breaks | Match only at word boundaries (safer for identifiers) | | --at-once | Process entire file (needed for multi-line patterns) | | --format=json | Machine-parseable output for scripts | | --undo | Restore from .orig backups | | --clean-backups | Remove backup files |

Pattern File Format

Tab-separated pattern/replacement pairs:

pattern<TAB>replacement
another<TAB>replacement
# Comments start with #

Supports regex with capture groups (\w+) and backreferences \1, \2. First match wins for overlaps.

Notes

  • All pattern matching uses Python regex syntax
  • Replacements are line-by-line by default, use --at-once for full-file
  • Multiple patterns matched first, then all replaced (enables swaps)
  • Binary files supported (patterns specified as strings, data handled as bytes)
  • File permissions preserved
  • Operations are atomic - temp files used, then renamed
  • Default excludes hidden files (starting with .), customizable with --exclude
  • Backup files (.orig by default) always ignored in recursive operations

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/repren-multi-pattern-search-and-replace-mm5t8ahi/download' --output '.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi/SKILL.md.part' && mv '.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi/SKILL.md.part' '.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash(repren:*), Bash(uvx repren@latest:*), Read, Write

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi/SKILL.md' && test -s '.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/repren' && cp -R '.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi' '.claude/skills/repren'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi'

openskills read 'repren-multi-pattern-search-and-replace-mm5t8ahi'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/repren-multi-pattern-search-and-replace-mm5t8ahi/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills