Refactorisation rapide avec MorphLLM

VérifiéSûr

Permet un refactoring sémantique rapide de code sur plusieurs fichiers via l'outil edit_file de MorphLLM. Idéale pour les changements à grande échelle comme les renommages en lot, les mises à jour de motifs et les refactorings structurels dans des fichiers de plus de 500 lignes ou avec 5+ modifications, avec une vitesse de 10 500+ tokens/s et une précision de fusion de 98 %.

Spar Skills Guide Bot
DeveloppementIntermédiaire
16002/06/2026
Claude Code
#refactoring#morphllm#batch-editing#semantic-merge

Recommandé pour

Notre avis

Utilise MorphLLM edit_file pour effectuer des refactorisations en lots sur plusieurs fichiers avec une fusion sémantique rapide et précise.

Points forts

  • Vitesse élevée de traitement (10 500 tok/s)
  • Précision de 98 % sur les cas complexes
  • Capacité de prévisualisation via dryRun
  • Idéal pour les modifications multi-fichiers

Limites

  • Nécessite une configuration préalable de l'outil MorphLLM
  • Les modifications sont appliquées sans diff détaillé à revoir
  • Peut échouer si le contexte fourni est insuffisant
Quand l'utiliser

Quand vous devez effectuer des refactorisations systématiques sur plusieurs fichiers (renommage, mise à jour de patterns, ajout de gestion d'erreurs).

Quand l'éviter

Pour des corrections simples et localisées dans un seul fichier, préférez l'édition intégrée avec diff visible.

Analyse de sécurité

Sûr
Score qualité90/100

The skill only uses code search and editing tools for refactoring, with no dangerous commands or data exfiltration.

Aucun point d'attention détecté

Exemples

Batch rename function across files
Rename the function `getUserById` to `findUser` in all files under src/repository that export it. Use MorphLLM edit_file for each file.
Add error wrapping to repository methods
Add error wrapping to all repository methods in src/repository/UserRepository.ts. Use WarpGrep to find methods, then call edit_file on that file with the instruction 'Add error wrapping to all repository methods' and provide the code_edit with updated methods.
Update imports from old-pkg to new-pkg
Update all imports that reference `old-pkg` to use `new-pkg` in src/components. Use WarpGrep to find occurrences, then use edit_file on each file to update the import statements.

name: refactoring-code description: Batch refactoring via MorphLLM edit_file. Use for "refactor across files", "batch rename", "update pattern everywhere", large files (500+ lines), or 5+ edits in same file. user-invocable: false allowed-tools:

  • mcp__morphllm__edit_file
  • mcp__morphllm__warpgrep_codebase_search
  • mcp__morphllm__codebase_search
  • Read
  • Grep
  • Glob

Fast Refactoring with MorphLLM

MorphLLM edit_file provides semantic code merging at 10,500+ tokens/sec with 98% accuracy.

When to Use edit_file

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

Key Features

  • Semantic merge: Understands code structure, not just text
  • Speed: 10,500 tok/s vs 180 tok/s streaming
  • Accuracy: 98% success rate on edge cases
  • dryRun: Preview changes before applying

Workflow

Standard Refactoring

1. Use WarpGrep to find all locations needing change
2. For each file: call edit_file with changes
3. Verify with lint/test

High-Stakes Changes (dryRun)

1. Call edit_file with dryRun: true
2. Review preview output
3. If approved, call again with dryRun: false

Parameters

path: "/absolute/path/to/file"
code_edit: "changed lines with // ... existing code ... markers"
instruction: "brief description of changes"
dryRun: false (set true to preview)

Edit Format

Use // ... existing code ... markers for unchanged sections:

// ... existing code ...
function updatedFunction() {
  // new implementation
}
// ... existing code ...

Common Patterns

Batch Error Handling

instruction: "Add error wrapping to all repository methods"
code_edit: Shows only changed functions with context markers

Import Updates

instruction: "Update imports from old-pkg to new-pkg"
code_edit: Shows import section with changes

Multi-Location Rename

instruction: "Rename getUserById to findUser throughout file"
code_edit: Shows all locations with changes

Tips

  • Batch all edits to same file in one call
  • Include enough context to locate changes precisely
  • Preserve exact indentation in code_edit
  • Use WarpGrep first to understand scope
  • Run tests after each file to catch issues early
Skills similaires