solidity-debug

solidity-debug is a skill for Claude Code, Codex from 0xlayerghost/solidity-agent-kit. It costs 57 tokens per session (1,315 once invoked), scanned A, a copy of solidity-debug, MIT.

A failed-transaction debugging guide for Solidity networks using Foundry's command-line tools. It explains how to inspect a transaction receipt and details, distinguish running out of gas from a contract revert, and decode the called function.

In plain words
What is it for?
Use it to inspect transaction status, gas use, logs, input data, sender and recipient, revert clues, and nonce or gas-price issues.
Why use it?
It helps identify why a blockchain transaction failed instead of treating every failure as a gas problem.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect transaction status, gas use, logs, input data, sender and recipient, revert clues, and nonce or gas-price issues.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/0xlayerghost/solidity-agent-kit/solidity-debug
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add 0xlayerghost/solidity-agent-kit --skill solidity-debug
Clone the repo
git clone --depth 1 https://github.com/0xlayerghost/solidity-agent-kit

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for solidity-debug

README.md
[![agentmods](https://agentmods.dev/badge/skills/0xlayerghost/solidity-agent-kit/solidity-debug/github.svg)](https://agentmods.dev/skills/0xlayerghost/solidity-agent-kit/solidity-debug)
Your own site
<a href="https://agentmods.dev/skills/0xlayerghost/solidity-agent-kit/solidity-debug"><img src="https://agentmods.dev/badge/skills/0xlayerghost/solidity-agent-kit/solidity-debug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for solidity-debug

Your own site · 80×15
<a href="https://agentmods.dev/skills/0xlayerghost/solidity-agent-kit/solidity-debug"><img src="https://agentmods.dev/badge/skills/0xlayerghost/solidity-agent-kit/solidity-debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,315 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.01315
Opus 5.5 $0.00023 $0.00526
Sonnet 5.5 $0.00011 $0.00263
Haiku 4.5 $0.00006 $0.00131

Measured 1mo ago against content hash c0e72b74de1a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

solidity-debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to solidity-debug — 1 line differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/solidity-debug/SKILL.md · 120 lines

How it starts

The opening of the file, as written. The whole thing — 120 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Failed Transaction Debug Workflow

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.

Step 1: 获取交易回执 — 判断成功/失败

使用 Foundry cast CLI 查询交易回执(receipt),传入 tx hash 和 RPC endpoint。

关注字段:

字段 含义
status 0 = 失败, 1 = 成功
gasUsed 实际消耗的 gas
logs 空数组 [] = 交易 revert,无事件发出
to 目标合约地址

Step 2: 获取交易详情 — 拿到 gas limit 和 input

使用 Foundry cast CLI 查询交易详情(tx),传入 tx hash 和 RPC endpoint。

关注字段:

字段 含义
gas 发送方设置的 gas limit
input 调用的 calldata(函数选择器 + 参数编码)
from / to 发送方和目标合约
value 发送的原生代币数量

Step 3: 判断失败类型 — gasUsed vs gas limit

现象 判断 解决方向
gasUsed / gas ≈ 100%(如 999,472 / 1,000,000) Out of Gas (OOG) 提高 gas limit 或估算 gas
gasUsed 远低于 gas limit(如 50,000 / 1,000,000) Revert 需获取 revert reason,见 Step 6
gasUsed 正常但 status=0 内部调用失败 检查余额、授权、内部 call 返回值
交易根本没上链 Nonce/Gas Price 问题 检查 pending 队列

Step 4: 解码函数选择器 — 确定调用了什么函数

使用 Foundry cast 的 4byte 功能,传入 input 的前 4 字节,查询对应的函数签名。

示例:输入 0xb51a038a → 输出 unstake(uint256,address[],uint256[])

Step 5: 解码完整 calldata — 还原调用参数

使用 Foundry cast 的 calldata-decode 功能,传入 Step 4 得到的函数签名和完整 input data。

解码后的参数可用于:

  • 分析入参是否有误
  • 直接用于重试交易

Step 6: 获取 Revert Reason(非 OOG 场景)

方法 说明
模拟调用 使用 Foundry cast call 在失败区块号上模拟,指定 from 地址和 block number,还原 revert 信息
重放交易 使用 Foundry cast run 重放交易(需要 archive 节点)
在线分析平台 使用第三方交易分析平台查看详细调用栈(备用方案)

Step 7: 查询链上状态 — 确认交易失败后数据已回滚

使用 Foundry cast call 查询合约的 public 变量和 mapping,传入合约地址、函数签名及参数。

对于 struct 类型返回值,需按 ABI 顺序指定返回类型。

失败交易的状态变更会完全回滚,需确认数据仍在原始状态。

Step 8: 对比成功 vs 失败交易 — 找差异

将成功和失败的交易放在一起对比:

对比维度 说明
gas 消耗 判断是否 OOG
调用参数 判断是否入参问题
目标地址 判断是否调错合约
区块时间 判断是否有时间锁等限制
合约状态 判断是否前置条件不满足

Step 9: 重试交易

场景 方法
正常重试 使用 Foundry cast send,不指定 gas limit(让节点自动估算)
已知消耗范围 使用 Foundry cast send,指定较高 gas limit

Read the full file on GitHub · 120 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 120 lines · 57 tokens per session scan A c0e72b74de1a

Subscribe to this mod's changes

solidity-debug is a skill published in the GitHub repository 0xlayerghost/solidity-agent-kit (4 stars, last pushed 27d ago), licensed MIT. It adds 57 tokens to every session and 1,315 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to solidity-debug, differing in 1 line, and is treated as a copy.

Related

Other skills, from other repositories

propfund

Trade on PropFund, the decentralized on-chain prop firm for AI agents. Two layers: PropFund SCREENS you (a free evaluation, then a virtual "funded" probation leg that builds an immutable on-chain record — pool-as-counterparty, no real firm capital), and AgentDesk PAYS you (once your record clears the bar you graduate…

NO7r34L/PropFund.eth · 0 tokens

debug

Troubleshoot ChainGPT API errors and issues. Use when: chaingpt error, api not working, 401, 402, 403, 404, 429, insufficient credits, rate limit, streaming broken, nft stuck, chat history not working. Diagnoses the problem and provides the fix.

ChainGPT-org/chaingpt-claude-skill · 65 tokens

programmable-v4-hook-builder

Build, repair, validate, submit, or track a complete Programmable Uniswap v4 Custom launch through the public V3 API. Use when the user names Programmable and wants implementation or launch work for a hook, token, multi-contract graph, app, game, service, or hybrid. Do not use for explanation-only questions, unrelated…

programmablehq/PROGRAMMABLE · 90 tokens

web3-bug-classes

Complete reference for all 10 DeFi smart contract bug classes. Use this when hunting for specific vulnerability types, need attack patterns for accounting desync, access control, incomplete path, off-by-one, oracle manipulation, ERC4626 vaults, reentrancy, flash loans, signature replay, or proxy/upgrade bugs.

Awarexone/web3-bug-bounty-hunting-ai-skills · 72 tokens

web3-methodology-research

External research synthesis from Trail of Bits, SlowMist, ConsenSys, Immunefi, and Cyfrin. Use this for advanced audit methodology, Echidna/Medusa fuzzing setup, Slither custom detector writing, attack pattern deep dives, or the 4-phase learning roadmap.

Awarexone/web3-bug-bounty-hunting-ai-skills · 66 tokens

web3-poc-foundry

Complete Foundry PoC writing guide + all cheatcodes + DeFiHackLabs reproduction patterns. Use this when building a proof of concept exploit, setting up a fork test, using Foundry cheatcodes, or reproducing a known DeFi hack for learning.

Awarexone/web3-bug-bounty-hunting-ai-skills · 59 tokens