/auditsentry:gas <file-or-contract>from auditsentry
Profiles smart contract gas costs via forge gas-report, identifies expensive operations, and suggests optimizations with before/after estimates. Supports --apply to auto-apply patches and re-measure.
Ships in auditsentry. Installing the plugin adds it to Claude Code.
mcp__forge-runner__gas_report()
Returns per-function gas costs from the existing test suite.
Dispatch gas-optimizer subagent. It looks for:
error InsufficientBalance();)x = x + 1 instead of ++x / unchecked { ++x } in safe loopsrequire over short-circuit when both sides are equally cheapFor each opportunity, produce a diff. Estimate gas saved using a benchmark test.
If --apply, apply the patches and re-run gas report. Show before/after.
Gas profile for src/Vault.sol:
Function Avg Min Max Median
deposit 147K 142K 158K 144K
withdraw 203K 189K 225K 198K ← top spender
rebalance 412K 398K 431K 410K ← top spender
Optimization opportunities:
1. withdraw():
- Cache `users[msg.sender]` in memory (called 4× in fn body)
- Estimated savings: 8K gas/call
2. rebalance():
- Replace `string memory reason` with custom errors
- Estimated savings: 12K gas/call
3. Storage layout:
- Pack `bool paused` + `uint8 feeRate` + `address admin` into one slot
- Saves one SSTORE per init: 20K gas
Apply with --apply. Re-runs the gas report and shows deltas.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentry45 commands in this plugin
/audit/audit — full security auditFull security audit of a Solidity/Vyper/Rust contract or directory. Runs the entire vuln-skills library and dispatches DeFi specialist subagents based on detected protocol type./audit-changes/audit-changes — audit only what changedAudit only the git diff vs main (or specified base). Optimized for PR review./audit-deep/audit-deep — multi-pass adversarial auditDeep audit — same as /audit but spawns more parallel subagents, runs multi-pass review, and chases exploit chains across files./audit-deps/audit-deps — vet the libraries you importAudit third-party dependencies — resolve installed versions, cross-reference known-vulnerable releases, and flag vendored code that has diverged from upstream./audit-diff/audit-diff — regression diff between two auditsDiff two AuditSentry audit reports (before vs after) to track regressions — what's new, what's fixed, and whether the grade moved./audit-history/audit-history — what's been found beforePull past public audits (Code4rena, Sherlock, Spearbit, etc.) for a deployed contract or known protocol.Other plugins' commands for the same job