Proxy patterns for upgradeable smart contracts. Use when implementing or reviewing upgradeable contracts.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
Reference skill for proxy patterns in Solidity. Detailed proxy implementations are covered in the contract-patterns skill.
Use this skill when:
For detailed proxy implementations, see:
patterns/upgradeable-contracts.mdchecklists/upgrade-checklist.md| Pattern | Upgrade Location | Best For | Complexity |
|---|---|---|---|
| UUPS | Implementation | Most cases | Medium |
| Transparent | Proxy | Admin separation | Low |
| Beacon | Beacon contract | Multiple instances | High |
| Diamond | Facet contracts | Large contracts | Very High |
Recommended for most use cases
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
contract MyContract is UUPSUpgradeable, OwnableUpgradeable {
constructor() {
_disableInitializers();
}
function initialize() public initializer {
__Ownable_init(msg.sender);
__UUPSUpgradeable_init();
}
function _authorizeUpgrade(address) internal override onlyOwner {}
}
Pros:
Cons:
Detailed documentation: See contract-patterns/patterns/upgradeable-contracts.md
Use when admin/user separation is critical
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
// Deploy
TransparentUpgradeableProxy proxy = new TransparentUpgradeableProxy(
implementationAddress,
adminAddress,
initData
);
Pros:
Cons:
Detailed documentation: See contract-patterns/patterns/upgradeable-contracts.md
Use for multiple instances sharing implementation
import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
// Deploy beacon
UpgradeableBeacon beacon = new UpgradeableBeacon(implementationAddress);
// Deploy proxies
BeaconProxy proxy1 = new BeaconProxy(address(beacon), initData);
BeaconProxy proxy2 = new BeaconProxy(address(beacon), initData);
// Upgrade all
beacon.upgradeTo(newImplementation);
Pros:
Cons:
Detailed documentation: See contract-patterns/patterns/upgradeable-contracts.md
Use for contracts exceeding size limits
Complex pattern with multiple facets. See EIP-2535 for specification.
Critical for all proxy patterns:
// V1
contract V1 {
uint256 public value;
address public owner;
}
// V2 - ✅ Safe upgrade
contract V2 {
uint256 public value; // Same position
address public owner; // Same position
uint256 public newValue; // Added at end
}
// V2 - ❌ Unsafe upgrade
contract V2Bad {
address public owner; // ❌ Changed position
uint256 public value; // ❌ Changed position
}
Rules:
Choose UUPS if:
Choose Transparent if:
Choose Beacon if:
Choose Diamond if:
contract-patterns/patterns/upgradeable-contracts.mdsecurity-audit/checklists/upgrade-checklist.mdupgrade-safety/SKILL.mdcontract-patterns/examples/upgradeable-example.solNote: This is a reference skill. For detailed implementations and examples, see the contract-patterns skill.