KS
Killer-Skills

safe-refactor — how to use safe-refactor how to use safe-refactor, safe-refactor setup guide, safe-refactor vs foundry, solidity contract refactoring, defi protocol development, ethereum contract optimization, morpho vault v2 adapters, safe-refactor install, safe-refactor alternative

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

Quality Score

Top 5%
47
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add mgnfy-view/morpho-vault-v2-adapters/safe-refactor

Agent Capability Analysis

The safe-refactor MCP Server by mgnfy-view is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion. Optimized for how to use safe-refactor, safe-refactor setup guide, safe-refactor vs foundry.

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

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

Related Skills

Looking for an alternative to safe-refactor or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

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
Communication

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
Communication