Golang Patterns
affaan-m/ECC
Go-specific design patterns and best practices including functional options, small interfaces, dependency injection, concurrency patterns, error handling, and package organization.
A skill your agent uses when building large modular contracts with EIP-2535 Diamond pattern.
$ npx skills add ccashwell/evm-cortex --skill diamond-pattern -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ccashwell/evm-cortex diamond-pattern --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/diamond-pattern .claude/skills/diamond-pattern && 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 "diamond-pattern" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/diamond-pattern into .claude/skills/diamond-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "diamond-pattern", 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/diamond-patternType 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 diamond-pattern -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ccashwell/evm-cortex diamond-pattern --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/diamond-pattern .agents/skills/diamond-pattern && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "diamond-pattern" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/diamond-pattern into .agents/skills/diamond-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "diamond-pattern", 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 diamond-pattern -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ccashwell/evm-cortex diamond-pattern --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/diamond-pattern .cursor/skills/diamond-pattern && 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 "diamond-pattern" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/diamond-pattern into .cursor/skills/diamond-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "diamond-pattern", 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/diamond-pattern--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 diamond-pattern -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ccashwell/evm-cortex diamond-pattern --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/diamond-pattern .gemini/skills/diamond-pattern && 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 "diamond-pattern" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/diamond-pattern into .gemini/skills/diamond-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "diamond-pattern", 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 diamond-patternInstalls 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 diamond-pattern -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/diamond-pattern .github/skills/diamond-pattern && 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 "diamond-pattern" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/diamond-pattern into .github/skills/diamond-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "diamond-pattern", 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 diamond-pattern -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 diamond-pattern --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/diamond-pattern .opencode/skills/diamond-pattern && 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 "diamond-pattern" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/diamond-pattern into .opencode/skills/diamond-pattern/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "diamond-pattern", 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.
diamond-patternA skill your agent uses when building large modular contracts with EIP-2535 Diamond pattern.
Diamond Pattern is an agent skill from ccashwell/evm-cortex. Use when building large modular contracts with EIP-2535 Diamond pattern. Covers facets, diamondCut, diamond loupe, AppStorage and DiamondStorage patterns, selector mapping, and facet upgrade process.
Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.
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.
Diamond Pattern loads about 1.9k tokens when it runs. Until then it costs about 54 tokens; SKILL.md has 216 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). 216 words, ~1,877 tokens.
.claude/skills/diamond-pattern/SKILL.md (or your agent's skills folder).The Diamond pattern splits a contract into multiple "facets" (logic modules) that share a single storage and address. Bypasses the 24KB contract size limit and enables surgical upgrades of individual functions.
User → Diamond Proxy
├── FacetA (functions a1, a2)
├── FacetB (functions b1, b2, b3)
├── DiamondCutFacet (add/replace/remove functions)
└── DiamondLoupeFacet (introspection)All facets share the Diamond's storage context via delegatecall.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {LibDiamond} from "./libraries/LibDiamond.sol";
contract Diamond {
constructor(address contractOwner, address diamondCutFacet) payable {
LibDiamond.setContractOwner(contractOwner);
LibDiamond.FacetCut[] memory cut = new LibDiamond.FacetCut[](1);
bytes4[] memory selectors = new bytes4[](1);
selectors[0] = IDiamondCut.diamondCut.selector;
cut[0] = LibDiamond.FacetCut({
facetAddress: diamondCutFacet,
action: LibDiamond.FacetCutAction.Add,
functionSelectors: selectors
});
LibDiamond.diamondCut(cut, address(0), "");
}
fallback() external payable {
LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
address facet = ds.selectorToFacetAndPosition[msg.sig].facetAddress;
require(facet != address(0), "Diamond: Function does not exist");
assembly {
calldatacopy(0, 0, calldatasize())
let result := delegatecall(gas(), facet, 0, calldatasize(), 0, 0)
returndatacopy(0, 0, returndatasize())
switch result
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
receive() external payable {}
}interface IDiamondCut {
enum FacetCutAction { Add, Replace, Remove }
struct FacetCut {
address facetAddress;
FacetCutAction action;
bytes4[] functionSelectors;
}
event DiamondCut(FacetCut[] diamondCut, address init, bytes calldata);
function diamondCut(
FacetCut[] calldata diamondCut_,
address init_,
bytes calldata calldata_
) external;
}All state in one struct at a fixed position:
struct AppStorage {
// Token state
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) allowances;
uint256 totalSupply;
string name;
string symbol;
// Protocol state
address treasury;
uint256 feeRate;
mapping(address => bool) operators;
}
library LibAppStorage {
bytes32 constant APP_STORAGE_POSITION = keccak256("myprotocol.app.storage");
function appStorage() internal pure returns (AppStorage storage s) {
bytes32 position = APP_STORAGE_POSITION;
assembly { s.slot := position }
}
}
// Usage in any facet:
contract TokenFacet {
function balanceOf(address account) external view returns (uint256) {
return LibAppStorage.appStorage().balances[account];
}
}Each facet gets its own storage namespace. Better for composable/reusable facets:
library LibTokenStorage {
bytes32 constant STORAGE_POSITION = keccak256("myprotocol.token.storage");
struct TokenStorage {
mapping(address => uint256) balances;
uint256 totalSupply;
}
function tokenStorage() internal pure returns (TokenStorage storage s) {
bytes32 position = STORAGE_POSITION;
assembly { s.slot := position }
}
}
library LibGovernanceStorage {
bytes32 constant STORAGE_POSITION = keccak256("myprotocol.governance.storage");
struct GovernanceStorage {
mapping(uint256 => Proposal) proposals;
uint256 proposalCount;
}
function governanceStorage() internal pure returns (GovernanceStorage storage s) {
bytes32 position = STORAGE_POSITION;
assembly { s.slot := position }
}
}contract ERC20Facet {
using LibAppStorage for *;
event Transfer(address indexed from, address indexed to, uint256 value);
function transfer(address to, uint256 amount) external returns (bool) {
AppStorage storage s = LibAppStorage.appStorage();
require(s.balances[msg.sender] >= amount, "Insufficient balance");
s.balances[msg.sender] -= amount;
s.balances[to] += amount;
emit Transfer(msg.sender, to, amount);
return true;
}
function balanceOf(address account) external view returns (uint256) {
return LibAppStorage.appStorage().balances[account];
}
}interface IDiamondLoupe {
struct Facet {
address facetAddress;
bytes4[] functionSelectors;
}
function facets() external view returns (Facet[] memory);
function facetFunctionSelectors(address facet) external view returns (bytes4[] memory);
function facetAddresses() external view returns (address[] memory);
function facetAddress(bytes4 selector) external view returns (address);
}// Add new functions
IDiamondCut.FacetCut[] memory cuts = new IDiamondCut.FacetCut[](1);
bytes4[] memory selectors = new bytes4[](2);
selectors[0] = NewFacet.newFunction1.selector;
selectors[1] = NewFacet.newFunction2.selector;
cuts[0] = IDiamondCut.FacetCut({
facetAddress: address(newFacet),
action: IDiamondCut.FacetCutAction.Add,
functionSelectors: selectors
});
// With initialization callback
diamond.diamondCut(cuts, address(initContract), abi.encodeCall(DiamondInit.init, ()));
// Replace existing functions
cuts[0].action = IDiamondCut.FacetCutAction.Replace;
// Remove functions (set facetAddress to address(0))
cuts[0].facetAddress = address(0);
cuts[0].action = IDiamondCut.FacetCutAction.Remove;| Aspect | UUPS | Diamond |
|---|---|---|
| Max contract size | 24KB | Unlimited (split across facets) |
| Upgrade granularity | Whole implementation | Per-function |
| Shared storage | N/A | All facets share |
| Complexity | Low | High |
| Audit cost | Lower | Higher |
| Introspection | No | DiamondLoupe |
diamondCutforge inspect)diamondCut (no two facets share a selector)© 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/diamond-pattern of ccashwell/evm-cortex.
Open the folder on GitHubat commit f8f3301
Diamond Pattern 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 |
|---|---|---|---|---|---|---|
| Diamond Pattern this skillccashwell/evm-cortex | 131 | — | ~1.9k | Automated safety check: Pass | MIT | |
| Golang Patternsaffaan-m/ECC | 275k | — | ~1.1k | Automated safety check: Pass | MIT | |
| Kotlin Exposed Patternsaffaan-m/ECC | 275k | 4 repos | ~5.5k | Automated safety check: Pass | MIT | |
| Dotnet Patternsaffaan-m/ECC | 275k | 1 repos | ~2.3k | Automated safety check: Pass | MIT | |
| Fastapi Patternsaffaan-m/ECC | 275k | — | ~2.3k | Automated safety check: Pass | MIT | |
| Python Patternsaffaan-m/ECC | 275k | — | ~2.3k | Automated safety check: Pass | MIT |
affaan-m/ECC
Go-specific design patterns and best practices including functional options, small interfaces, dependency injection, concurrency patterns, error handling, and package organization.
affaan-m/ECC
JetBrains Exposed ORM patterns including DSL queries, DAO pattern, transactions, HikariCP connection pooling, Flyway migrations, and repository pattern.
affaan-m/ECC
Idiomatic C and .NET patterns, conventions, dependency injection, async/await, and best practices for building robust, maintainable .NET applications.
affaan-m/ECC
FastAPI patterns for async APIs, dependency injection, Pydantic request and response models, OpenAPI docs, tests, security, and production readiness.
affaan-m/ECC
Python-specific design patterns and best practices including protocols, dataclasses, context managers, decorators, async/await, type hints, and package organization.
sickn33/agentic-awesome-skills
Reference document for monopoly patterns. An agent skill from sickn33/agentic-awesome-skills.
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.
A skill your agent uses when building large modular contracts with EIP-2535 Diamond pattern. Diamond Pattern is an agent skill from ccashwell/evm-cortex. Use when building large modular contracts with EIP-2535 Diamond pattern.
Diamond Pattern fits situations like: building large modular contracts with EIP-2535 Diamond pattern.
Run `npx skills add ccashwell/evm-cortex --skill diamond-pattern -a claude-code`. Or copy the skill folder (skills/diamond-pattern in ccashwell/evm-cortex) into .claude/skills/diamond-pattern in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ccashwell/evm-cortex --skill diamond-pattern -a codex`. Or copy the skill folder (skills/diamond-pattern in ccashwell/evm-cortex) into .agents/skills/diamond-pattern 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 diamond-pattern -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/diamond-pattern, .gemini/skills/diamond-pattern, .github/skills/diamond-pattern and .opencode/skills/diamond-pattern in your project.
SKILL.md names no scripts, command-line tools or credentials: Diamond Pattern 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.
Diamond Pattern 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.9k tokens (SKILL.md is roughly 7.5k 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 Diamond Pattern: Golang Patterns (affaan-m/ECC, 275k stars), Kotlin Exposed Patterns (affaan-m/ECC, 275k stars), Dotnet Patterns (affaan-m/ECC, 275k stars) and Fastapi Patterns (affaan-m/ECC, 275k 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.