find-replace

find-replace is a skill for Claude Code, Codex from 0xDarkMatter/claude-mods. It costs 42 tokens per session (622 once invoked), scanned A, original, MIT.

A command-line find-and-replace guide using sd, a tool for changing matching text in files. It covers single-file edits, multi-file replacements, regular expressions, and checking the result.

In plain words
What is it for?
Use it to rename variables, update import paths, replace patterns in batches, and review the affected files.
Why use it?
It provides a clearer way to replace text across code than traditional substitution commands, with a workflow for previewing and verifying changes.

Skill for Claude CodeCodex

Part of the claude-mods plugin — 103 skills, 3 commands, 3 agents, 4 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/0xdarkmatter/claude-mods/find-replace
Any agent
npx skills add 0xDarkMatter/claude-mods --skill find-replace
Clone the repo
git clone --depth 1 https://github.com/0xDarkMatter/claude-mods

Made for: Claude Code, Codex.

Or install claude-mods, the plugin that ships this one along with the rest of its 103 skills, 3 commands, 3 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for find-replace

README.md
[![agentmods](https://agentmods.dev/badge/skills/0xdarkmatter/claude-mods/find-replace.svg)](https://agentmods.dev/skills/0xdarkmatter/claude-mods/find-replace)
Your own site
<a href="https://agentmods.dev/skills/0xdarkmatter/claude-mods/find-replace"><img src="https://agentmods.dev/badge/skills/0xdarkmatter/claude-mods/find-replace.svg" alt="Measured on agentmods" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 622 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00042 $0.00622
Opus 5 $0.00021 $0.00311
Sonnet 5 $0.00008 $0.00124
Haiku 4.5 $0.00004 $0.00062

Measured 4d ago against content hash 3161f3c78fa1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

find-replace scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/find-replace/SKILL.md · 94 lines

What it actually says

Find Replace

Modern find-and-replace using sd.

sd Basics

# 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'

sd vs sed

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.

Common Patterns

# 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

Safe Batch Workflow

# 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

Special Characters

Character Escape
. \.
* \*
[ ] \[ \]
$ \$
\ \\

Tips

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

Additional Resources

For detailed patterns, load:

  • ./references/advanced-patterns.md - Regex, batch workflows, real-world examples
Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 94 lines · 42 tokens per session scan A 3161f3c78fa1

Subscribe to this mod's changes

find-replace is a skill published in the GitHub repository 0xDarkMatter/claude-mods (32 stars, last pushed 12d ago), licensed MIT. It adds 42 tokens to every session and 622 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.