ワンクリックで
rewrite-code
Use grepwrite gw to find matches, preview code rewrites, apply transactional edits with snapshots, and undo safely
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use grepwrite gw to find matches, preview code rewrites, apply transactional edits with snapshots, and undo safely
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use dfm to initialize dotfile backups, track files safely, sync private repositories, and review AI-suggested dotfile improvements
Work on llbbl/esm, a PHP enum-state-machine library, with its local quality gates and API constraints
Integrate llbbl/enum-state-machine into a PHP project with enum states, attribute transitions, guards, hooks, and validation
Integrate logan-logger into TypeScript apps with correct runtime imports, environment config, safe metadata, and validation
Use pkglock to switch package-lock.json between local npm registries and the public registry, and install safeguards against committing local URLs
Use repjan to audit GitHub repositories, review archive candidates, export decisions, and safely archive or unarchive repos
| name | rewrite-code |
| version | 0.1.0 |
| description | Use grepwrite gw to find matches, preview code rewrites, apply transactional edits with snapshots, and undo safely |
| allowed-tools | Bash, Read, Grep, Glob, Edit, MultiEdit, Write |
Use this skill when the user wants to use grepwrite (gw) for code search, safe regex or AST-aware rewrites, LLM-friendly output, transactional apply, snapshots, or undo.
Examples:
cargo install grepwrite
Confirm:
gw --help
gw wraps ripgrep-style search and adds a transactional rewrite layer with snapshots.
Find matches:
gw find 'pattern' src/
Use output formats deliberately:
gw find 'pattern' src/ -o compact
gw find 'pattern' src/ -o caveman
gw find 'pattern' src/ -o json
Use caveman when you need a token-minimal path:line list for an agent. Use json when scripting or post-processing.
AST-aware search:
gw find 'pattern' src/ --in function
gw find 'pattern' src/ --in class
gw find 'pattern' src/ --in imports
gw find 'pattern' src/ --in comments
Preview first. Rewrites are dry-run by default:
gw rewrite 'oldName' 'newName' src/ -o diff
Review the diff. If it is correct, apply:
gw rewrite 'oldName' 'newName' src/ --apply
Applied rewrites are atomic per file and wrapped in a git-ref snapshot. Record the snapshot ID in your notes when coordinating multi-step work.
List snapshots:
gw snapshots
Undo the latest snapshot:
gw undo
Undo a specific snapshot:
gw undo --snapshot SNAPSHOT_ID
gw undo refuses to clobber edits made after the snapshot. If undo fails, inspect the reported files and decide whether to revert manually.
--apply.src/ or a specific package.-o diff for human review and -o json for tooling.--apply, run the project’s relevant tests or type checks.Find candidate identifiers:
gw find '\boldName\b' src/ -o compact
Preview a rename:
gw rewrite '\boldName\b' 'newName' src/ -o diff
Apply after review:
gw rewrite '\boldName\b' 'newName' src/ --apply
Search imports only:
gw find 'old-package' src/ --in imports -o compact
After applied rewrites, run the target repo’s checks. Examples:
cargo test
pnpm test
go test ./...
just check
If validation fails, inspect the failure before using undo; sometimes the rewrite is correct and only a follow-up adjustment is needed.