diamond-pattern

Coordinate modular Solidity contract upgrades using the EIP-2535 Diamond pattern.

120|12|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ccashwell/evm-cortex --skill diamond-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: diamond-pattern
Source: https://github.com/ccashwell/evm-cortex/tree/main/skills/diamond-pattern
Command: npx skills add https://github.com/ccashwell/evm-cortex --skill diamond-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solidity contracts are constrained by size, upgradeability, and deployment risk. The Diamond pattern enables splitting logic into multiple facets that share a single storage context, allowing selective upgrades and easier maintenance.

Core Features & Use Cases

  • Per-facet upgradeability: upgrade individual functions without redeploying the whole contract.
  • Shared storage: all facets operate on a single AppStorage/ DiamondStorage layout.
  • Introspection: DiamondLoupe-based discovery of facets and function selectors.
  • Real-world use cases: modular governance, token registries, extendable protocols.

Quick Start

Demonstrate a Diamond pattern upgrade by wiring a DiamondCut to add a new facet to a test contract.

Frequently Asked Questions about diamond-pattern

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

FAQPage Schema
How do I upgrade individual functions in a Solidity contract without redeploying the entire protocol?

The EIP-2535 Diamond pattern solves Solidity contract size limits and upgradeability risks by splitting logic into multiple facets. These facets share a single storage context, enabling selective upgrades and easier maintenance for complex protocols.

How does shared storage work across multiple facets in a Diamond pattern contract?

Use the EIP-2535 Diamond pattern for complex protocols requiring multi-facet organization. It provides per-function upgrades, shared storage across facets, and introspection via DiamondLoupe, making it ideal for modular governance and extendable protocols.

How do I discover which facets and function selectors are attached to a Diamond contract?

Wire a DiamondCut action to add a new facet to a Solidity test contract. This demonstrates the Diamond pattern upgrade workflow by executing a diamondCut that registers the new facet's function selectors onto the target contract.

When should I use the Diamond pattern over standard upgradeable contracts for Solidity protocols?

The Diamond pattern requires coordinating modular upgrade workflows through structured AppStorage or DiamondStorage layouts. Deploying facets individually introduces complexity, so facet-level upgrade actions must be carefully managed to prevent storage collisions.