safe-refactor — solidity contract refactoring safe-refactor, morpho-vault-v2-adapters, community, solidity contract refactoring, ide skills, defi protocol development, ethereum contract optimization, morpho vault v2 adapters, safe-refactor install, Claude Code, Cursor

v1.0.0
GitHub

About this Skill

Perfect for Solidity Analysis Agents needing advanced code refactoring capabilities for Ethereum, Morpho, and Foundry protocols. safe-refactor is a skill that refactors non-upgradeable Solidity contracts to improve internal structure and maintainability without changing observable behavior.

Features

Refactors non-upgradeable Solidity contracts for improved clarity and maintainability
Supports Morpho vault v2 adapters for popular DeFi protocols
Ensures no changes to semantics, interfaces, or externally visible effects
Improves code readability and simplifies logic after behavior has been locked by tests
Prepares code for audit or review
Removes duplication and improves code organization

# Core Topics

mgnfy-view mgnfy-view
[1]
[0]
Updated: 1/28/2026

Agent Capability Analysis

The safe-refactor skill by mgnfy-view is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for solidity contract refactoring, defi protocol development, ethereum contract optimization.

Ideal Agent Persona

Perfect for Solidity Analysis Agents needing advanced code refactoring capabilities for Ethereum, Morpho, and Foundry protocols.

Core Value

Empowers agents to refactor non-upgradeable Solidity contracts, improving code clarity and maintainability without altering semantics, using protocols like Ethereum and leveraging tools such as Foundry.

Capabilities Granted for safe-refactor

Refactoring legacy Solidity contracts for better readability
Simplifying contract logic after locking behavior with tests
Preparing DeFi protocol code for audit or review

! Prerequisites & Limits

  • Limited to non-upgradeable Solidity contracts
  • Must not alter contract semantics or interfaces
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

safe-refactor

Install safe-refactor, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Skill: safe-refactor

Purpose

Refactor non-upgradeable Solidity contracts to improve clarity, maintainability, and internal structure without changing any observable behavior.

This skill is purely structural. It must not alter semantics, interfaces, or externally visible effects.

When to Invoke

  • Code cleanup
  • Duplication removal
  • Readability or maintainability improvements
  • Preparing code for audit or review
  • Simplifying logic after behavior has been locked by tests

Inputs Required

  • Target Solidity contracts
  • Existing test suite covering the affected behavior

Actions

Permitted actions include:

  • Extracting internal helper functions
  • Renaming variables and internal functions for clarity
  • Simplifying control flow without semantic change
  • Removing dead code or unreachable branches
  • Reorganizing code to follow repository layout conventions

Refactors must preserve:

  • execution order
  • revert behavior
  • event emission
  • state transitions
  • external call behavior

Constraints and Safety Rules

  • Must not change observable behavior
  • Must not change public or external APIs
  • Must not change custom errors or error parameters
  • Must not introduce or remove external calls
  • Must not introduce new dependencies
  • Must not modify storage semantics
  • Must comply with all rules in .codex/constraints/solidity-style.md
  • Tests must pass unchanged
  • No new tests may be added as justification for behavior changes

If a refactor would benefit from behavior changes, use a different skill.

Outputs

  • Refactored Solidity source files with identical behavior

Verification

  • forge build passes
  • forge test passes with no test changes
  • Behavior is identical under existing unit tests

Handoff

If refactoring reveals unclear or risky logic, consider:

  • security-review for deeper analysis
  • docs-generator to improve documentation without changing code

Example Prompts

  • “Use safe-refactor to simplify withdraw logic without changing behavior.”
  • “Refactor internal helpers in VaultMath for readability while preserving semantics.”

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is safe-refactor?

Perfect for Solidity Analysis Agents needing advanced code refactoring capabilities for Ethereum, Morpho, and Foundry protocols. safe-refactor is a skill that refactors non-upgradeable Solidity contracts to improve internal structure and maintainability without changing observable behavior.

How do I install safe-refactor?

Run the command: npx killer-skills add mgnfy-view/morpho-vault-v2-adapters/safe-refactor. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for safe-refactor?

Key use cases include: Refactoring legacy Solidity contracts for better readability, Simplifying contract logic after locking behavior with tests, Preparing DeFi protocol code for audit or review.

Which IDEs are compatible with safe-refactor?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for safe-refactor?

Limited to non-upgradeable Solidity contracts. Must not alter contract semantics or interfaces.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add mgnfy-view/morpho-vault-v2-adapters/safe-refactor. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use safe-refactor immediately in the current project.

Related Skills

Looking for an alternative to safe-refactor or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI