# Tool Sd

> User-invoked skill tool-sd. A human runs it by name.

- Skill: `niksavis/tool-sd` (Agent Skill)
- Install (CLI): `npx skillmds@latest add niksavis/tool-sd`
- Raw SKILL.md: https://api.skillmd.com/api/skills/niksavis/tool-sd/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: niksavis (https://skillmd.com/u/niksavis)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/niksavis/tool-sd

---

<!-- Generated by `basicly skills-build` from skill.yaml. Do not edit; edit the source. -->

# tool-sd

## When To Use

- Apply straightforward search-and-replace updates in files.
- Replace fragile sed one-liners with readable syntax.
- Pair with fd or rg to run controlled batch edits.

## Trusted Commands

```bash
sd 'old' 'new' file.ts
sd -p 'old' 'new' file.ts
sd 'v(\\d+)' 'version-$1' file.txt
fd -e ts -x sd 'old' 'new' {}
rg -l 'old_api' | xargs sd 'old_api' 'new_api'
```

## Safe Defaults

- 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."

