Use -p preview mode before in-place bulk replacements.
Scope candidate files first with fd or rg -l.
Use -F for literal matching when regex should be disabled.
Common Pitfalls
sd uses regex by default and may over-match literal text.
In-place edits can change many files quickly without warning.
Large batch replacements are risky without diff review.
Output Interpretation
Standard mode edits files in place and prints minimal output.
Preview mode (-p) shows what would change without writing.
Why It Matters For Agents
Faster and safer than sed for common multi-file text migrations.
Integrates cleanly with fd/rg-driven candidate selection.
Repo Conventions
Prefer sd over brittle sed expressions for cross-platform replacement.
Keep bulk edits tightly scoped to task-relevant files.
Trigger Examples
Should trigger: "Replace this deprecated flag name in all docs files."
Should trigger: "Batch-update import path strings safely."
Should not trigger: "Analyze AST-level method call patterns."
1---2name: tool-sd-23description: tool-sd4---5# tool-sd67## When To Use89- Apply straightforward search-and-replace updates in files.10- Replace fragile sed one-liners with readable syntax.11- Pair with fd or rg to run controlled batch edits.1213## Trusted Commands1415```bash16sd 'old' 'new' file.ts17sd -p 'old' 'new' file.ts18sd 'v(\\d+)' 'version-$1' file.txt19fd -e ts -x sd 'old' 'new' {}20rg -l 'old_api' | xargs sd 'old_api' 'new_api'21```2223## Safe Defaults2425- Use `-p` preview mode before in-place bulk replacements.26- Scope candidate files first with `fd` or `rg -l`.27- Use `-F` for literal matching when regex should be disabled.2829## Common Pitfalls3031- sd uses regex by default and may over-match literal text.32- In-place edits can change many files quickly without warning.33- Large batch replacements are risky without diff review.3435## Output Interpretation3637- Standard mode edits files in place and prints minimal output.38- Preview mode (`-p`) shows what would change without writing.3940## Why It Matters For Agents4142- Faster and safer than sed for common multi-file text migrations.43- Integrates cleanly with fd/rg-driven candidate selection.4445## Repo Conventions4647- Prefer sd over brittle sed expressions for cross-platform replacement.48- Keep bulk edits tightly scoped to task-relevant files.4950## Trigger Examples5152- Should trigger: "Replace this deprecated flag name in all docs files."53- Should trigger: "Batch-update import path strings safely."54- Should not trigger: "Analyze AST-level method call patterns."
Run npx skillmds@latest add niksavis/tool-sd-2 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
tool-sd It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
niksavis (@niksavis) published this skill. Their other Agent Skills are listed on their SkillMD profile.