blockchain-developer by 404kidwiz/claude-supercode-skills
npx skills add https://github.com/404kidwiz/claude-supercode-skills --skill blockchain-developer提供 Web3 开发专业知识,专注于智能合约(Solidity/Rust)、去中心化应用(dApp)架构和区块链安全。构建安全的智能合约,优化 Gas 使用,并与 Layer 2 扩展解决方案(Arbitrum, Optimism, Base)集成。
哪种链适合该用例?
│
├─ **以太坊 L1**
│ ├─ 高价值交易? → **是**(最高安全性)
│ └─ 成本敏感? → **否**(高 Gas 费用)
│
├─ **Layer 2 (Arbitrum / Optimism / Base)**
│ ├─ 通用目的? → **是**(EVM 等效)
│ ├─ 低费用? → **是**($0.01 - $0.10)
│ └─ 安全性? → **高**(继承自以太坊 L1)
│
├─ **侧链 / 替代 L1 (Polygon / Solana / Avalanche)**
│ ├─ 需要高吞吐量? → **Solana**(基于 Rust)
│ └─ 需要 EVM 兼容性? → **Polygon/Avalanche**
│
└─ **应用链 (Cosmos / Polkadot / Supernets)**
└─ 需要自定义共识/Gas 代币? → **是**(主权性)
| 组件 | 推荐 | 原因 |
|---|---|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| Foundry |
| 基于 Rust,测试速度极快,支持 Solidity 脚本。(Hardhat 已过时)。 |
| 前端 | Wagmi + Viem | 类型安全,轻量级的 Ethers.js 替代品。 |
| 索引 | Ponder / The Graph | 高效的事件索引。 |
| 钱包 | RainbowKit / Web3Modal | 最佳用户体验,易于集成。 |
危险信号 → 升级到 security-auditor:
delegatecall目标: 创建一个带有白名单的安全 ERC-721 NFT 合约。
步骤:
设置
forge init my-nft
forge install OpenZeppelin/openzeppelin-contracts
合约 (src/MyNFT.sol)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract MyNFT is ERC721, Ownable {
bytes32 public merkleRoot;
uint256 public nextTokenId;
constructor(bytes32 _merkleRoot) ERC721("MyNFT", "MNFT") Ownable(msg.sender) {
merkleRoot = _merkleRoot;
}
function mint(bytes32[] calldata proof) external {
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(MerkleProof.verify(proof, merkleRoot, leaf), "Not whitelisted");
_safeMint(msg.sender, nextTokenId);
nextTokenId++;
}
}
测试 (test/MyNFT.t.sol)
function testMintWhitelist() public {
// Generate Merkle Tree in helper...
bytes32[] memory proof = tree.getProof(user1);
vm.prank(user1);
nft.mint(proof);
assertEq(nft.ownerOf(0), user1);
}
目标: 降低用户的交易成本。
步骤:
分析存储
uint128 a; uint128 b; 可放入一个存储槽(32 字节)。constant 和 immutable。代码重构
custom errors 代替字符串 require 消息(节省 ~gas)。unchecked { ++i })。calldata 而不是 memory。验证
forge test --gas-report。用例: 防止重入攻击。
function withdraw() external {
// 1. 检查
uint256 balance = userBalances[msg.sender];
require(balance > 0, "No balance");
// 2. 效果(在发送 ETH 之前更新状态)
userBalances[msg.sender] = 0;
// 3. 交互(外部调用)
(bool success, ) = msg.sender.call{value: balance}("");
require(success, "Transfer failed");
}
用例: 在保持状态/地址不变的情况下升级合约逻辑。
// 实现版本 V1
contract LogicV1 {
uint256 public value;
function setValue(uint256 _value) external { value = _value; }
}
// 代理合约(通用)
contract Proxy {
address public implementation;
function upgradeTo(address _newImpl) external { implementation = _newImpl; }
fallback() external payable {
address _impl = implementation;
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), _impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
}
用例: 将 10,000 个用户加入白名单而无需在链上存储他们。
每周安装数
98
代码仓库
GitHub 星标数
43
首次出现
2026年1月24日
安全审计
安装于
opencode76
claude-code71
codex70
gemini-cli69
cursor64
github-copilot57
Provides Web3 development expertise specializing in smart contracts (Solidity/Rust), decentralized application (dApp) architecture, and blockchain security. Builds secure smart contracts, optimizes gas usage, and integrates with Layer 2 scaling solutions (Arbitrum, Optimism, Base).
Which chain fits the use case?
│
├─ **Ethereum L1**
│ ├─ High value transactions? → **Yes** (Max security)
│ └─ Cost sensitive? → **No** (High gas fees)
│
├─ **Layer 2 (Arbitrum / Optimism / Base)**
│ ├─ General purpose? → **Yes** (EVM equivalent)
│ ├─ Low fees? → **Yes** ($0.01 - $0.10)
│ └─ Security? → **High** (Inherits from Eth L1)
│
├─ **Sidechains / Alt L1 (Polygon / Solana / Avalanche)**
│ ├─ Massive throughput? → **Solana** (Rust based)
│ └─ EVM compatibility? → **Polygon/Avalanche**
│
└─ **App Chains (Cosmos / Polkadot / Supernets)**
└─ Need custom consensus/gas token? → **Yes** (Sovereignty)
| Component | Recommendation | Why? |
|---|---|---|
| Framework | Foundry | Rust-based, blazing fast tests, Solidity scripting. (Hardhat is legacy). |
| Frontend | Wagmi + Viem | Type-safe, lightweight replacement for Ethers.js. |
| Indexing | Ponder / The Graph | Efficient event indexing. |
| Wallets | RainbowKit / Web3Modal | Best UX, easy integration. |
Red Flags → Escalate tosecurity-auditor:
delegatecall with untrusted inputsGoal: Create a secure ERC-721 NFT contract with whitelist.
Steps:
Setup
forge init my-nft
forge install OpenZeppelin/openzeppelin-contracts
Contract (src/MyNFT.sol)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
contract MyNFT is ERC721, Ownable {
bytes32 public merkleRoot;
uint256 public nextTokenId;
constructor(bytes32 _merkleRoot) ERC721("MyNFT", "MNFT") Ownable(msg.sender) {
merkleRoot = _merkleRoot;
}
function mint(bytes32[] calldata proof) external {
bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
require(MerkleProof.verify(proof, merkleRoot, leaf), "Not whitelisted");
_safeMint(msg.sender, nextTokenId);
nextTokenId++;
}
}
Test (test/MyNFT.t.sol)
Goal: Reduce transaction costs for users.
Steps:
Analyze Storage
uint128 a; uint128 b; fits in one slot (32 bytes).constant and immutable for fixed values.Code Refactoring
custom errors instead of string require messages (saves ~gas).unchecked { ++i }).calldata instead of memory for function arguments where possible.Use case: Preventing Reentrancy attacks.
function withdraw() external {
// 1. Checks
uint256 balance = userBalances[msg.sender];
require(balance > 0, "No balance");
// 2. Effects (Update state BEFORE sending ETH)
userBalances[msg.sender] = 0;
// 3. Interactions (External call)
(bool success, ) = msg.sender.call{value: balance}("");
require(success, "Transfer failed");
}
Use case: Upgrading contract logic while keeping state/address.
// Implementation V1
contract LogicV1 {
uint256 public value;
function setValue(uint256 _value) external { value = _value; }
}
// Proxy Contract (Generic)
contract Proxy {
address public implementation;
function upgradeTo(address _newImpl) external { implementation = _newImpl; }
fallback() external payable {
address _impl = implementation;
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), _impl, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
}
Use case: Whitelisting 10,000 users without storing them on-chain.
Weekly Installs
98
Repository
GitHub Stars
43
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
opencode76
claude-code71
codex70
gemini-cli69
cursor64
github-copilot57
Azure RBAC 权限管理工具:查找最小角色、创建自定义角色与自动化分配
135,700 周安装
AI产品管理工具:利益相关方更新生成器 - 自动创建专业的产品更新报告
119 周安装
设计评审框架与最佳实践指南:高效团队协作与设计优化方法
166 周安装
敏感性检查技能:AI辅助评估虚构作品表征准确性,避免文化挪用与刻板印象
122 周安装
FlowKit CSS 命名规范指南:Webflow 项目代码标准化与 SEO 优化
144 周安装
Shiny bslib主题定制教程:快速设置Bootstrap 5主题与动态颜色切换
128 周安装
Microsoft Outlook API 集成指南 - 使用 Membrane CLI 自动化邮件、日历和任务管理
149 周安装
function testMintWhitelist() public {
// Generate Merkle Tree in helper...
bytes32[] memory proof = tree.getProof(user1);
vm.prank(user1);
nft.mint(proof);
assertEq(nft.ownerOf(0), user1);
}
Verification
forge test --gas-report.