Smart Contract Patterns
Updated May 29, 2026, 12:30 PM
Smart Contract Patterns
Smart Contract Patterns
The plugin includes a library of 45+ audited, gas-optimized Solidity patterns that Claude composes from when generating smart contracts. Rather than generating code from scratch every time, Claude selects and combines proven patterns -- resulting in more secure, efficient, and predictable output.
Pattern Categories
ERC-20 Tokens (10 patterns)
| Pattern | Description |
|---|---|
| Basic ERC-20 | Standard token with mint, burn, and transfer |
| Burnable | Deflationary token with manual or automatic burn |
| Taxable | Transfer tax with configurable fee routing |
| Reflection | Automatic yield distribution to holders via reflection |
| Governance | Voting-enabled token with delegation (ERC-20Votes) |
| Multi-Chain | Bridgeable token with cross-chain mint/burn mechanics |
| Capped Supply | Hard supply cap enforced at contract level |
| Pausable | Emergency pause functionality for transfers |
| Snapshot | Point-in-time balance snapshots for governance and airdrops |
| Fee-on-Transfer | Configurable buy/sell fees with LP and treasury routing |
NFTs (10 patterns)
| Pattern | Description |
|---|---|
| ERC-721 Basic | Standard NFT with metadata and enumeration |
| ERC-721A | Gas-optimized batch minting (Azuki standard) |
| Lazy Mint | Off-chain signature verification for gas-free creation |
| Soulbound (SBT) | Non-transferable identity and credential tokens |
| Dynamic NFT | On-chain metadata that evolves based on conditions |
| ERC-1155 Multi-Token | Semi-fungible tokens for games and editions |
| Revenue-Sharing | NFTs with built-in royalty distribution to holders |
| Allowlist Mint | Merkle proof-based allowlist for presale phases |
| On-Chain SVG | Fully on-chain generative art with SVG rendering |
| Composable NFT | Nested NFTs that can own other NFTs (ERC-6059) |
DeFi (10 patterns)
| Pattern | Description |
|---|---|
| Staking | Lock tokens, earn rewards over time |
| Vesting | Linear or cliff-based token vesting schedules |
| Bonding Curve | Algorithmic pricing based on supply |
| AMM | Constant-product automated market maker (x*y=k) |
| Flash Loans | Uncollateralized single-transaction loans |
| ERC-4626 Vault | Tokenized yield vault (standard vault interface) |
| Yield Aggregator | Multi-strategy vault with auto-compounding |
| Liquidity Pool | LP token minting/burning with fee accrual |
| Price Oracle | TWAP oracle with Uniswap V3 integration |
| Lending Pool | Collateralized lending with liquidation mechanics |
Governance (5 patterns)
| Pattern | Description |
|---|---|
| Governor | OpenZeppelin Governor with proposal lifecycle |
| Multi-Sig | M-of-N signature wallet for treasury management |
| DAO Treasury | Governed treasury with spending proposals and limits |
| Delegation | Vote delegation with weight tracking |
| Timelock Governor | Governor with mandatory execution delay |
Security (10 patterns)
| Pattern | Description |
|---|---|
| Access Control | Role-based permissions (RBAC) with admin hierarchy |
| Upgradeable (UUPS) | Proxy pattern with upgrade authorization |
| Timelock | Time-delayed execution for sensitive operations |
| Escrow | Conditional fund release with arbiter support |
| EIP-712 Signatures | Typed structured data signing for meta-transactions |
| Reentrancy Guard | Protection against reentrancy attacks |
| Rate Limiter | Transaction rate limiting per address |
| Emergency Stop | Circuit breaker pattern for critical failures |
| Allowlist | Address allowlisting with Merkle proof verification |
| Multi-Sig Guard | Require multiple signatures for high-value operations |
How Claude Uses Patterns
When you ask Claude to generate a smart contract, it does not start from a blank file. Instead, Claude:
- Analyzes your requirements -- identifies which patterns apply
- Selects base patterns -- picks the closest matching audited pattern(s)
- Composes and customizes -- combines patterns and adapts parameters to your specification
- Validates the output -- ensures the composed contract maintains the security and gas properties of the original patterns
Example
Prompt:
"Generate an ERC-20 token with a 2% buy tax, 1% sell tax, governance voting, and a hard cap of 100 million tokens."
Claude's approach:
- Starts with the Taxable ERC-20 pattern (buy/sell fee routing)
- Merges in the Governance pattern (ERC-20Votes delegation)
- Applies the Capped Supply pattern (hard cap enforcement)
- Customizes: sets buy tax to 2%, sell tax to 1%, cap to 100,000,000 tokens
- Outputs a single, coherent contract that inherits the audited logic from all three patterns
Why Patterns Matter
- Audited: Every pattern has been reviewed for common vulnerabilities -- reentrancy, overflow, access control gaps, and more.
- Gas-Optimized: Patterns use efficient storage layouts, batch operations, and minimal external calls. The ERC-721A pattern, for example, reduces batch mint gas by up to 90% compared to naive implementations.
- Composable: Patterns are designed to combine cleanly. Inheritance hierarchies, storage slots, and function signatures are structured to avoid conflicts when merging multiple patterns.
- Battle-Tested: Patterns reflect real-world deployment conventions used across major DeFi and NFT protocols.
Extending Patterns
You can ask Claude to modify any pattern or combine them in novel ways:
"Take the staking pattern but add an ERC-721 NFT boost -- stakers who hold an NFT from our collection get 2x rewards."
"Create an ERC-1155 marketplace with built-in royalty enforcement and a bonding curve for edition pricing."
Claude will compose from the relevant base patterns and generate the custom logic needed to connect them.