Skip to content
CLI Tools
Command

/refactor

Safely refactor code while maintaining functionality.

From plugin
mgrep
4.4k6 skills6 commands
> /plugin marketplace add mixedbread-ai/mgrep
> /plugin install mgrep@Mixedbread-Grep

Command definition

refactor.md

Refactor

Safely refactor code while maintaining functionality.

Arguments

  • `$ARGUMENTS` - Description of what to refactor and why

Steps

1. **Ensure test coverage**

  • Run existing tests: `pnpm test`
  • If coverage is insufficient, add tests first before refactoring

2. **Plan the refactoring**

  • Identify all files that will be affected
  • List the changes needed in each file
  • Consider breaking large refactors into smaller commits

3. **Make incremental changes**

  • Change one thing at a time
  • After each change, run: `pnpm typecheck`
  • Commit working states frequently

4. **Maintain backward compatibility** (if public API)

  • Keep function signatures the same where possible
  • If signatures must change, update all call sites

5. **Verify after completion**

  • Run full test suite: `pnpm test`
  • Run type check: `pnpm typecheck`
  • Run lint: `pnpm lint`

6. **Clean up**

  • Remove any dead code
  • Update imports if file paths changed
  • Update documentation if needed

7. **Commit with proper message**

  • Use format: `refactor(scope): description`
  • Keep refactoring commits separate from feature/fix commits
@mixedbread-ai
Ships withmgrep

A calm, CLI-native way to semantically grep everything, like code, images, pdfs and more.

Stars on GitHub

Momentum

stars in total
4.4k
Star history of mixedbread-ai/mgrep on GitHub, a chart by star-history.com

Other commands on mgrep.

More commands from other plugins.

canvas

canvas

Command

Spawn interactive terminal canvases for calendars, documents, and flight booking

@dvdsgl@dvdsglInstall Command
debug-logs

debug-logs

Command

Analyze claudish debug logs from a failed model run. Extracts SSE fixtures, diagnoses failures, adds regression tests.

@madappgang@madappgangInstall Command