assembly-patterns

Apply Yul/inline assembly patterns to optimize Solidity gas usage.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Yul/inline assembly patterns enable advanced Solidity optimizations by giving developers low-level control to squeeze gas savings in hot paths, while guiding safe usage and clear documentation.

Core Features & Use Cases

  • Memory management and efficient hashing with inline assembly to reduce gas costs in memory-heavy operations.
  • Bitwise packing, custom errors, and low-level calls for precise performance tuning and safer contracts.
  • Best practices, NatSpec documentation, and testing guidelines to ensure maintainable and auditable assembly blocks.

Quick Start

Run a targeted audit of a hot path, implement the appropriate assembly pattern, and verify gas savings with formal tests.

Frequently Asked Questions about assembly-patterns

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

FAQPage Schema
How do I optimize Solidity gas costs using inline assembly?

Yes, inline assembly enables precise memory management in Solidity by allowing direct manipulation of memory pointers and efficient hashing operations. This low-level control reduces gas costs significantly in memory-heavy smart contract operations.

What is the best way to implement bit packing and low-level calls in Solidity?

The best way to implement bit packing and low-level calls is using Yul inline assembly patterns. These enable precise performance tuning and safer contracts by providing direct access to EVM operations without standard Solidity overhead.

When should I use Yul assembly patterns instead of standard Solidity?

You should apply Yul assembly patterns specifically in hot-path contracts requiring substantial gas savings. Implement targeted audits to identify optimization opportunities, then verify gas reductions through formal testing with gas reports to ensure safe, auditable assembly blocks.

Does using inline assembly in Solidity require special testing and documentation?

Yes, using inline assembly requires explicit NatSpec documentation and validated testing with gas reports. These practices ensure that low-level Yul patterns remain maintainable and auditable, providing clear usage guidelines and verifying gas savings without compromising contract safety.