Agent skill

Upgrade Safety

by ccashwell in ccashwell/evm-cortex

Upgrade vulnerability detection and prevention for Solidity proxy contracts.

MITAuto-check passedBackend & APIs

Install Upgrade Safety

skills CLI
$ npx skills add ccashwell/evm-cortex --skill upgrade-safety -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ccashwell/evm-cortex upgrade-safety --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/upgrade-safety .claude/skills/upgrade-safety && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
upgrade-safety
GitHub stars
131
Token cost
~1.7k tokens
SKILL.md length
216 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Upgrade vulnerability detection and prevention for Solidity proxy contracts.

  • Implementing UUPS
  • SKILL.md covers Uninitialized Proxy, Storage Collision, Selfdestruct in Implementation and Initializer Reentrancy, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Diamond proxy patterns

What it does

Upgrade Safety is an agent skill from ccashwell/evm-cortex. Upgrade vulnerability detection and prevention for Solidity proxy contracts. Use when implementing UUPS, Transparent, or Diamond proxy patterns. Covers uninitialized proxy attacks, storage collisions, selector clashing, and upgrade safety validation tools.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Smart contracts. It works with Solidity and OpenZeppelin. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Implementing UUPS
  • Diamond proxy patterns

Example prompts

  • “/upgrade-safety”

What it can do on your machine

Read from SKILL.md and the folder at commit f8f3301. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are solidity and bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Upgrade Safety loads about 1.7k tokens when it runs. Until then it costs about 68 tokens; SKILL.md has 216 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ccashwell/evm-cortex at commit f8f3301, republished under its MIT licence (© ccashwell). 216 words, ~1,715 tokens.

Download SKILL.mdSave it as .claude/skills/upgrade-safety/SKILL.md (or your agent's skills folder).
name
upgrade-safety
description
Upgrade vulnerability detection and prevention for Solidity proxy contracts. Use when implementing UUPS, Transparent, or Diamond proxy patterns. Covers uninitialized proxy attacks, storage collisions, selector clashing, and upgrade safety validation tools.

Upgrade Safety

Uninitialized Proxy

The most common upgrade vulnerability. If initialize() isn't called on the proxy immediately after deployment, an attacker can front-run and take ownership.

solidity
// VULNERABLE: deployment and initialization are separate transactions
// Deploy proxy → attacker calls initialize() before admin
proxy = new ERC1967Proxy(implementation, "");
// ...gap where attacker calls initialize()...
VaultV1(proxy).initialize(admin);

// SAFE: initialize in the deployment transaction
bytes memory initData = abi.encodeCall(VaultV1.initialize, (admin));
proxy = new ERC1967Proxy(implementation, initData);
Disable Initializers on Implementation
solidity
contract VaultV1 is Initializable, OwnableUpgradeable {
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize(address admin) external initializer {
        __Ownable_init(admin);
    }
}

Storage Collision

Upgrading with a mismatched storage layout corrupts state.

solidity
// V1 Layout
contract VaultV1 {
    address public owner;       // slot 0
    uint256 public totalSupply; // slot 1
    uint256[48] private __gap;
}

// V2 BAD: inserted variable
contract VaultV2Bad {
    address public owner;       // slot 0
    address public treasury;    // slot 1 ← WAS totalSupply!
    uint256 public totalSupply; // slot 2 ← shifted, reads __gap[0]
    uint256[47] private __gap;
}

// V2 GOOD: appended variable
contract VaultV2Good {
    address public owner;       // slot 0
    uint256 public totalSupply; // slot 1
    address public treasury;    // slot 2 ← new, was __gap[0]
    uint256[47] private __gap;  // reduced from 48 to 47
}
Verify with Forge
bash
# Compare storage layouts between versions
forge inspect src/VaultV1.sol:VaultV1 storage-layout --pretty > layout-v1.txt
forge inspect src/VaultV2.sol:VaultV2 storage-layout --pretty > layout-v2.txt
diff layout-v1.txt layout-v2.txt

Selfdestruct in Implementation

Pre-Dencun, if the implementation contract contained selfdestruct and an attacker could trigger it, all proxies pointing to that implementation would be bricked.

solidity
// DANGEROUS: never include selfdestruct in implementations
contract BadImpl {
    function destroy() external onlyOwner {
        selfdestruct(payable(owner)); // bricks all proxies
    }
}

// Post-Dencun (EIP-6780): selfdestruct only sends ETH unless in the
// same transaction as creation. Still, never use it in implementations.

Initializer Reentrancy

OpenZeppelin's initializer modifier includes reentrancy protection since v4.x. But custom initializers might not.

solidity
// VULNERABLE: custom initializer without reentrancy protection
bool private _initialized;

function initialize(address admin) external {
    require(!_initialized);
    // External call before setting _initialized
    ICallback(admin).onInitialize(); // can re-enter initialize()
    _initialized = true;
}

// SAFE: use OpenZeppelin's Initializable
function initialize(address admin) external initializer {
    // modifier prevents reentrancy
}

Missing Storage Gaps

Base contracts without __gap cannot be extended in future versions without breaking derived contracts.

solidity
// BAD: no gap in base contract
abstract contract BaseV1 {
    uint256 public value;
    // no __gap — adding variables here shifts derived contract storage
}

contract DerivedV1 is BaseV1 {
    uint256 public derivedValue; // slot 1
}

// GOOD: gap in base contract
abstract contract BaseV1 {
    uint256 public value;
    uint256[49] private __gap;
}

// Now BaseV2 can safely add variables:
abstract contract BaseV2 {
    uint256 public value;
    uint256 public newValue; // uses first __gap slot
    uint256[48] private __gap;
}

Function Selector Clashing

Proxy admin functions and implementation functions can have the same selector.

solidity
// TransparentUpgradeableProxy solves this by routing:
// - Admin calls → proxy logic (upgrade, admin functions)
// - Non-admin calls → delegated to implementation

// UUPS: implementation must include upgradeTo function
// Risk: implementation function selector collides with ERC-1967 functions

// Check selectors:
// upgradeTo(address) → 0x3659cfe6
// Ensure no implementation function has selector 0x3659cfe6
bash
# Detect selector collisions
forge inspect src/Vault.sol:Vault methodIdentifiers | sort
forge inspect src/Proxy.sol:Proxy methodIdentifiers | sort
# Compare for duplicates

UUPS Upgrade Authorization

UUPS proxies delegate upgrade authorization to the implementation. If a new implementation forgets _authorizeUpgrade, the proxy becomes un-upgradeable.

solidity
import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

contract VaultV1 is UUPSUpgradeable, OwnableUpgradeable {
    function _authorizeUpgrade(address newImplementation)
        internal
        override
        onlyOwner
    {
        // Can add additional validation here
        // e.g., check newImplementation supports expected interface
    }
}

// V2 MUST also include _authorizeUpgrade
// If omitted, proxy is permanently locked to V2
contract VaultV2 is UUPSUpgradeable, OwnableUpgradeable {
    function _authorizeUpgrade(address newImplementation)
        internal
        override
        onlyOwner
    {}
}

OpenZeppelin Upgrades Plugin

bash
# Foundry: use forge-upgrades
forge install OpenZeppelin/openzeppelin-foundry-upgrades

# In tests: validate upgrade safety
import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";

function testUpgradeSafety() public {
    Upgrades.validateUpgrade("VaultV2.sol:VaultV2", referenceContract);
}

Upgrade Safety Checklist

  • _disableInitializers() in implementation constructor
  • Proxy deployment includes initialization data (single transaction)
  • Storage layout diffed between versions (forge inspect)
  • New variables only appended, never inserted
  • __gap reduced by correct amount
  • Inheritance order unchanged between versions
  • No selfdestruct in implementation
  • UUPS: _authorizeUpgrade present in ALL versions
  • Selector collision check between proxy and implementation
  • reinitializer(n) used for V2+ initialization (not initializer)
  • Upgrade tested on mainnet fork before deployment
  • Timelock on upgrade function (production)
  • OpenZeppelin Upgrades plugin validation passes

© ccashwell, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/upgrade-safety of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Upgrade Safety next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Upgrade Safety compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Upgrade Safety this skillccashwell/evm-cortex131—~1.7kAutomated safety check: PassMIT
Fizz Convertpashov/skills1.2k2 repos~3.7kAutomated safety check: PassMIT
Feynman Auditor0xiehnnkta/nemesis-auditor2431 repos~11kAutomated safety check: PassMIT
Smart Contract Auditgreatpie/smart-contract-audit-skill101—~1.1kAutomated safety check: PassNone
RadarAuditware/radar154—~2.1kAutomated safety check: PassGPL-3.0
Solidity AuditorGabson0x/bountyforge442—~3.7kAutomated safety check: PassNone

Similar skills

  • Fizz Convert

    pashov/skills

    Convert English-language properties in PROPERTIES.md (produced by the Fizz skill) into Solidity assertions inside the existing fuzz harness, then flip their checkboxes.

    1.2k GitHub starsUsed in 2 repos~3.7k tokens
    Backend & APIsAuto-check passed
  • Feynman Auditor

    0xiehnnkta/nemesis-auditor

    Deep business logic bug finder using the Feynman technique. An agent skill from 0xiehnnkta/nemesis-auditor.

    243 GitHub starsUsed in 1 repo~11k tokens
    Backend & APIsAuto-check passed
  • Smart Contract Audit

    greatpie/smart-contract-audit-skill

    Script-backed, out-of-box auditing workflow for Solidity/EVM repositories based on EVMbench detect/patch/exploit methodology.

    101 GitHub stars~1.1k tokensUpdated 7 mo ago
    Backend & APIsAuto-check passed
  • Radar

    Auditware/radar

    Use radar for smart contract security analysis, AST generation, and detection template development.

    154 GitHub stars~2.1k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Solidity Auditor

    Gabson0x/bountyforge

    Security audit of Solidity code while you develop. An agent skill from Gabson0x/bountyforge.

    442 GitHub stars~3.7k tokensUpdated 23 days ago
    Backend & APIsAuto-check passed
  • Stellar iOS Mac SDK

    Soneso/stellar-ios-mac-sdk

    Guides Stellar blockchain development in Swift using stellar-ios-mac-sdk.

    132 GitHub stars~4.3k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed

More from ccashwell/evm-cortex

All 89 skills in this repo
  • Xray Pre Audit

    ccashwell/evm-cortex

    A skill your agent uses when preparing for a security audit, performing reconnaissance on a new codebase, or creating a protocol overview.

    131 GitHub stars~25k tokensUpdated 10 days ago
    Auto-check passed
  • Aave Integration

    ccashwell/evm-cortex

    A skill your agent uses when integrating with Aave V3 for lending, borrowing, flash loans, or building on top of Aave markets.

    131 GitHub stars~1.3k tokensUpdated 10 days ago
    Auto-check passed
  • Access Control Patterns

    ccashwell/evm-cortex

    Access control design patterns for Solidity protocols. An agent skill from ccashwell/evm-cortex.

    131 GitHub stars~1.8k tokensUpdated 10 days ago
    Auto-check passed
  • Anvil Patterns

    ccashwell/evm-cortex

    A skill your agent uses when running a local Ethereum node with Anvil.

    131 GitHub stars~1.3k tokensUpdated 10 days ago
    Auto-check passed
  • Audit Breadth Scan

    ccashwell/evm-cortex

    A skill your agent uses when performing systematic breadth-first review of all contracts during a security audit.

    131 GitHub stars~1.4k tokensUpdated 10 days ago
    Auto-check passed
  • Audit Depth Analysis

    ccashwell/evm-cortex

    A skill your agent uses when performing deep analysis of specific findings or high-risk areas during a security audit.

    131 GitHub stars~1.6k tokensUpdated 10 days ago
    Auto-check passed

Categories

Questions about Upgrade Safety

What does Upgrade Safety do?

Upgrade vulnerability detection and prevention for Solidity proxy contracts. Upgrade Safety is an agent skill from ccashwell/evm-cortex. Upgrade vulnerability detection and prevention for Solidity proxy contracts.

When should I use Upgrade Safety?

Upgrade Safety fits situations like: implementing UUPS; diamond proxy patterns.

How do I install Upgrade Safety in Claude Code?

Run `npx skills add ccashwell/evm-cortex --skill upgrade-safety -a claude-code`. Or copy the skill folder (skills/upgrade-safety in ccashwell/evm-cortex) into .claude/skills/upgrade-safety in your project. Claude Code loads it when a task matches its description.

How do I install Upgrade Safety in Codex?

Run `npx skills add ccashwell/evm-cortex --skill upgrade-safety -a codex`. Or copy the skill folder (skills/upgrade-safety in ccashwell/evm-cortex) into .agents/skills/upgrade-safety in your project. Codex loads it when a task matches its description.

Can I use Upgrade Safety in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ccashwell/evm-cortex --skill upgrade-safety -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/upgrade-safety, .gemini/skills/upgrade-safety, .github/skills/upgrade-safety and .opencode/skills/upgrade-safety in your project.

What does Upgrade Safety need to run?

SKILL.md names no scripts, command-line tools or credentials: Upgrade Safety is instructions for the agent only.

Does Upgrade Safety access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Upgrade Safety safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Upgrade Safety use?

Upgrade Safety is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Upgrade Safety use?

About 1.7k tokens (SKILL.md is roughly 6.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Upgrade Safety?

Skills that share tags, products or a category with Upgrade Safety: Fizz Convert (pashov/skills, 1.2k stars), Feynman Auditor (0xiehnnkta/nemesis-auditor, 243 stars), Smart Contract Audit (greatpie/smart-contract-audit-skill, 101 stars) and Radar (Auditware/radar, 154 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Upgrade Safety?

ccashwell (a GitHub user) maintains it in ccashwell/evm-cortex, which has 131 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on September 30, 2026.

Source: ccashwell/evm-cortex on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.