- Home
- Skills
- Web3 & Crypto
- Solidity Smart Contract Security & Gas Auditor
More screenshots
Works with the AI Agents you already use
Solidity Smart Contract Security & Gas Auditor
Institutional-grade Solidity security and gas optimization skill for Cursor and Claude Code. Detects reentrancy, access control bypasses, unchecked calls, and storage gas waste with line-by-line remediation code.
Free
Solidity Smart Contract Security & Gas Auditor
Example session with this skill installed
Please audit our VaultDeposit.sol contract for reentrancy vulnerabilities, access control bypasses, and storage gas optimizations before our upcoming testnet release.
- Read your context and instructions
- Compiled the solidity smart contract
🛡️ Smart Contract Security & Gas Audit Report
Contract Reviewed: VaultDeposit.sol
Compiler Target: pragma solidity ^0.8.20;
Audit Standard: SWC Registry & OpenZeppelin Best Practices
1. Executive Summary
| Severity | Count | Status |
|---|---|---|
| 🔴 Critical | 1 | Immediate remediation required |
| 🟠 High | 1 | Action required before testnet |
| 🟡 Medium | 0 | None detected |
| ⚡ Gas Optimization | 2 | ~4,200 gas savings per deposit/withdraw |
2. Security Findings & Remediation
[CRIT-01] Classic Reentrancy in withdrawBalance()
- Severity: 🔴 Critical (SWC-107)
- Location:
VaultDeposit.sol#L44-L51
Impact: The contract issues a low-level external call msg.sender.call{value: amount}("") before decrementing userBalances[msg.sender]. A malicious contract can re-enter withdrawBalance() recursively to drain all vault assets.
- Vulnerable Code:
function withdrawBalance(uint256 amount) external {
require(userBalances[msg.sender] >= amount, "Insufficient balance");
(bool sent, ) = msg.sender.call{value: amount}(""); // Interaction before effect
require(sent, "Transfer failed");
userBalances[msg.sender] -= amount;
}
- Remediation (Checks-Effects-Interactions Pattern):
function withdrawBalance(uint256 amount) external nonReentrant {
require(userBalances[msg.sender] >= amount, "Insufficient balance");
userBalances[msg.sender] -= amount; // Effect first
(bool sent, ) = msg.sender.call{value: amount}("");
require(sent, "Transfer failed");
}
[HIGH-01] Phishing Vulnerability via tx.origin Authorization
- Severity: 🟠 High (SWC-115)
- Location:
VaultDeposit.sol#L22
Impact: Using require(tx.origin == owner) allows an attacker contract to trick the contract owner into authorizing privileged withdrawals.
- Remediation: Replace with
require(msg.sender == owner, "Unauthorized");.
3. Gas Optimizations
[GAS-01] Storage Slot Packing in Contract Layout
- Estimated Savings: 2,100 gas on initial storage allocation.
- Location:
VaultDeposit.sol#L12-L16
Optimization: Group uint128 minimumDeposit and address feeReceiver into a single 32-byte storage slot rather than allocating 2 separate 32-byte words.
4. Next Steps
- Apply the Checks-Effects-Interactions diff to line 48.
- Inherit OpenZeppelin's
ReentrancyGuard.sol. - Run invariant fuzz tests with Foundry (
forge test --fuzz-runs 10000).
Connects securely to your tools. The creator never sees your data.
About this skill
🛡️ Solidity Smart Contract Security & Gas Auditor
Transform your AI coding agent (Cursor, Claude Code, Codex CLI) into an institutional-grade EVM security researcher.
Writing smart contracts without an audit is an existential risk. This skill equips your agent with a structured, battle-tested auditing methodology designed to catch critical vulnerabilities, logic flaws, and gas inefficiencies before your code reaches testnet or mainnet.
🔍 What This Skill Detects:
- Reentrancy Attacks (SWC-107): Identifies cross-function and read-only reentrancy vectors where external calls precede state modifications. Enforces Checks-Effects-Interactions (CEI).
- Authorization Bypasses (SWC-115): Flags dangerous
tx.originauthentication vulnerable to phishing attacks. - Unchecked External Calls (SWC-104): Detects silent low-level call failures and enforces
SafeERC20wrapper logic for non-compliant tokens (e.g., USDT). - Flash Loan & Oracle Vulnerabilities (SWC-135): Pinpoints spot-price manipulation risks and recommends TWAP / Chainlink oracle integrations.
- DoS & Block Gas Limits (SWC-128): Identifies unbounded loops over dynamic state arrays that could freeze contract operations.
- Storage Slot Packing: Optimizes 32-byte storage layout (packing
uint128,address,bool) to save up to 2,100 gas per state read/write.
📦 What's Inside:
- Core
SKILL.mdEngine: Multi-phase auditing protocol that drives the AI to generate structured executive summaries, severity tables, and before/after diffs. - SWC Vulnerability Reference Catalog: In-depth exploit mechanics and remediation patterns.
- Standalone Static Analysis Script (
quick_audit.py): Fast local scanner to pre-check codebases for dangerous patterns.
🚀 Compatible Agents:
Works natively with Claude Code, Cursor, Codex CLI, Gemini CLI, VS Code Copilot, and any agent supporting the open SKILL.md standard.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Web3 & Crypto.
Performs deep static pattern analysis, vulnerability detection, and gas profiling. Does not perform mathematical formal verification (e.g., Certora) or dynamic symbolic execution. Cannot simulate multi-protocol flash-loan economic game theory or off-chain oracle latency. Intended as a pre-deployment security gate; mission-critical main net contracts should always include human peer review.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 14 days ago
- Free with an Agensi account
Permissions
File Scopes
This skill operates entirely locally within your IDE/workspace. It requires read access only to Solidity source files (**/*.sol) to analyze code logic, storage layouts, and vulnerability patterns, and write access to generate your markdown audit report (**/*.md). Zero network access, zero third-party telemetry, and zero external API dependencies.