DeFi Protocol Templates
wshobson/agents
Solidity templates for DeFi building blocks: staking with reward distribution, an automated market maker, governance tokens and flash loans.
Front-running and MEV protection patterns for Solidity protocols.
$ npx skills add ccashwell/evm-cortex --skill front-running-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ccashwell/evm-cortex front-running-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/front-running-patterns .claude/skills/front-running-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 "front-running-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/front-running-patterns into .claude/skills/front-running-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "front-running-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/front-running-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 front-running-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ccashwell/evm-cortex front-running-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/front-running-patterns .agents/skills/front-running-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 "front-running-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/front-running-patterns into .agents/skills/front-running-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "front-running-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 front-running-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ccashwell/evm-cortex front-running-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/front-running-patterns .cursor/skills/front-running-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 "front-running-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/front-running-patterns into .cursor/skills/front-running-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "front-running-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/front-running-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 front-running-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ccashwell/evm-cortex front-running-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/front-running-patterns .gemini/skills/front-running-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 "front-running-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/front-running-patterns into .gemini/skills/front-running-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "front-running-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 front-running-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 front-running-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/front-running-patterns .github/skills/front-running-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 "front-running-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/front-running-patterns into .github/skills/front-running-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "front-running-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 front-running-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 front-running-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/front-running-patterns .opencode/skills/front-running-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 "front-running-patterns" agent skill from https://github.com/ccashwell/evm-cortex/tree/main/skills/front-running-patterns into .opencode/skills/front-running-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "front-running-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.
front-running-patternsFront-running and MEV protection patterns for Solidity protocols.
Front Running Patterns is an agent skill from ccashwell/evm-cortex. Front-running and MEV protection patterns for Solidity protocols. Use when designing swaps, auctions, NFT mints, or any transaction-ordering-dependent logic. Covers sandwich attacks, commit-reveal, Flashbots, slippage protection, and deadline parameters.
Its SKILL.md is about 1.5k 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 Backend & APIs, covering Crypto and DeFi analysis and Smart contracts. It works with Solidity. 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 and typescript).
From the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
rpc.flashbots.netFrom 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.
Front Running Patterns loads about 1.5k tokens when it runs. Until then it costs about 69 tokens; SKILL.md has 269 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). 269 words, ~1,514 tokens.
.claude/skills/front-running-patterns/SKILL.md (or your agent's skills folder).Maximal Extractable Value (MEV) is the profit extractable by reordering, inserting, or censoring transactions within a block. Validators and searchers extract MEV through:
1. Victim submits swap: buy 100 ETH of TOKEN
2. Attacker front-runs: buys TOKEN, pushing price up
3. Victim's swap executes at worse price
4. Attacker back-runs: sells TOKEN at inflated priceerror SlippageExceeded(uint256 amountOut, uint256 minAmountOut);
function swap(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 minAmountOut, // user sets minimum acceptable output
uint256 deadline
) external returns (uint256 amountOut) {
if (block.timestamp > deadline) revert Expired();
amountOut = _executeSwap(tokenIn, tokenOut, amountIn);
if (amountOut < minAmountOut) {
revert SlippageExceeded(amountOut, minAmountOut);
}
emit Swapped(msg.sender, tokenIn, tokenOut, amountIn, amountOut);
}Without deadlines, pending transactions can be held in the mempool and executed later at unfavorable prices.
modifier beforeDeadline(uint256 deadline) {
if (block.timestamp > deadline) revert TransactionExpired(deadline, block.timestamp);
_;
}
function addLiquidity(
uint256 amount0,
uint256 amount1,
uint256 minLiquidity,
uint256 deadline
) external beforeDeadline(deadline) returns (uint256 liquidity) {
// ...
}For auctions, NFT mints, or any scenario where knowing the action gives an advantage.
uint256 public constant COMMIT_PERIOD = 1 hours;
uint256 public constant REVEAL_PERIOD = 30 minutes;
uint256 public constant MIN_COMMIT_AGE = 2 minutes; // at least 1 block gap
mapping(address => bytes32) public commitments;
mapping(address => uint256) public commitTimestamps;
function commit(bytes32 hash) external {
commitments[msg.sender] = hash;
commitTimestamps[msg.sender] = block.timestamp;
emit Committed(msg.sender);
}
function reveal(uint256 bid, bytes32 salt) external {
uint256 commitTime = commitTimestamps[msg.sender];
if (commitTime == 0) revert NoCommitment();
if (block.timestamp < commitTime + MIN_COMMIT_AGE) revert RevealTooEarly();
if (block.timestamp > commitTime + COMMIT_PERIOD + REVEAL_PERIOD) revert RevealExpired();
bytes32 expected = keccak256(abi.encodePacked(msg.sender, bid, salt));
if (commitments[msg.sender] != expected) revert InvalidReveal();
commitments[msg.sender] = bytes32(0);
_processBid(msg.sender, bid);
}Transactions submitted through Flashbots or similar services skip the public mempool, making them invisible to sandwich bots.
// Frontend integration: submit via Flashbots Protect RPC
const provider = new ethers.JsonRpcProvider("https://rpc.flashbots.net");
const tx = await signer.sendTransaction({
to: routerAddress,
data: encodedSwap,
// Flashbots Protect: not visible in public mempool
});Limitations:
Any logic where the outcome depends on transaction order is vulnerable.
// VULNERABLE: first caller wins
function claim(uint256 tokenId) external {
require(!claimed[tokenId], "Already claimed");
claimed[tokenId] = true;
_mint(msg.sender, tokenId);
}
// SAFER: randomized or committed selection
// Use commit-reveal or Chainlink VRF for fair selection// Track when liquidity was added to prevent JIT manipulation
mapping(uint256 => uint256) public positionMintBlock;
function mint(uint256 positionId, ...) external {
positionMintBlock[positionId] = block.number;
// ...
}
function collectFees(uint256 positionId) external {
// Require liquidity existed for at least N blocks before fee collection
if (block.number - positionMintBlock[positionId] < MIN_LIQUIDITY_BLOCKS) {
revert LiquidityTooRecent();
}
// ...
}Oracle price updates can be front-run by MEV searchers who see the update in the mempool.
1. Chainlink oracle update TX: ETH price changes from $2000 → $2100
2. Attacker front-runs: opens leveraged long at $2000
3. Oracle updates: price becomes $2100
4. Attacker closes: profit from $100 move with leverageDefense:
minAmountOut) on all swap functions© 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/front-running-patterns of ccashwell/evm-cortex.
Open the folder on GitHubat commit f8f3301
Front Running 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 |
|---|---|---|---|---|---|---|
| Front Running Patterns this skillccashwell/evm-cortex | 131 | — | ~1.5k | Automated safety check: Pass | MIT | |
| DeFi Protocol Templateswshobson/agents | 40k | 10 repos | ~1.9k | Automated safety check: Pass | MIT | |
| Ethskillsaustintgriffith/ethskills | 294 | — | ~1.4k | Automated safety check: Pass | None | |
| Chaingptinternet-court/internet-court-skill | 6.4k | 1 repos | ~4k | Automated safety check: Pass | MIT | |
| Solidity Vulnerability Scanneralt-research2/SolidityGuard | 104 | — | ~1.6k | Automated safety check: Notes | Custom licence | |
| Ethskillsaustintgriffith/ethskills | 294 | — | ~3k | Automated safety check: Pass | None |
wshobson/agents
Solidity templates for DeFi building blocks: staking with reward distribution, an automated market maker, governance tokens and flash loans.
austintgriffith/ethskills
Ethereum development knowledge for AI agents — from idea to deployed dApp.
internet-court/internet-court-skill
Build with the ChainGPT Web3 AI developer platform. An agent skill from internet-court/internet-court-skill.
alt-research2/SolidityGuard
Comprehensive Solidity contract security scanner detecting 104 vulnerability patterns across reentrancy, access control, arithmetic, DeFi, proxy, and token categories.
austintgriffith/ethskills
A skill your agent uses when a request involves Ethereum, the EVM, or blockchain systems.
Microck/ordinary-claude-skills
Expert blockchain developer specializing in smart contract development, DApp architecture, and DeFi protocols.
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
Front-running and MEV protection patterns for Solidity protocols. Front Running Patterns is an agent skill from ccashwell/evm-cortex. Front-running and MEV protection patterns for Solidity protocols.
Front Running Patterns fits situations like: designing swaps; any transaction-ordering-dependent logic.
Run `npx skills add ccashwell/evm-cortex --skill front-running-patterns -a claude-code`. Or copy the skill folder (skills/front-running-patterns in ccashwell/evm-cortex) into .claude/skills/front-running-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ccashwell/evm-cortex --skill front-running-patterns -a codex`. Or copy the skill folder (skills/front-running-patterns in ccashwell/evm-cortex) into .agents/skills/front-running-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 front-running-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/front-running-patterns, .gemini/skills/front-running-patterns, .github/skills/front-running-patterns and .opencode/skills/front-running-patterns in your project.
SKILL.md names no scripts, command-line tools or credentials: Front Running Patterns is instructions for the agent only.
SKILL.md names 1 domain. In commands or code: rpc.flashbots.net; the agent is likely to contact it when it follows the instructions. 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.
Front Running 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.5k tokens (SKILL.md is roughly 6.1k 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 Front Running Patterns: DeFi Protocol Templates (wshobson/agents, 40k stars), Ethskills (austintgriffith/ethskills, 294 stars), Chaingpt (internet-court/internet-court-skill, 6.4k stars) and Solidity Vulnerability Scanner (alt-research2/SolidityGuard, 104 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.