gas-snapshot-testing

Generate and compare Solidity gas snapshots with forge snapshot.

120|12|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ccashwell/evm-cortex --skill gas-snapshot-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gas-snapshot-testing
Source: https://github.com/ccashwell/evm-cortex/tree/main/skills/gas-snapshot-testing
Command: npx skills add https://github.com/ccashwell/evm-cortex --skill gas-snapshot-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Gas snapshots simplify detecting gas regressions in Solidity tests by recording per-test gas usage and flagging deviations during CI.

Core Features & Use Cases

  • Gas snapshot generation via forge snapshot
  • Regression checks in CI with tolerance
  • Gas reports and per-function breakdown
  • Snapshot-driven optimization feedback

Quick Start

Run forge snapshot to generate the baseline and enable regression checks in your CI pipeline.

Frequently Asked Questions about gas-snapshot-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I track Solidity gas costs and catch regressions in CI?

You can track Solidity gas costs by generating a baseline with forge snapshot, committing the .gas-snapshot file, and comparing future test runs against it in your CI pipeline to flag deviations.

What is a forge snapshot and how does it detect gas regressions?

A forge snapshot records per-test gas usage for Solidity contracts. By comparing new snapshot outputs against a committed baseline, it detects gas regressions during local development and CI checks.

How do I set a tolerance for gas regression checks in Foundry?

You can set a tolerance for gas regression checks when running forge snapshot, allowing minor deviations in gas usage to pass CI checks without failing the pipeline over insignificant cost changes.

Do I need Foundry installed to use gas snapshots for Solidity tests?

Yes, you need Foundry with forge installed to generate and compare gas snapshots. The workflow requires a committed .gas-snapshot file and the ability to run forge snapshot for regression checks.

Can I get a per-function gas breakdown for multi-contract Solidity suites?

Yes, gas snapshots provide gas reports and per-function breakdowns across multi-contract suites, delivering snapshot-driven optimization feedback to identify specific areas causing gas regressions.

What's the best way to automate gas cost checks in a Solidity CI pipeline?

Automate gas cost checks by running forge snapshot in your CI pipeline to compare current test gas usage against a committed .gas-snapshot baseline, catching regressions before deployment with configurable tolerance.