openzeppelin

Implements secure Solidity smart contracts using OpenZeppelin Contracts v5 libraries and patterns.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill openzeppelin-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openzeppelin
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/openzeppelin
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill openzeppelin-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @openzeppelin/contracts, @openzeppelin/contracts-upgradeable, @openzeppelin/defender-sdk, and includes references (resource) components.

What problem does it solve? LLM training data largely reflects OpenZeppelin v4, so generated Solidity code often fails to compile against v5 due to breaking changes like mandatory Ownable constructor arguments, removed SafeMath and Counters libraries, renamed _update hooks, and moved import paths. This Skill provides correct, current v5 patterns for tokens, access control, security utilities, and upgradeable contracts. ## Core Features & Use Cases - Token Implementations: Production-ready ERC-20 (Permit, Votes, Capped, Pausable), ERC-721 (Enumerable, URIStorage, ERC2981 royalties), and ERC-1155 contracts with correct v5 override resolution. - Access Control: Ownable, Ownable2Step, AccessControl role hierarchies, AccessControlDefaultAdminRules, and the v5 AccessManager centralized permission hub. - Upgradeable Contracts: Full UUPS lifecycle with Initializable, reinitializer, storage gap management, ERC1967Proxy deployment, and Foundry upgrade test scripts. - Security Utilities: ReentrancyGuard, Pausable, SafeERC20 with forceApprove for non-standard tokens like USDT, plus a v4-to-v5 migration guide and troubleshooting reference. - Use Case: Ask for a governance token with gasless approvals and vote delegation, and receive a complete ERC20Permit + ERC20Votes contract with the required nonces diamond-resolution override, plus a Governor and TimelockController deployment script. ## Quick Start Write an upgradeable ERC-20 token contract with permit, votes, and owner-controlled minting using OpenZeppelin v5, including the Foundry deployment script.

Frequently Asked Questions about openzeppelin

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

FAQPage Schema
How do I create an ERC-20 token with OpenZeppelin v5?

Inherit from ERC20 and call _mint in the constructor with the desired supply. Add extensions like ERC20Burnable, ERC20Permit, or ERC20Votes, then resolve diamond inheritance by overriding _update and nonces with explicit super calls.

How do I make an upgradeable smart contract with UUPS?

Use the @openzeppelin/contracts-upgradeable package with Initializable, UUPSUpgradeable, and OwnableUpgradeable. Call _disableInitializers in the constructor, move setup logic to an initialize function, deploy behind an ERC1967Proxy, and gate _authorizeUpgrade with onlyOwner.

What changed from OpenZeppelin v4 to v5?

Ownable now requires an initial owner constructor argument, SafeMath and Counters were removed, _beforeTokenTransfer was replaced by _update, _setupRole became _grantRole, and Pausable and ReentrancyGuard moved from security/ to utils/ import paths.

Why does my Ownable contract fail to compile in v5?

OpenZeppelin v5 removed the default owner, so the Ownable constructor requires an explicit initial owner address. Write constructor(address initialOwner) Ownable(initialOwner) instead of an empty constructor.

Does OpenZeppelin v5 support ERC721Enumerable?

Yes, but v5 requires overriding both _update and _increaseBalance when combining ERC721Enumerable with other extensions, plus supportsInterface. Omitting _increaseBalance causes a compilation error.

Why does my upgradeable contract revert with InvalidInitialization?

The initializer modifier can only run once, and the implementation contract must call _disableInitializers in its constructor. For upgrades, use reinitializer(2) or higher for version-specific initialization instead of initializer.