Help us improve
Share bugs, ideas, or general feedback.
From claude-mods
Performs batch find-and-replace using sd CLI (sed alternative) for variable renames, import updates, regex patterns, and string replacements across files with safe preview workflows.
npx claudepluginhub 0xdarkmatter/claude-mods --plugin claude-modsHow this skill is triggered — by the user, by Claude, or both
Slash command
/claude-mods:find-replaceThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Modern find-and-replace using sd.
Search and replace across files with diff preview using frg CLI. Supports regex capture groups, multiline patterns (?s), case-insensitivity, fixed strings, and --type filtering. Preview before --write.
Builds srgn CLI commands for syntax-aware source-code search, transformation, scoped refactors, and CI checks. Use for multi-file rewrites, tree-sitter queries, or lint-like validations.
Finds files quickly using fd CLI tool with gitignore awareness, parallel execution, regex, glob patterns, and filters like size or time. Use for searching by name, extension, or pattern in directories.
Share bugs, ideas, or general feedback.
Modern find-and-replace using sd.
# Replace in file (in-place)
sd 'oldText' 'newText' file.txt
# Replace in multiple files
sd 'oldText' 'newText' *.js
# Preview without changing (pipe)
cat file.txt | sd 'old' 'new'
| sed | sd |
|---|---|
sed 's/old/new/g' | sd 'old' 'new' |
sed -i 's/old/new/g' | sd 'old' 'new' file |
sed 's#path/to#new/path#g' | sd 'path/to' 'new/path' |
Key difference: sd is global by default, no delimiter issues.
# Variable/function rename
sd 'oldName' 'newName' src/**/*.ts
# Word boundaries (avoid partial matches)
sd '\boldName\b' 'newName' src/**/*.ts
# Import path update
sd "from '../utils'" "from '@/utils'" src/**/*.ts
# Capture groups
sd 'console\.log\((.*)\)' 'logger.info($1)' src/**/*.js
# 1. List affected files
rg -l 'oldPattern' src/
# 2. Preview replacements
rg 'oldPattern' -r 'newPattern' src/
# 3. Apply
sd 'oldPattern' 'newPattern' $(rg -l 'oldPattern' src/)
# 4. Verify
rg 'oldPattern' src/ # Should return nothing
git diff # Review changes
| Character | Escape |
|---|---|
. | \. |
* | \* |
[ ] | \[ \] |
$ | \$ |
\ | \\ |
| Tip | Reason |
|---|---|
Always preview with rg -r first | Avoid mistakes |
| Use git before bulk changes | Easy rollback |
Use \b for word boundaries | Avoid partial matches |
| Quote patterns | Prevent shell interpretation |
For detailed patterns, load:
./references/advanced-patterns.md - Regex, batch workflows, real-world examples