plugins/dev-workflow/skills-codex/refactoring-code/SKILL.md
Batch refactoring via MorphLLM edit_file. Use for "refactor across files", "batch rename", "update pattern everywhere", large files (500+ lines), 5+ edits in same file, or applying an approved architecture-deepening refactor.
npx skillsauth add alexei-led/claude-code-config refactoring-codeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
MorphLLM edit_file provides semantic code merging at 10,500+ tokens/sec with 98% accuracy. Use the MorphLLM edit_file / batch refactoring workflow for broad changes. Refactoring here means behavior-preserving change or architecture deepening, not cosmetic churn.
Critical rule: preserve existing behavior unless the user explicitly asks for a behavior change. State the preservation target before editing.
| Use edit_file | Use Built-in Edit/MultiEdit | | ------------------------------- | -------------------------------- | | Multi-file batch refactoring | Single file, clear edit | | Style/pattern update everywhere | 2-3 targeted replacements | | Complex prompt → many changes | Need clear diff to review/tune | | Structural refactoring at scale | Simple rename (replace_all) | | 5+ files need same pattern | Straightforward single-file work |
When the request is architectural, use this vocabulary:
Apply the deletion test before editing: if deleting a module makes complexity vanish, it was a pass-through. If complexity reappears across callers, the module was earning its keep.
Seam rule: one adapter means a hypothetical seam; two adapters means a real seam. Do not add interfaces without real variation.
Read relevant CONTEXT.md, CONTEXT-MAP.md, and ADRs when present. Preserve domain names.
1. Use WarpGrep or semantic search to find all locations needing change
2. State: "Behavior must be preserved unless the user explicitly requested a behavior change."
3. Use MorphLLM `edit_file` or the batch refactoring workflow for each batch/file, grouping related edits
4. Batch all edits for the same file into one edit operation
5. Verify with lint/test
6. Delete obsolete shallow tests once deeper interface tests cover the behavior
For multi-file renames, say this is a batch refactor, map all occurrences before editing, use the batch refactoring tool/workflow by name, preserve behavior, and run relevant lint/tests after the rename.
1. Call edit_file with dryRun: true
2. Review preview output
3. If approved, call again with dryRun: false
path: "/absolute/path/to/file"
code_edit: "changed lines with // ... existing code ... markers"
instruction: "brief description of changes"
dryRun: false (set true to preview)
Use // ... existing code ... markers for unchanged sections:
// ... existing code ...
function updatedFunction() {
// new implementation
}
// ... existing code ...
instruction: "Add error wrapping to all repository methods"
code_edit: Shows only changed functions with context markers
instruction: "Update imports from old-pkg to new-pkg"
code_edit: Shows import section with changes
instruction: "Rename getUserById to findUser throughout file"
code_edit: Shows all locations with changes
tools
Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`, `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, TypeScript, Go, web code, or infrastructure operations.
tools
Use when planning, executing, checkpointing, finishing, or inspecting lightweight spec-driven work. Runs one task at a time using `.spec/` markdown files and the bundled `specctl` helper. NOT for broad product discovery beyond a short requirement interview.
testing
Author, inspect, troubleshoot, and review infrastructure across IaC, Kubernetes, cloud resources, containers, CI/CD, and Linux hosts. Use when changing Terraform/OpenTofu, Kubernetes, Helm, Kustomize, Dockerfiles, GitHub Actions, AWS, GCP, Cloud Run, BigQuery, IAM, logs, instances, or service health. NOT for deploy/apply/rollback workflows (see deploying-infra). NOT for shell scripts or generic command pipelines (see writing-shell).
development
Configure safe git workflow hygiene: pre-commit/pre-push hooks, Gitleaks secret scanning, .gitignore rules, local git config, and guardrails. Use when setting up git hooks, gitleaks/git leaks, staged pre-commit checks, pre-push validation, core.hooksPath, .gitignore, or git config best practices. NOT for creating commits (use committing-code), cleaning branches/worktrees (use cleanup-git), or creating worktrees (use using-git-worktrees).