Solidityオンチェーン操作チェックリスト
オンチェーン操作前に、権限、依存関係、パラメータ、セキュリティ、テスト、知識の6層で構成された検証チェックリストを実行し、トランザクション送信やコントラクトデプロイなどの作業を体系的にサポートするSkill。
📜 元の英語説明(参考)
[AUTO-INVOKE] MUST be invoked BEFORE any on-chain operation (cast send, forge script --broadcast). Systematic 6-layer verification checklist: permissions, dependencies, parameters, security, testing, and knowledge capture. Trigger: any task involving sending transactions, deploying contracts, or interacting with on-chain state.
🇯🇵 日本人クリエイター向け解説
オンチェーン操作前に、権限、依存関係、パラメータ、セキュリティ、テスト、知識の6層で構成された検証チェックリストを実行し、トランザクション送信やコントラクトデプロイなどの作業を体系的にサポートするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o solidity-checklist.zip https://jpskill.com/download/5970.zip && unzip -o solidity-checklist.zip && rm solidity-checklist.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/5970.zip -OutFile "$d\solidity-checklist.zip"; Expand-Archive "$d\solidity-checklist.zip" -DestinationPath $d -Force; ri "$d\solidity-checklist.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
solidity-checklist.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
solidity-checklistフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[スキル名] solidity-checklist
Solidity チェックリスト
言語ルール
- ユーザーが使用している言語と常に同じ言語で応答してください。 ユーザーが中国語で質問した場合は中国語で、英語で質問した場合は英語で応答します。
このスキルが存在する理由
ほとんどのオンチェーン操作の失敗は、体系的な検証をスキップすることに起因します。次のようなリアクティブなループではなく、
デプロイ -> 失敗 -> エラーを貼り付け -> AIに質問 -> 再試行 -> 再び失敗 -> 再び質問
このスキルは、プロアクティブな検証フローを強制します。
権限の確認 -> 依存関係の確認 -> パラメータの確認 -> セキュリティの確認 -> ローカルでのテスト -> 実行 -> 知識の獲得
6層のプレフライトフロー
すべてのオンチェーン操作は、実行前にこれらの6つの層を順番に通過する必要があります。
レイヤー1: 権限 — これを行う権利がありますか?
レイヤー2: 依存関係 — これが何に影響するか理解していますか?
レイヤー3: パラメータ — 入力は正しいですか?
レイヤー4: セキュリティ — これは安全に実行できますか?
レイヤー5: テスト — まずローカルで検証しましたか?
レイヤー6: 実行と記録 — 実行し、学んだことを記録します。
レイヤー1: 権限チェック
オンチェーン呼び出しの前に、呼び出し元が必要なアクセス権を持っていることを確認します。
| チェック | コマンド | 合格条件 |
|---|---|---|
| コントラクト所有者 | cast call <CONTRACT> "owner()" --rpc-url <RPC> |
期待されるデプロイヤー/管理者アドレスを返します |
| ロールベースのアクセス | cast call <CONTRACT> "hasRole(bytes32,address)" <ROLE_HASH> <CALLER> --rpc-url <RPC> |
true を返します |
| ホワイトリストステータス | cast call <CONTRACT> "isWhitelisted(address)" <CALLER> --rpc-url <RPC> |
true を返します (該当する場合) |
| トークンアローワンス | cast call <TOKEN> "allowance(address,address)" <OWNER> <SPENDER> --rpc-url <RPC> |
必要な量以上を返します |
| 一時停止状態 | cast call <CONTRACT> "paused()" --rpc-url <RPC> |
false を返します |
決定ルール
| 結果 | アクション |
|---|---|
| すべてのチェックが合格 | レイヤー2に進みます |
| 権限不足 | まず権限を修正し (ロールの付与 / 承認 / 一時停止解除)、再チェックします |
| どの権限が必要か不明 | コントラクトソースを読み込み、ターゲット関数内のすべての onlyOwner、onlyRole、require を見つけます |
レイヤー2: 依存関係チェック
影響範囲を理解します — この操作はどのコントラクトと状態に触れますか?
| チェック | 方法 |
|---|---|
| 直接の依存関係 | ターゲット関数のソースを読み込み、すべての外部呼び出し (IERC20(token).transfer(...) など) をリストアップします |
| アップストリームコントラクト | どのコントラクトがこのコントラクトのアドレスへの参照を保持していますか? |
| ダウンストリーム効果 | この状態変更はコールバック、イベント、またはオフチェーンインデクサーをトリガーしますか? |
| 初期化状態 | cast call <CONTRACT> "initialized()" --rpc-url <RPC> — コントラクトは完全にセットアップされていますか? |
| リンクされたアドレス | コントラクト状態に保存されているすべてのアドレスが正しく、ゼロではないことを確認します |
依存関係マップテンプレート
マルチコントラクトシステムで操作する前に、精神的な (または書かれた) マップを作成します。
ContractA (owner: deployer)
├── references: TokenB (ERC20), RouterC
├── authorized callers: deployer, ContractD
└── state deps: must be initialized, TokenB must be approved
ContractD (owner: deployer)
├── references: ContractA, OracleE
└── state deps: OracleE must have price feed set
決定ルール
| 結果 | アクション |
|---|---|
| 依存関係が明確 | レイヤー3に進みます |
| 未知の依存関係 | コントラクトソースを読み込むか、質問します — 盲目的に進まないでください |
| 再デプロイが必要 | 完全な依存関係グラフをトレースして、アドレス更新が必要なすべてのコントラクトを特定します |
レイヤー3: パラメータ検証
送信する前にすべての入力を検証します。
| チェック | よくある落とし穴 |
|---|---|
| アドレス形式 | 間違ったネットワークアドレス、ゼロアドレス、チェックサムの不一致 |
| トークン小数点以下桁数 | 6桁のトークン (USDC/USDT) に18桁を使用する |
| 金額の精度 | 1e18 対 1e6 — 12桁の桁違い |
| 関数セレクター | 間違った関数または間違ったオーバーロードを呼び出す |
| Enum値 | 無効なenumインデックスを渡す |
| 配列の長さ | バッチ操作での配列の長さの不一致 |
| 期限/タイムスタンプ | 期限切れ、間違ったタイムゾーン、block.timestamp 対 unix |
検証コマンド
# 金額を計算する前にトークンの小数点以下桁数をチェックします
cast call <TOKEN> "decimals()" --rpc-url <RPC>
# アドレスがコントラクト (EOAではない) であることを確認します
cast code <ADDRESS> --rpc-url <RPC>
# 空 (0x) = EOA、空ではない = コントラクト
# 自分のcalldataをデコードして再確認します
cast calldata-decode "functionName(type1,type2)" <CALLDATA>
# 送信する前にガスを見積もります (明らかなリバートを検出します)
cast estimate <CONTRACT> "functionName(args)" --from <CALLER> --rpc-url <RPC>
決定ルール
| 結果 | アクション |
|---|---|
| すべてのパラメータが検証済み | レイヤー4に進みます |
| 小数点以下桁数の不一致が見つかった | 正しい小数点以下桁数で再計算します |
| アドレスがEOAで、コントラクトが期待される | 間違ったアドレス — デプロイを確認します |
レイヤー4: セキュリティクイックチェック
実行前に一般的なセキュリティリスクをスキャンします。
| リスク | チェック | レッドフラグ |
|---|---|---|
| 再入可能性 | 関数は状態を更新する前に外部呼び出しを行いますか? | 状態更新前の外部呼び出し |
| フロントランニング | これは価格に敏感な操作 (スワップ、清算) ですか? | スリッページ保護または期限なし |
| アクセス制御 | 関数は呼び出し元を適切に制限していますか? | 重要な関数に onlyOwner / onlyRole がない |
| 値の処理 | 関数はmsg.valueを正しく処理していますか? | ETHを受け入れるが使用しない、またはその逆 |
| 承認金額 | 必要以上に承認していませんか? | 未知のコントラクトに対する approve(spender, type(uint256).max) |
| 秘密鍵の露出 | 生の秘密鍵ではなく、キーストアを使用していますか? | コマンドに --private-key フラグがある |
秘密鍵ルール (必須)
# 絶対にこれを行わないでください
cast send ... --private-key 0xdead...
# 常にこれを行ってください
cast send ... --account <KEYSTORE_NAME>
# 設定されていない場合はキーストアを設定します
cast wallet import <NAME> --interactive
決定ルール
| 結果 | アクション |
|---|---|
| レッドフラグなし | レイヤー5に進みます |
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Solidity Checklist
Language Rule
- Always respond in the same language the user is using. If the user asks in Chinese, respond in Chinese. If in English, respond in English.
Why This Skill Exists
Most on-chain operation failures come from skipping systematic verification. Instead of the reactive loop:
deploy -> fail -> paste error -> ask AI -> retry -> fail again -> ask again
This skill enforces a proactive verification flow:
check permissions -> check dependencies -> check params -> check security -> test locally -> execute -> capture knowledge
The 6-Layer Preflight Flow
Every on-chain operation MUST pass through these 6 layers in order before execution.
Layer 1: PERMISSIONS — Do I have the right to do this?
Layer 2: DEPENDENCIES — Do I understand what this affects?
Layer 3: PARAMETERS — Are my inputs correct?
Layer 4: SECURITY — Is this safe to execute?
Layer 5: TESTING — Have I verified locally first?
Layer 6: EXECUTE & CAPTURE — Do it, then record what I learned.
Layer 1: Permissions Check
Before any on-chain call, verify the caller has the required access.
| Check | Command | Pass Condition |
|---|---|---|
| Contract owner | cast call <CONTRACT> "owner()" --rpc-url <RPC> |
Returns expected deployer/admin address |
| Role-based access | cast call <CONTRACT> "hasRole(bytes32,address)" <ROLE_HASH> <CALLER> --rpc-url <RPC> |
Returns true |
| Whitelist status | cast call <CONTRACT> "isWhitelisted(address)" <CALLER> --rpc-url <RPC> |
Returns true (if applicable) |
| Token allowance | cast call <TOKEN> "allowance(address,address)" <OWNER> <SPENDER> --rpc-url <RPC> |
Returns >= required amount |
| Paused state | cast call <CONTRACT> "paused()" --rpc-url <RPC> |
Returns false |
Decision Rule
| Result | Action |
|---|---|
| All checks pass | Proceed to Layer 2 |
| Missing permission | Fix permission first (grant role / approve / unpause), then re-check |
| Unsure which permissions are needed | Read contract source — find all onlyOwner, onlyRole, require in target function |
Layer 2: Dependency Check
Understand the blast radius — what contracts and state does this operation touch?
| Check | How |
|---|---|
| Direct dependencies | Read target function source — list all external calls (IERC20(token).transfer(...), etc.) |
| Upstream contracts | Which contracts hold a reference to this contract's address? |
| Downstream effects | Will this state change trigger callbacks, events, or off-chain indexers? |
| Initialization state | cast call <CONTRACT> "initialized()" --rpc-url <RPC> — is the contract fully set up? |
| Linked addresses | Verify all addresses stored in contract state are correct and not zero |
Dependency Map Template
Before operating on a multi-contract system, build a mental (or written) map:
ContractA (owner: deployer)
├── references: TokenB (ERC20), RouterC
├── authorized callers: deployer, ContractD
└── state deps: must be initialized, TokenB must be approved
ContractD (owner: deployer)
├── references: ContractA, OracleE
└── state deps: OracleE must have price feed set
Decision Rule
| Result | Action |
|---|---|
| Dependencies clear | Proceed to Layer 3 |
| Unknown dependency | Read contract source or ask — do NOT proceed blindly |
| Redeployment needed | Trace the full dependency graph to identify ALL contracts needing address updates |
Layer 3: Parameter Validation
Verify every input before sending.
| Check | Common Pitfall |
|---|---|
| Address format | Wrong network address, zero address, checksum mismatch |
| Token decimals | Using 18 decimals for a 6-decimal token (USDC/USDT) |
| Amount precision | 1e18 vs 1e6 — off by 12 orders of magnitude |
| Function selector | Calling wrong function or wrong overload |
| Enum values | Passing invalid enum index |
| Array length | Mismatched array lengths in batch operations |
| Deadline/timestamp | Expired deadline, wrong timezone, block.timestamp vs unix |
Validation Commands
# Check token decimals before calculating amounts
cast call <TOKEN> "decimals()" --rpc-url <RPC>
# Verify address is a contract (not EOA)
cast code <ADDRESS> --rpc-url <RPC>
# Empty (0x) = EOA, non-empty = contract
# Decode your own calldata to double-check
cast calldata-decode "functionName(type1,type2)" <CALLDATA>
# Estimate gas before sending (catches obvious reverts)
cast estimate <CONTRACT> "functionName(args)" --from <CALLER> --rpc-url <RPC>
Decision Rule
| Result | Action |
|---|---|
| All params verified | Proceed to Layer 4 |
| Decimal mismatch found | Recalculate with correct decimals |
| Address is EOA, expected contract | Wrong address — verify deployment |
Layer 4: Security Quick Check
Scan for common security risks before execution.
| Risk | Check | Red Flag |
|---|---|---|
| Reentrancy | Does the function make external calls before updating state? | External call before state update |
| Front-running | Is this a price-sensitive operation (swap, liquidation)? | No slippage protection or deadline |
| Access control | Does the function restrict callers appropriately? | Missing onlyOwner / onlyRole on sensitive function |
| Value handling | Does the function handle msg.value correctly? | Accepts ETH but doesn't use it, or vice versa |
| Approval amount | Am I approving more than necessary? | approve(spender, type(uint256).max) on unknown contract |
| Private key exposure | Am I using keystore, not raw private key? | --private-key flag in command |
Private Key Rule (MANDATORY)
# NEVER do this
cast send ... --private-key 0xdead...
# ALWAYS do this
cast send ... --account <KEYSTORE_NAME>
# Set up keystore if not done
cast wallet import <NAME> --interactive
Decision Rule
| Result | Action |
|---|---|
| No red flags | Proceed to Layer 5 |
| Reentrancy risk found | Add ReentrancyGuard or fix CEI pattern before proceeding |
| Front-running risk | Add slippage/deadline params |
| Private key exposed | STOP — rotate the key, use keystore |
Layer 5: Local Testing
Never send a transaction that hasn't been verified locally or on a fork.
| Method | Command | When to Use |
|---|---|---|
| Unit test | forge test --match-test <testName> -vvvv |
New/modified contract functions |
| Fork test | forge test --fork-url <RPC> --match-test <testName> -vvvv |
Testing against live state |
| Dry-run script | forge script <Script> --rpc-url <RPC> -vvvv (no --broadcast) |
Deployment or complex operations |
| Gas estimation | cast estimate <CONTRACT> "func(args)" --from <CALLER> --rpc-url <RPC> |
Before any cast send |
| Simulation | cast call <CONTRACT> "func(args)" --from <CALLER> --rpc-url <RPC> |
Quick function call test |
Testing Decision Tree
Is this a new or modified contract?
├── YES → Write forge test → Run test → Pass? → Proceed
│ → Fail? → Fix and re-test
└── NO (calling existing deployed contract)
├── Simple read? → cast call (Layer 3 already covers this)
└── State-changing? → cast estimate first
├── Estimate succeeds → Proceed to Layer 6
└── Estimate reverts → Debug with cast call + revert reason → Fix → Re-estimate
Decision Rule
| Result | Action |
|---|---|
| Test passes / estimate succeeds | Proceed to Layer 6 |
| Test fails | Fix the issue — do NOT deploy broken code |
| Estimate reverts | Likely a Layer 1 (permissions) or Layer 3 (params) issue — go back |
Layer 6: Execute & Capture
Execute the operation, verify success, and capture knowledge.
Execute
# Send transaction using keystore
cast send <CONTRACT> "functionName(type1,type2)" <arg1> <arg2> \
--account <KEYSTORE_NAME> \
--rpc-url <RPC>
# Deploy using forge script
forge script <Script> \
--rpc-url <RPC> \
--account <KEYSTORE_NAME> \
--broadcast \
--gas-limit <LIMIT> \
-vvvv
Post-Execution Verification (MANDATORY)
| Check | Command |
|---|---|
| TX status | Check status field in receipt: 1 = success, 0 = fail |
| State change | cast call to verify the expected state change happened |
| Events emitted | Check logs in receipt for expected events |
| Balance change | cast balance or cast call balanceOf to verify token movements |
Knowledge Capture
After every successful (or failed) operation, capture what you learned:
| What to Record | Where |
|---|---|
| Successful command with parameters | Personal command handbook (.md file) |
| New error encountered + solution | Debug notes |
| Contract address and its role | Project architecture doc |
| Permission/role requirements discovered | Contract dependency map |
| Gas cost of common operations | Gas reference table |
Anti-Pattern: One-Time Consumption
The biggest leverage: turn every AI interaction into your own knowledge, not a one-time consumption.
If you asked AI for a command and it worked:
- Understand WHY each parameter is what it is
- Record it in your own words
- Next time, write it yourself first — then verify with AI
Quick Reference: Preflight by Operation Type
| Operation | Critical Layers | Most Common Failure |
|---|---|---|
approve |
L1 (owner), L3 (amount/decimals) | Wrong decimals |
transfer |
L1 (balance), L3 (amount/decimals) | Insufficient balance |
addLiquidity |
L1 (approve both tokens), L3 (amounts/ratio), L5 (estimate) | Missing approval |
removeLiquidity |
L1 (LP approve), L3 (minAmounts), L4 (slippage) | Slippage too tight |
stake |
L1 (approve + whitelist), L2 (staking contract state), L3 (amount) | Staking not active / not whitelisted |
unstake |
L1 (staker status), L2 (lock period), L3 (amount) | Lock period not expired |
deploy |
L3 (constructor args), L4 (full security check), L5 (fork test mandatory) | Constructor arg mismatch |
upgrade |
L1 (proxy admin), L2 (storage layout), L4 (storage collision), L5 (fork test mandatory) | Storage layout incompatible |
Preflight Summary Card
Print this mental checklist before EVERY on-chain operation:
[ ] L1 PERMISSIONS — Can I call this? (owner/role/approve/whitelist/paused)
[ ] L2 DEPENDENCIES — What does this touch? (contracts/state/events)
[ ] L3 PARAMETERS — Are inputs correct? (address/decimals/amount/selector)
[ ] L4 SECURITY — Is this safe? (reentrancy/frontrun/key exposure)
[ ] L5 TESTING — Did I test locally? (forge test/estimate/dry-run)
[ ] L6 EXECUTE — Send it, verify it, record what I learned.
6 layers, 2 minutes. Saves hours of debugging and wasted gas.