Smart Contract Development Skill
Multi-chain smart contract development with security-first approach.
Capabilities
| Capability |
Description |
| Contract Writing |
ERC20, ERC721, ERC1155, esToken (vesting/locking), custom logic |
| Security Audit |
Reentrancy, overflow, access control, flash loan attacks, etc. |
| Test Generation |
Foundry test cases with fuzz testing and invariant tests |
| Gas Optimization |
Storage packing, calldata optimization, assembly tricks |
| Deployment |
Multi-chain deployment scripts with verification |
Supported Chains
- EVM: Ethereum, Polygon, Arbitrum, Optimism, BSC, Avalanche
- Solana: Anchor framework
- Move: Aptos, Sui
Workflow
Contract Development
- Clarify requirements (token type, features, chain)
- Load appropriate template from
assets/templates/
- Implement with OpenZeppelin base contracts where applicable
- Apply gas optimizations from
references/gas-optimization.md
- Generate Foundry tests using patterns from
references/foundry-patterns.md
Security Audit
- Run
scripts/security_scan.py for automated detection
- Manual review using
references/vulnerabilities.md checklist
- Report findings with severity levels (Critical/High/Medium/Low/Info)
- Suggest fixes with code examples
Test Generation
- Identify contract functions and state transitions
- Apply patterns from
references/foundry-patterns.md
- Include fuzz tests for numeric inputs
- Include invariant tests for protocol properties
Resources
References (load as needed)
| File |
Purpose |
When to load |
references/vulnerabilities.md |
Common vulnerability patterns |
During security audits |
references/best-practices.md |
Solidity/Rust best practices |
During contract writing |
references/gas-optimization.md |
Gas optimization techniques |
When optimizing contracts |
references/foundry-patterns.md |
Test patterns and examples |
When generating tests |
Templates (copy and modify)
| Template |
Use Case |
assets/templates/erc20-base.sol |
Fungible token contracts |
assets/templates/erc721-base.sol |
NFT contracts |
assets/templates/estoken-base.sol |
Vesting/locking token (esToken) |
assets/templates/test-base.t.sol |
Foundry test scaffold |
Scripts
| Script |
Purpose |
scripts/security_scan.py |
Automated vulnerability detection |
Security Audit Checklist
When auditing, check each category from references/vulnerabilities.md:
- Reentrancy: External calls before state updates
- Access Control: Missing modifiers, centralization risks
- Integer Issues: Overflow/underflow (pre-0.8.0), division by zero
- Flash Loan Attacks: Price manipulation, governance attacks
- Front-running: MEV vulnerabilities, commit-reveal patterns
- Logic Errors: Off-by-one, incorrect comparisons
- Denial of Service: Unbounded loops, block gas limit
Output Format
Claude responds in Chinese per CLAUDE.md.
Audit Report Structure
## Security Audit Report
### Summary
- Contracts audited: [list]
- Lines of code: [count]
- Findings: [X Critical, Y High, Z Medium, W Low]
### Findings
#### [C-01] Critical: [Title]
- **Location**: `Contract.sol:L42`
- **Impact**: [description]
- **Proof of Concept**: [code]
- **Recommendation**: [fix]
Contract Delivery Structure
## Contract: [Name]
### Features
- [list features]
### Deployment
1. [steps]
### Files
- `src/[Contract].sol` - Main contract
- `test/[Contract].t.sol` - Tests
- `script/Deploy[Contract].s.sol` - Deployment script
Gas Optimization Priority
Apply optimizations in this order (from references/gas-optimization.md):
- Storage layout (packing, cold/warm slots)
- Calldata vs memory
- Unchecked blocks for safe math
- Custom errors vs require strings
- Assembly for critical paths (last resort)
1---2name: smart-contract3description: Multi-chain smart contract development skill for Ethereum, Solana, and Move-based chains. This skill should be used when: writing smart contracts (ERC20/ERC721/ERC1155/esToken/custom), auditing contract security vulnerabilities, generating Foundry test cases, optimizing gas usage, or automating deployment workflows. Triggers on queries like "write a contract", "audit this contract", "generate tests", "optimize gas", or "deploy contract".4---5
6# Smart Contract Development Skill
7
8Multi-chain smart contract development with security-first approach.
9
10## Capabilities
11
12| Capability | Description |
13|------------|-------------|
14| Contract Writing | ERC20, ERC721, ERC1155, esToken (vesting/locking), custom logic |
15| Security Audit | Reentrancy, overflow, access control, flash loan attacks, etc. |
16| Test Generation | Foundry test cases with fuzz testing and invariant tests |
17| Gas Optimization | Storage packing, calldata optimization, assembly tricks |
18| Deployment | Multi-chain deployment scripts with verification |
19
20## Supported Chains
21
22- **EVM**: Ethereum, Polygon, Arbitrum, Optimism, BSC, Avalanche
23- **Solana**: Anchor framework
24- **Move**: Aptos, Sui
25
26## Workflow
27
28### Contract Development
29
301. Clarify requirements (token type, features, chain)
312. Load appropriate template from `assets/templates/`
323. Implement with OpenZeppelin base contracts where applicable
334. Apply gas optimizations from `references/gas-optimization.md`
345. Generate Foundry tests using patterns from `references/foundry-patterns.md`
35
36### Security Audit
37
381. Run `scripts/security_scan.py` for automated detection
392. Manual review using `references/vulnerabilities.md` checklist
403. Report findings with severity levels (Critical/High/Medium/Low/Info)
414. Suggest fixes with code examples
42
43### Test Generation
44
451. Identify contract functions and state transitions
462. Apply patterns from `references/foundry-patterns.md`
473. Include fuzz tests for numeric inputs
484. Include invariant tests for protocol properties
49
50## Resources
51
52### References (load as needed)
53
54| File | Purpose | When to load |
55|------|---------|--------------|
56| `references/vulnerabilities.md` | Common vulnerability patterns | During security audits |
57| `references/best-practices.md` | Solidity/Rust best practices | During contract writing |
58| `references/gas-optimization.md` | Gas optimization techniques | When optimizing contracts |
59| `references/foundry-patterns.md` | Test patterns and examples | When generating tests |
60
61### Templates (copy and modify)
62
63| Template | Use Case |
64|----------|----------|
65| `assets/templates/erc20-base.sol` | Fungible token contracts |
66| `assets/templates/erc721-base.sol` | NFT contracts |
67| `assets/templates/estoken-base.sol` | Vesting/locking token (esToken) |
68| `assets/templates/test-base.t.sol` | Foundry test scaffold |
69
70### Scripts
71
72| Script | Purpose |
73|--------|---------|
74| `scripts/security_scan.py` | Automated vulnerability detection |
75
76## Security Audit Checklist
77
78When auditing, check each category from `references/vulnerabilities.md`:
79
801. **Reentrancy**: External calls before state updates
812. **Access Control**: Missing modifiers, centralization risks
823. **Integer Issues**: Overflow/underflow (pre-0.8.0), division by zero
834. **Flash Loan Attacks**: Price manipulation, governance attacks
845. **Front-running**: MEV vulnerabilities, commit-reveal patterns
856. **Logic Errors**: Off-by-one, incorrect comparisons
867. **Denial of Service**: Unbounded loops, block gas limit
87
88## Output Format
89
90> Claude responds in Chinese per CLAUDE.md.
91
92### Audit Report Structure
93
94```markdown
95## Security Audit Report
96
97### Summary
98- Contracts audited: [list]
99- Lines of code: [count]
100- Findings: [X Critical, Y High, Z Medium, W Low]
101
102### Findings
103
104#### [C-01] Critical: [Title]
105- **Location**: `Contract.sol:L42`
106- **Impact**: [description]
107- **Proof of Concept**: [code]
108- **Recommendation**: [fix]
109```
110
111### Contract Delivery Structure
112
113```markdown
114## Contract: [Name]
115
116### Features
117- [list features]
118
119### Deployment
1201. [steps]
121
122### Files
123- `src/[Contract].sol` - Main contract
124- `test/[Contract].t.sol` - Tests
125- `script/Deploy[Contract].s.sol` - Deployment script
126```
127
128## Gas Optimization Priority
129
130Apply optimizations in this order (from `references/gas-optimization.md`):
131
1321. Storage layout (packing, cold/warm slots)
1332. Calldata vs memory
1343. Unchecked blocks for safe math
1354. Custom errors vs require strings
1365. Assembly for critical paths (last resort)