Master Solidity smart contract development with patterns, testing, and best practices
Provides expert Solidity guidance covering modern patterns (CEI, Factory, Proxy), Foundry/Hardhat testing strategies, and production best practices for secure smart contract development.
/plugin marketplace add pluginagentmarketplace/custom-plugin-blockchain/plugin install custom-plugin-blockchain@pluginagentmarketplace-blockchainThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyMaster Solidity smart contract development with design patterns, testing strategies, and production best practices.
# Invoke this skill for Solidity development
Skill("solidity-development", topic="patterns", solidity_version="0.8.24")
Modern Solidity essentials:
Battle-tested patterns:
Comprehensive test strategies:
Safe upgrade patterns:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract SecureVault {
mapping(address => uint256) public balances;
error InsufficientBalance();
error TransferFailed();
function withdraw(uint256 amount) external {
// 1. CHECKS
if (balances[msg.sender] < amount) revert InsufficientBalance();
// 2. EFFECTS
balances[msg.sender] -= amount;
// 3. INTERACTIONS
(bool ok,) = msg.sender.call{value: amount}("");
if (!ok) revert TransferFailed();
}
}
contract TokenFactory {
event TokenCreated(address indexed token, address indexed owner);
function createToken(
string memory name,
string memory symbol
) external returns (address) {
Token token = new Token(name, symbol, msg.sender);
emit TokenCreated(address(token), msg.sender);
return address(token);
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import "forge-std/Test.sol";
contract VaultTest is Test {
Vault vault;
address alice = makeAddr("alice");
function setUp() public {
vault = new Vault();
vm.deal(alice, 10 ether);
}
function test_Deposit() public {
vm.prank(alice);
vault.deposit{value: 1 ether}();
assertEq(vault.balances(alice), 1 ether);
}
function testFuzz_Withdraw(uint256 amount) public {
amount = bound(amount, 0.01 ether, 10 ether);
vm.startPrank(alice);
vault.deposit{value: amount}();
vault.withdraw(amount);
vm.stopPrank();
assertEq(vault.balances(alice), 0);
}
function test_RevertWhen_InsufficientBalance() public {
vm.prank(alice);
vm.expectRevert(Vault.InsufficientBalance.selector);
vault.withdraw(1 ether);
}
}
| Pattern | Use Case | Complexity |
|---|---|---|
| CEI | All state changes | Low |
| Factory | Multiple instances | Low |
| Clone (1167) | Gas-efficient copies | Medium |
| UUPS | Upgradeable | Medium |
| Diamond | Unlimited size | High |
| Pitfall | Issue | Solution |
|---|---|---|
| Stack too deep | >16 variables | Use structs or helpers |
| Contract too large | >24KB | Split into libraries |
| Reentrancy | State after call | Use CEI pattern |
| Missing access | Anyone can call | Add modifiers |
// Solution 1: Use struct
struct Params { uint256 a; uint256 b; uint256 c; }
// Solution 2: Block scoping
{ uint256 temp = x + y; }
// Solution 3: Internal function
function _helper(uint256 a) internal { }
# Check contract sizes
forge build --sizes
Solutions: Split into libraries, use Diamond pattern.
# Development workflow
forge init # New project
forge build # Compile
forge test -vvv # Run tests
forge coverage # Coverage report
forge fmt # Format code
forge snapshot # Gas snapshot
03-solidity-expertethereum-development, smart-contract-security| Version | Date | Changes |
|---|---|---|
| 2.0.0 | 2025-01 | Production-grade with Foundry, patterns |
| 1.0.0 | 2024-12 | Initial release |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.