Foundry Deploy Fixtures
aviggiano/security
Create or refactor Foundry deployment fixtures for Solidity tests.
Library design patterns for reusable Solidity code. An agent skill from ccashwell/evm-cortex.
$ npx skills add ccashwell/evm-cortex --skill library-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ccashwell/evm-cortex library-patterns --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/library-patterns .claude/skills/library-patterns && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "library-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/library-patterns into .claude/skills/library-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "library-patterns", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/ccashwell/evm-cortex/tree/main/skills/library-patternsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add ccashwell/evm-cortex --skill library-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ccashwell/evm-cortex library-patterns --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/library-patterns .agents/skills/library-patterns && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "library-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/library-patterns into .agents/skills/library-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "library-patterns", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ccashwell/evm-cortex --skill library-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ccashwell/evm-cortex library-patterns --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/library-patterns .cursor/skills/library-patterns && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "library-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/library-patterns into .cursor/skills/library-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "library-patterns", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/ccashwell/evm-cortex.git --path skills/library-patterns--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add ccashwell/evm-cortex --skill library-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ccashwell/evm-cortex library-patterns --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/library-patterns .gemini/skills/library-patterns && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "library-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/library-patterns into .gemini/skills/library-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "library-patterns", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install ccashwell/evm-cortex library-patternsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add ccashwell/evm-cortex --skill library-patterns -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/library-patterns .github/skills/library-patterns && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "library-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/library-patterns into .github/skills/library-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "library-patterns", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ccashwell/evm-cortex --skill library-patterns -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install ccashwell/evm-cortex library-patterns --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/library-patterns .opencode/skills/library-patterns && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "library-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/library-patterns into .opencode/skills/library-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "library-patterns", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
library-patternsLibrary design patterns for reusable Solidity code. An agent skill from ccashwell/evm-cortex.
Library Patterns is an agent skill from ccashwell/evm-cortex. Library design patterns for reusable Solidity code. Use when creating shared utilities, math libraries, or type-safe operations. Covers internal vs external libraries, using-for, deployment patterns, and common math libraries.
Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Smart contracts, Design patterns and Type safety. It works with Solidity. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.
6 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit f8f3301. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are solidity).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Library Patterns loads about 1.6k tokens when it runs. Until then it costs about 61 tokens; SKILL.md has 284 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from ccashwell/evm-cortex at commit f8f3301, republished under its MIT licence (© ccashwell). 284 words, ~1,583 tokens.
.claude/skills/library-patterns/SKILL.md (or your agent's skills folder).| Feature | Internal (embedded) | External (deployed) |
|---|---|---|
| Deployment | Inlined into calling contract | Deployed separately, linked |
| Call type | JUMP (cheap) | DELEGATECALL (expensive) |
| State access | Reads caller's storage | Reads caller's storage via delegatecall |
| Gas cost | Lower per call | Higher per call, lower deploy if shared |
| Use case | Small utilities, math | Large shared code across many contracts |
// Internal library — inlined at compile time
library SafeCast {
error SafeCast_Overflow();
function toUint128(uint256 value) internal pure returns (uint128) {
if (value > type(uint128).max) revert SafeCast_Overflow();
return uint128(value);
}
function toUint96(uint256 value) internal pure returns (uint96) {
if (value > type(uint96).max) revert SafeCast_Overflow();
return uint96(value);
}
function toInt256(uint256 value) internal pure returns (int256) {
if (value > uint256(type(int256).max)) revert SafeCast_Overflow();
return int256(value);
}
}Attach library functions to types for cleaner syntax.
using SafeCast for uint256;
using FixedPointMathLib for uint256;
function calculateShares(uint256 assets, uint256 totalAssets, uint256 totalShares)
internal
pure
returns (uint256)
{
return assets.mulDivDown(totalShares, totalAssets);
}
function packTimestamp(uint256 timestamp) internal pure returns (uint48) {
return timestamp.toUint48();
}// In a shared file, apply globally to all files that import it
using SafeCast for uint256 global;
using FixedPointMathLib for uint256 global;The gold standard for fixed-point math. Gas-optimized with assembly.
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";
using FixedPointMathLib for uint256;
// Multiply then divide, rounding down — prevents phantom overflow
uint256 shares = assets.mulDivDown(totalShares, totalAssets);
// Multiply then divide, rounding up — useful for debt calculations
uint256 debt = borrowed.mulDivUp(interestRate, PRECISION);
// WAD math (18 decimal fixed point)
uint256 result = a.mulWadDown(b); // (a * b) / 1e18, round down
uint256 result = a.divWadUp(b); // (a * 1e18) / b, round up
// Square root
uint256 sqrtPrice = FixedPointMathLib.sqrt(price);| Context | Direction | Reason |
|---|---|---|
| Minting shares from assets | Round down | Fewer shares protects vault |
| Burning shares for assets | Round down | Fewer assets protects vault |
| Calculating debt owed | Round up | More debt protects lender |
| Calculating collateral required | Round up | More collateral protects protocol |
| Fee calculation | Round up | Ensures protocol collects at least the fee |
Encapsulate operations on custom types in libraries.
struct Position {
uint128 collateral;
uint128 debt;
uint48 lastUpdate;
uint16 healthFactor;
}
library PositionLib {
using SafeCast for uint256;
using FixedPointMathLib for uint256;
error Position_Undercollateralized();
function addCollateral(Position storage self, uint256 amount) internal {
self.collateral += amount.toUint128();
self.lastUpdate = uint48(block.timestamp);
}
function addDebt(Position storage self, uint256 amount) internal {
self.debt += amount.toUint128();
self.lastUpdate = uint48(block.timestamp);
}
function healthFactor(Position storage self, uint256 price)
internal
view
returns (uint256)
{
if (self.debt == 0) return type(uint256).max;
return uint256(self.collateral).mulDivDown(price, uint256(self.debt));
}
function isHealthy(Position storage self, uint256 price, uint256 minHealth)
internal
view
returns (bool)
{
return healthFactor(self, price) >= minHealth;
}
}Usage:
using PositionLib for Position;
mapping(address => Position) public positions;
function addCollateral(uint256 amount) external {
positions[msg.sender].addCollateral(amount);
// ...
}For onchain iteration requirements, use OpenZeppelin's EnumerableSet.
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet private _whitelistedTokens;
function addToken(address token) external onlyOwner {
if (!_whitelistedTokens.add(token)) revert AlreadyWhitelisted();
}
function isWhitelisted(address token) external view returns (bool) {
return _whitelistedTokens.contains(token);
}
function getWhitelistedTokens() external view returns (address[] memory) {
return _whitelistedTokens.values();
}internal unless deployment sharing is neededusing-for applied to relevant types© ccashwell, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/library-patterns of ccashwell/evm-cortex.
Open the folder on GitHubat commit f8f3301
Library Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Library Patterns this skillccashwell/evm-cortex | 131 | — | ~1.6k | Automated safety check: Pass | MIT | |
| Foundry Deploy Fixturesaviggiano/security | 144 | — | ~634 | Automated safety check: Pass | MIT | |
| New Configlidofinance/diffyscan | 142 | — | ~1k | Automated safety check: Pass | MIT | |
| Validate Configlidofinance/diffyscan | 142 | — | ~1.1k | Automated safety check: Pass | MIT | |
| Foundry Differential Testsaviggiano/security | 144 | — | ~613 | Automated safety check: Pass | MIT | |
| Smart Contract InteractionNethereum/Nethereum | 2.3k | — | ~1.9k | Automated safety check: Pass | MIT |
aviggiano/security
Create or refactor Foundry deployment fixtures for Solidity tests.
lidofinance/diffyscan
Creates or extends a Diffyscan verification config for a deployed contract or deployment.
lidofinance/diffyscan
Reviews an existing Diffyscan YAML or JSON config for load errors, runtime prerequisites, pinned sources, address mappings and broad exceptions.
aviggiano/security
Create Foundry differential tests comparing production Solidity contracts against an independent reference model.
Nethereum/Nethereum
Interact with Ethereum smart contracts using Nethereum typed DTOs.
lidofinance/staking-modules
Update the current-branch GitHub PR title, description, and labels with gh CLI using this repository's PR template.
ccashwell/evm-cortex
A skill your agent uses when preparing for a security audit, performing reconnaissance on a new codebase, or creating a protocol overview.
ccashwell/evm-cortex
A skill your agent uses when integrating with Aave V3 for lending, borrowing, flash loans, or building on top of Aave markets.
ccashwell/evm-cortex
Access control design patterns for Solidity protocols. An agent skill from ccashwell/evm-cortex.
ccashwell/evm-cortex
A skill your agent uses when running a local Ethereum node with Anvil.
ccashwell/evm-cortex
A skill your agent uses when performing systematic breadth-first review of all contracts during a security audit.
ccashwell/evm-cortex
A skill your agent uses when performing deep analysis of specific findings or high-risk areas during a security audit.
Works with
Categories
Library design patterns for reusable Solidity code. An agent skill from ccashwell/evm-cortex. Library Patterns is an agent skill from ccashwell/evm-cortex. Library design patterns for reusable Solidity code.
Library Patterns fits situations like: creating shared utilities; type-safe operations.
Run `npx skills add ccashwell/evm-cortex --skill library-patterns -a claude-code`. Or copy the skill folder (skills/library-patterns in ccashwell/evm-cortex) into .claude/skills/library-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ccashwell/evm-cortex --skill library-patterns -a codex`. Or copy the skill folder (skills/library-patterns in ccashwell/evm-cortex) into .agents/skills/library-patterns in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ccashwell/evm-cortex --skill library-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/library-patterns, .gemini/skills/library-patterns, .github/skills/library-patterns and .opencode/skills/library-patterns in your project.
SKILL.md names no scripts, command-line tools or credentials: Library Patterns is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Library Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.6k tokens (SKILL.md is roughly 6.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Library Patterns: Foundry Deploy Fixtures (aviggiano/security, 144 stars), New Config (lidofinance/diffyscan, 142 stars), Validate Config (lidofinance/diffyscan, 142 stars) and Foundry Differential Tests (aviggiano/security, 144 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
ccashwell (a GitHub user) maintains it in ccashwell/evm-cortex, which has 131 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on September 30, 2026.
Source: ccashwell/evm-cortex on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.