upgradeability-governance

Enforce ERC-7201 storage, initializer, and upgrade authorization rules in upgradeable Solidity contracts.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/IagoPrandi/zeroclaw-plugin --skill upgradeability-governance-iagoprandi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: upgradeability-governance
Source: https://github.com/IagoPrandi/zeroclaw-plugin/tree/main/.claude/skills/upgradeability-governance
Command: npx skills add https://github.com/IagoPrandi/zeroclaw-plugin --skill upgradeability-governance-iagoprandi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Upgradeable smart contracts can silently break through storage collisions, re-initialization bugs, or weakly protected upgrade functions, leading to loss of funds or bricked proxies. This Skill gives reviewers and developers a deterministic checklist to catch these risks before deployment. ## Core Features & Use Cases - Storage Safety Enforcement: Requires ERC-7201 namespaced storage and forbids relying on __gap as the primary collision mitigation. - Initializer & Authorization Discipline: Mandates _disableInitializers() in implementation constructors and role-gated _authorizeUpgrade() behind multisig or timelock. - Upgrade Testing & Change Control: Defines Foundry upgrade tests (state persistence, unauthorized upgrade reverts) and deployment record requirements per chainId. - Use Case: When a PR modifies a proxy contract's storage layout or deploy scripts, apply this Skill to verify namespaced storage, initializer safety, governance gating, and upgrade tests before merging. ## Quick Start Review this upgradeable contract pull request for ERC-7201 storage safety, initializer discipline, and _authorizeUpgrade governance protection.

Frequently Asked Questions about upgradeability-governance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely upgrade a Solidity proxy contract?▼

Use ERC-7201 namespaced storage for state isolation, protect _authorizeUpgrade() with an explicit role like UPGRADER_ROLE behind a multisig or timelock, and write Foundry tests proving state persists across the upgrade and unauthorized upgrades revert.

What is ERC-7201 namespaced storage and why use it?▼

ERC-7201 namespaced storage places each contract's state at a deterministic, uniquely derived storage slot to prevent collisions between implementation versions. It is preferred over __gap arrays as the primary collision mitigation strategy in upgradeable contracts.

Should upgradeable contracts use constructors or initializers?▼

Implementation contracts must not use constructors for state setup; they use initializer or reinitializer functions instead. The implementation's constructor should only call _disableInitializers() to prevent the logic contract itself from being initialized.

What tests are required before upgrading a smart contract?▼

Required Foundry tests verify the initializer runs once, state persists after upgrade, old storage slot values remain correct, and unauthorized upgrade attempts revert. Fuzz or invariant tests across the upgrade boundary are recommended.

Why is tx.origin forbidden for admin gating in contracts?▼

tx.origin identifies the original externally owned account of a transaction chain, making it vulnerable to phishing-style intermediary contract attacks. Admin gating must use msg.sender with explicit role checks such as UPGRADER_ROLE instead.