zizhilong

evm-developer

0
0
# Install this skill:
npx skills add zizhilong/evm-developer-skill

Or install specific skill: npx add-skill https://github.com/zizhilong/evm-developer-skill

# Description

Comprehensive Solidity smart contract development and deployment workflow for EVM-compatible chains. Handles project creation, contract development, compilation, testing, deployment, and verification with structured project management.

# SKILL.md


name: evm-developer
description: Comprehensive Solidity smart contract development and deployment workflow for EVM-compatible chains. Handles project creation, contract development, compilation, testing, deployment, and verification with structured project management.


EVM Developer Skill

This skill provides a complete workflow for developing, testing, and deploying Solidity smart contracts on EVM-compatible blockchains with proper project structure and documentation.

Core Capabilities

  • Smart Contract Development: Write Solidity contracts with best practices and security patterns
  • Project Management: Structured project organization with templates and documentation
  • Deployment Pipeline: Automated deployment to multiple networks with complete tracking
  • Contract Verification: Automatic verification on block explorers
  • ABI Management: Automatic extraction and organization of contract ABIs
  • Security Best Practices: Built-in security patterns and checks

Development Workflow

1. Initial Assessment

When a user requests smart contract development:

  1. Check for Existing Project: Ask if this is a new project or modification to existing one
  2. If New Project: Initiate requirements gathering
  3. If Existing: List available projects in projects/ directory and ask which to work on

2. Requirements Gathering (New Projects Only)

Ask the following questions systematically:

Basic Information

  • Project Name: What should the project be called? (will be used as directory name)
  • Project Description: Brief description of the project's purpose

Contract Type

  • ERC20 Token
  • ERC721 NFT
  • ERC1155 Multi-Token
  • DeFi Protocol (DEX/Staking/Lending)
  • DAO Governance
  • Custom Contract Logic

Feature Requirements

  • Core Functions: What are the main functions needed?
  • Access Control:
  • [ ] Ownable (single owner)
  • [ ] AccessControl (role-based)
  • [ ] No special permissions
  • Security Features:
  • [ ] Pausable (emergency stop)
  • [ ] ReentrancyGuard (prevent reentrancy attacks)
  • [ ] Upgradeable (proxy pattern)
  • Additional Features: Any other specific requirements

Technical Parameters

  • Solidity Version: Default to ^0.8.20 unless specified
  • Use OpenZeppelin: Yes (recommended) / No
  • Gas Optimization Level: Low / Medium / High

Deployment Target

  • Target Blockchain: Ethereum / BSC / Polygon / Arbitrum / Optimism / Other
  • Network Type: Mainnet / Testnet / Local
  • Verification Required: Yes / No

3. Project Initialization

For new projects, execute the following steps:

  1. Create Project Directory Structure:
    projects/<project-name>/ ├── README.md ├── requirements.md ├── contracts/ ├── scripts/ │ └── deploy.js ├── test/ ├── abi/ ├── deployments/ ├── hardhat.config.js ├── package.json └── .env.example

  2. Initialize Hardhat Project:
    bash cd projects/<project-name> npm init -y npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox npm install @openzeppelin/contracts dotenv

  3. Generate Requirements Document: Create requirements.md from gathered information

  4. Update Project Index: Add entry to projects/README.md

4. Contract Development

  1. Write Solidity Code: Create contracts following conventions in references/conventions.md

  2. Apply Security Patterns:

  3. Use Checks-Effects-Interactions pattern
  4. Add ReentrancyGuard for external calls
  5. Include proper access control
  6. Add events for all state changes
  7. Use NatSpec documentation

  8. Compile Contract:
    bash npx hardhat compile

  9. Extract ABI: After successful compilation, copy ABI from artifacts/contracts/<ContractName>.sol/<ContractName>.json to abi/<ContractName>.json

5. Testing

  1. Generate Test File: Create basic test in test/<ContractName>.test.js
  2. Run Tests:
    bash npx hardhat test
  3. Ensure Coverage: All core functions should be tested

6. Deployment

  1. Configure Network: Update hardhat.config.js with target network settings

  2. Set Environment Variables: Guide user to create .env file:
    PRIVATE_KEY=<deployer_private_key> SEPOLIA_RPC_URL=<rpc_url> ETHERSCAN_API_KEY=<api_key>

  3. Execute Deployment:
    bash npx hardhat run scripts/deploy.js --network <network_name>

  4. Record Deployment Information: Save to deployments/<network>.json with format:
    json { "projectName": "ProjectName", "contractName": "ContractName", "solFileName": "ContractName.sol", "deployments": [{ "network": "sepolia", "chainId": 11155111, "contractAddress": "0x...", "deployer": "0x...", "deploymentTx": "0x...", "blockNumber": 123456, "timestamp": "2026-02-02T03:00:00.000Z", "gasUsed": "500000", "verified": false, "constructorArgs": [], "notes": "Initial deployment" }] }

7. Contract Verification

  1. Verify on Block Explorer:
    bash npx hardhat verify --network <network> <contract_address> <constructor_args>

  2. Update Deployment Record: Set verified: true and add verificationUrl

  3. Update Project README: Add deployment information and contract addresses

8. Project Documentation

After deployment, ensure the following are updated:

  1. Project README: Include contract addresses, network info, and usage instructions
  2. Project Index (projects/README.md): Update with deployment status
  3. Deployment History: Maintain complete deployment records

Development Standards

Naming Conventions

  • Contracts: PascalCase (e.g., MyToken, NFTMarketplace)
  • Functions: camelCase (e.g., transferFrom, mintToken)
  • Constants: UPPER_SNAKE_CASE (e.g., MAX_SUPPLY, MINTER_ROLE)
  • Private Variables: _leadingUnderscore (e.g., _balances, _owner)
  • Files: Match contract name (e.g., MyToken.sol)

File Organization

  • One contract per file
  • Interfaces in contracts/interfaces/
  • Libraries in contracts/libraries/
  • Abstract contracts in contracts/abstract/

Code Documentation

  • All public/external functions must have NatSpec comments
  • Complex logic requires inline comments
  • Contract-level documentation with license and description

Example:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/// @title MyToken
/// @notice ERC20 token with pausable functionality
/// @dev Extends OpenZeppelin's ERC20 and Pausable contracts
contract MyToken is ERC20, Pausable, Ownable {
    /// @notice Mints new tokens to specified address
    /// @dev Only owner can mint
    /// @param to Address to receive tokens
    /// @param amount Amount of tokens to mint
    function mint(address to, uint256 amount) external onlyOwner {
        _mint(to, amount);
    }
}

Security Checklist

Before deployment, verify:

  • [ ] No reentrancy vulnerabilities (use ReentrancyGuard)
  • [ ] Proper access control (Ownable/AccessControl)
  • [ ] Integer overflow protection (use Solidity 0.8+)
  • [ ] External calls checked for failures
  • [ ] Events emitted for state changes
  • [ ] No use of tx.origin for authentication
  • [ ] Randomness uses secure method (if applicable)
  • [ ] Gas optimization considerations applied
  • [ ] All functions have proper visibility
  • [ ] Private keys never hardcoded

Gas Optimization Patterns

  • Use calldata instead of memory for read-only function parameters
  • Pack storage variables efficiently
  • Use events instead of storage for logs
  • Batch operations when possible
  • Use unchecked for safe arithmetic (carefully)
  • Short-circuit boolean operations

Network Configuration

Common EVM networks:

Testnets

  • Ethereum Sepolia: ChainID 11155111
  • Polygon Mumbai: ChainID 80001
  • BSC Testnet: ChainID 97
  • Arbitrum Sepolia: ChainID 421614
  • Optimism Sepolia: ChainID 11155420

Mainnets

  • Ethereum: ChainID 1
  • Polygon: ChainID 137
  • BSC: ChainID 56
  • Arbitrum One: ChainID 42161
  • Optimism: ChainID 10

Error Handling

When compilation or deployment fails:

  1. Parse Error Messages: Extract relevant information
  2. Suggest Fixes: Based on common patterns
  3. Retry: After fixes are applied
  4. Log Issues: Document in project for reference

Automation Tools

This skill uses helper scripts in scripts/:

  • create-project.js: Automates project creation
  • deploy-helper.js: Streamlines deployment and record keeping
  • verify-contract.js: Automates contract verification

Resources

Best Practices

  1. Always test locally first: Use Hardhat Network before testnet deployment
  2. Test on testnet: Deploy to testnet before mainnet
  3. Security audit: For mainnet deployments, recommend professional audit
  4. Verify contracts: Always verify on block explorers for transparency
  5. Document everything: Maintain comprehensive documentation
  6. Version control: Track all changes and deployments
  7. Environment security: Never commit .env files or private keys

Project Lifecycle

User Request → Requirements → Project Setup → Development → 
Compilation → Testing → Testnet Deployment → Verification → 
(Optional: Audit) → Mainnet Deployment → Documentation

Each step should be confirmed successful before proceeding to the next.

# README.md

EVM Developer Skill

Professional toolkit for Solidity smart contract development and deployment on EVM-compatible blockchains.

Overview

The EVM Developer skill provides a comprehensive, structured workflow for developing, testing, and deploying smart contracts with:

  • Standardized Project Structure: Consistent organization across all projects
  • Automated Workflows: Scripts for project creation, deployment, and verification
  • Best Practices: Security patterns, coding conventions, and optimization techniques
  • Complete Documentation: Guides, templates, and references
  • Multi-Chain Support: Deploy to any EVM-compatible blockchain

Quick Start

Prerequisites

  • Node.js (v16+)
  • npm or yarn
  • Code editor (VS Code recommended)

Create a New Project

node scripts/create-project.js <project-name> "<description>" <contract-type>

Development Workflow

  1. Write Contract: Add Solidity code to contracts/
  2. Compile: npx hardhat compile
  3. Test: npx hardhat test
  4. Deploy: npx hardhat run scripts/deploy.js --network <network>
  5. Verify: npx hardhat verify --network <network> <address>

Directory Structure

evm-developer/
├── SKILL.md                 # This file - skill documentation
├── README.md                # Project overview
├── projects/                # All smart contract projects
│   └── README.md           # Project index
├── templates/              # Project and contract templates
│   ├── contract-templates/ # Reusable contract templates
│   └── project-structure.json
├── references/             # Development guides
│   ├── deployment-guide.md
│   ├── security.md
│   ├── conventions.md
│   └── workflow.md
├── scripts/                # Automation scripts
│   ├── create-project.js
│   ├── deploy-helper.js
│   └── verify-contract.js
└── plans/                  # Architecture documentation

Key Features

1. Project Management

  • Automated project creation with standard structure
  • Project indexing and tracking
  • Deployment record keeping
  • ABI extraction and management

2. Development Standards

  • Solidity coding conventions
  • Security best practices
  • Gas optimization patterns
  • Comprehensive documentation requirements

3. Deployment Pipeline

  • Multi-network configuration
  • Automated deployment scripts
  • Deployment tracking and history
  • Contract verification support

4. Security Focus

  • Built-in security patterns
  • Access control templates
  • Reentrancy protection
  • Emergency pause mechanisms

Resources

Documentation

Templates

  • ERC20 Token - Standard fungible token
  • ERC721 NFT - Non-fungible token implementation
  • Project Templates - Standard project structure

Automation Scripts

  • create-project.js - Automated project creation
  • deploy-helper.js - Deployment utilities
  • verify-contract.js - Contract verification

Supported Networks

Testnets

  • Ethereum Sepolia
  • Polygon Mumbai
  • BSC Testnet
  • Arbitrum Sepolia
  • Optimism Sepolia

Mainnets

  • Ethereum Mainnet
  • Polygon
  • BNB Smart Chain
  • Arbitrum One
  • Optimism
  • Avalanche C-Chain

Common Tasks

Creating a New Token

node scripts/create-project.js my-token "My ERC20 Token" ERC20
cd projects/my-token
# Edit contracts/MyToken.sol
npx hardhat compile
npx hardhat test

Deploying to Testnet

# Configure .env with PRIVATE_KEY and RPC_URL
npx hardhat run scripts/deploy.js --network sepolia

Verifying Contract

npx hardhat verify --network sepolia <CONTRACT_ADDRESS> <CONSTRUCTOR_ARGS>

Best Practices

  1. Always test locally first - Use Hardhat Network for initial testing
  2. Deploy to testnet - Verify functionality before mainnet
  3. Security audit - Review code and consider professional audit for high-value contracts
  4. Verify contracts - Ensure transparency by verifying on block explorers
  5. Document thoroughly - Maintain clear documentation for all contracts
  6. Version control - Use git to track all changes
  7. Environment security - Never commit private keys or .env files

Development Principles

Security First

  • Use OpenZeppelin contracts as base
  • Follow Checks-Effects-Interactions pattern
  • Implement access control and emergency stops
  • Test extensively with edge cases

Code Quality

  • Write clear, readable code
  • Use NatSpec documentation
  • Follow naming conventions
  • Keep functions focused and modular

Gas Efficiency

  • Optimize storage layout
  • Use appropriate data locations (calldata, memory, storage)
  • Batch operations where possible
  • Profile gas usage in tests

Support & Resources

  • OpenZeppelin Contracts: https://docs.openzeppelin.com/contracts
  • Hardhat Documentation: https://hardhat.org/docs
  • Solidity Documentation: https://docs.soliditylang.org
  • Ethereum Development: https://ethereum.org/developers

Contributing

When adding new templates or improving workflows:
1. Follow existing conventions
2. Update relevant documentation
3. Test thoroughly
4. Update this README if needed

License

MIT License - See individual project licenses for specific contracts.


Version: 1.0.0
Last Updated: 2026-02-02
Maintained by: EVM Developer Skill Contributors

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.