
Claude 技能用于用 etherscan 克隆链上智能合约。
概览
一个Claude代码技能(加上独立CLI),用于克隆Etherscan V2中经过验证的Solidity源代码。它会自动解析代理到其实现,并将@前缀导入重写为相对路径,使克隆代码在不需Foundry/Hardhat重映射的情况下即可读取。 支持20+条EVM链(以太坊、Arbitrum、Base、Optimism、Polygon、BSC、zkSync、Linea、Scroll、Blast、Avalanche等)——全部通过单一Etherscan V2端点实现。 需求:python3(>= 3.9)、git 和 Etherscan API 密钥(免费)。 setup.sh 是幂零的——随时可以重跑它修复安装或在git拉取后获取更改。 - ~/.claude/skills/clone-contracts/ — 安装目录。SKILL.md 和clone_external.py从你的克隆这里有符号链接,因此更新会传播。- ~/.claude/skills/clone-contracts/.venv — 隔离的 Python venv,带请求 + python-dotenv。不接触系统 Python。- ~/.local/bin/clone-external — 你的 PATH 上的封装命令。- ~/.claude/skills/clone-contracts/。
概述(AI 翻译)
一项Claude代码技能(加上独立CLI)用于克隆经过验证的Solidity源代码
来自Etherscan V2。它会自动解析代理到其实现并重写
@前缀导入到相对路径,使克隆代码可读,
Foundry/安全帽重新映射。
支持20+条EVM链(以太坊、Arbitrum、Base、Optimism、Polygon、BSC、zkSync, 线性、滚动、爆破、雪崩…)——全部通过单一的Etherscan V2端点完成。
安装
要求:python3(>= 3.9)、git,以及一个
Etherscan API 密钥(免费)。
setup.sh 是幂等算法——随时可以重新运行以修复安装或拾取
git pull之后的变化。
它设定的内容:
~/.claude/skills/clone-contracts/— 安装目录。SKILL.md和clone_external.py与你的克隆体有关联,因此更新会传播。~/.claude/skills/clone-contracts/.venv— 孤立的 Python venvrequests+python-dotenv。不接触Python系统。- [
~/.local/bin/clone-external— 封装命令,适用于你的PATH。 ~/.claude/skills/clone-contracts/.env— 存储你的ETHERSCAN_API_KEY。 如果设置脚本还没有在你的环境中,它会提示你去做。
如果’~/'。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
clone-contracts
A Claude Code skill (plus standalone CLI) for cloning verified Solidity source code
from Etherscan V2. It auto-resolves proxies to their implementation and rewrites
@-prefixed imports to relative paths so the cloned code is readable without
Foundry/Hardhat remappings.
Works on 20+ EVM chains (Ethereum, Arbitrum, Base, Optimism, Polygon, BSC, zkSync, Linea, Scroll, Blast, Avalanche, …) — all via the single Etherscan V2 endpoint.
Installation
Requirements: python3 (>= 3.9), git, and an
Etherscan API key (free).
git clone https://github.com//clone-contracts-skill.git ~/clone-contracts-skill
cd ~/clone-contracts-skill
./setup.sh
setup.sh is idempotent — re-run it any time to repair an install or pick up
changes after git pull.
What it sets up:
~/.claude/skills/clone-contracts/— install directory.SKILL.mdandclone_external.pyare symlinked here from your clone so updates propagate.~/.claude/skills/clone-contracts/.venv— isolated Python venv withrequests+python-dotenv. Does not touch system Python.~/.local/bin/clone-external— wrapper command on yourPATH.~/.claude/skills/clone-contracts/.env— stores yourETHERSCAN_API_KEY. The setup script prompts for it if it’s not already in your environment.
If ~/.local/bin is not on your PATH, add this to your shell rc:
export PATH="$HOME/.local/bin:$PATH"
Usage
clone-external [--chain ] [--output ] : [: ...]
Examples
# Ethereum mainnet — writes to ./contracts/ethereum//
clone-external \
uniswap:0x1F98431c8aD98523631AE4a59f267346ea31F984 \
chainlink:0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
# Arbitrum
clone-external --chain arbitrum \
gmx:0x489ee077994B6658eAfA855C308275EAd8097C4A
# Custom output root
clone-external --chain base --output ./audit-targets \
morpho:0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb
Run clone-external --help for the full option list and supported chains.
Output layout
///
├── contracts/ # main contracts (.sol)
├── interfaces/ # interfaces (.sol)
├── lib/ # libraries + npm-style @deps rewritten to relative paths
How ETHERSCAN_API_KEY is resolved
Priority order (first hit wins):
- Process environment (
export ETHERSCAN_API_KEY=...) .envin the current working directory~/.claude/skills/clone-contracts/.env(written bysetup.sh)
Using as a Claude Code skill
Once installed, Claude Code automatically discovers the skill at
~/.claude/skills/clone-contracts/SKILL.md. Agents that encounter an external
integration callsite (breadth, depth, recon) can invoke the clone-external
command directly — no per-project configuration needed.
Updating
cd ~/clone-contracts-skill
git pull
./setup.sh # only needed if dependencies changed; safe to skip otherwise
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add theschnilch/clonecontractsskill