# Refactor Across Files

> Multi-file string operations with quote and escape safety — uses bun -e, not sed.

- **Kind**: Shell tool
- **Category**: engineering
- **Owner**: Sentinel (/sentinel)
- **Default model**: sonnet
- **Cost class**: standard (Sonnet-class model. Default for most skills.)
- **Turn budget**: 10
- **Execution**: synchronous (result lands in the same turn)
- **Canonical URL**: https://app.51ultron.com/docs/skills/refactor-across-files

## What it does

Follows the string-editing/SKILL.md guidance: when editing literal strings that contain quotes, backslashes, or special characters across many files, sed corrupts the output. This capability uses bun -e (or shell_write per file) so the strings land verbatim. Best for renames, import-path migrations, API-key swaps, mass copy edits.

## When to use this

- user wants to rename a symbol across 10+ files
- user says 'replace every X with Y in /work' / 'change all imports from a to b'
- user is doing a mass edit involving quotes or template strings

## When NOT to use this

- user wants ONE file edited surgically → use shell_write or minimal-patch
- user wants to fix a single bug → use minimal-patch instead

## Example prompts

- `rename foo to bar across the whole codebase`
- `swap every @company/old-pkg import for @company/new-pkg`
- `change all API endpoints from /v1/ to /v2/`

## Inputs

- **target**: the symbol/string to find
- **replacement**: what to swap it with
- **scope**: glob pattern (default **/*)

## Output

Diff summary per file + total file count.

## Tools used

`shell_exec`, `shell_write`, `shell_read`

## Execution template

Shell tools dispatch through `shell_exec` with the following command template:

```bash
follow string-editing/SKILL.md; bun -e or per-file shell_write to swap {{target}} -> {{replacement}} across {{scope}}
```

## Tags

`engineering`, `refactor`

## Keywords

refactor, rename, mass edit, find replace, string editing, bulk update

