Agent skill

Flash Loan Usage

by ccashwell in ccashwell/evm-cortex

A skill your agent uses when implementing flash loan strategies including arbitrage, liquidation bots, collateral swaps, or debt refinancing.

MITAuto-check passedBusiness, Finance & HR

Install Flash Loan Usage

skills CLI
$ npx skills add ccashwell/evm-cortex --skill flash-loan-usage -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ccashwell/evm-cortex flash-loan-usage --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/flash-loan-usage .claude/skills/flash-loan-usage && rm -rf skills-src

Use ~/.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/

Facts

Skill name
flash-loan-usage
GitHub stars
131
Token cost
~1.6k tokens
SKILL.md length
186 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when implementing flash loan strategies including arbitrage, liquidation bots, collateral swaps, or debt refinancing.

  • Implementing flash loan strategies including arbitrage
  • SKILL.md covers Flash Loan Providers, Aave V3 Flash Loan Receiver, Aave V3 Multi-Asset Flash Loan and Uniswap V3 Flash Swap, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Liquidation bots

What it does

Flash Loan Usage is an agent skill from ccashwell/evm-cortex. Use when implementing flash loan strategies including arbitrage, liquidation bots, collateral swaps, or debt refinancing. Covers Aave V3, Uniswap, and Balancer flash loan patterns with receiver templates.

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 Business, Finance & HR. It works with Uniswap. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Implementing flash loan strategies including arbitrage
  • Liquidation bots
  • Collateral swaps
  • Debt refinancing

Example prompts

  • “/flash-loan-usage”

What it can do on your machine

Read from SKILL.md and the folder at commit f8f3301. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    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.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Flash Loan Usage loads about 1.6k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 186 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~55
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from ccashwell/evm-cortex at commit f8f3301, republished under its MIT licence (© ccashwell). 186 words, ~1,649 tokens.

Download SKILL.mdSave it as .claude/skills/flash-loan-usage/SKILL.md (or your agent's skills folder).
name
flash-loan-usage
description
Use when implementing flash loan strategies including arbitrage, liquidation bots, collateral swaps, or debt refinancing. Covers Aave V3, Uniswap, and Balancer flash loan patterns with receiver templates.

Flash Loan Patterns

Flash Loan Providers

ProviderFeeMulti-AssetNotes
Aave V30.05%Yes (flashLoan)Most popular, widest asset support
Uniswap V2/V30.3% / pool feeYes (flash swap)Built into swap, repay with other token
Uniswap V40%Yes (flash accounting)Enabled by PoolManager's delta-tracking which will always settle cleanly as long as the full delta is repaid within the unlock context.
Balancer V20%YesFree, limited to Balancer vault assets
dYdX0%LimitedSolo margin flash loans

Aave V3 Flash Loan Receiver

solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {FlashLoanSimpleReceiverBase} from
    "@aave/v3-core/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol";
import {IPoolAddressesProvider} from
    "@aave/v3-core/contracts/interfaces/IPoolAddressesProvider.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract AaveFlashLoan is FlashLoanSimpleReceiverBase {
    address public immutable owner;

    constructor(IPoolAddressesProvider provider)
        FlashLoanSimpleReceiverBase(provider)
    {
        owner = msg.sender;
    }

    function executeOperation(
        address asset,
        uint256 amount,
        uint256 premium,
        address initiator,
        bytes calldata params
    ) external override returns (bool) {
        require(msg.sender == address(POOL), "caller must be pool");
        require(initiator == address(this), "untrusted initiator");

        (uint8 action) = abi.decode(params, (uint8));

        if (action == 1) _arbitrage(asset, amount);
        else if (action == 2) _liquidate(asset, amount, params);
        else if (action == 3) _collateralSwap(asset, amount, params);

        uint256 repayment = amount + premium;
        IERC20(asset).approve(address(POOL), repayment);
        return true;
    }

    function execute(address asset, uint256 amount, bytes calldata params) external {
        require(msg.sender == owner, "only owner");
        POOL.flashLoanSimple(address(this), asset, amount, params, 0);
    }

    function _arbitrage(address asset, uint256 amount) internal {
        // Buy low on DEX A, sell high on DEX B
        // Profit must exceed the 0.05% premium
    }

    function _liquidate(address asset, uint256 amount, bytes calldata params) internal {
        // Use borrowed funds to liquidate an underwater position
        // Receive collateral at a discount, swap back to repay
    }

    function _collateralSwap(address asset, uint256 amount, bytes calldata params) internal {
        // Repay existing debt, withdraw old collateral
        // Swap to new collateral, deposit, re-borrow
    }
}

Aave V3 Multi-Asset Flash Loan

solidity
function executeMultiFlash(
    address[] calldata assets,
    uint256[] calldata amounts
) external {
    uint256[] memory modes = new uint256[](assets.length);
    // mode 0 = full repay, 1 = stable debt, 2 = variable debt
    POOL.flashLoan(
        address(this),
        assets,
        amounts,
        modes,
        address(this), // onBehalfOf
        "",            // params
        0              // referralCode
    );
}

Uniswap V3 Flash Swap

solidity
import {IUniswapV3FlashCallback} from
    "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3FlashCallback.sol";

contract UniV3Flash is IUniswapV3FlashCallback {
    IUniswapV3Pool public immutable pool;

    function initFlash(uint256 amount0, uint256 amount1) external {
        pool.flash(address(this), amount0, amount1, abi.encode(msg.sender));
    }

    function uniswapV3FlashCallback(
        uint256 fee0,
        uint256 fee1,
        bytes calldata data
    ) external override {
        require(msg.sender == address(pool), "unauthorized");

        address caller = abi.decode(data, (address));
        // Use amount0 + amount1 here

        // Repay: principal + fee
        if (fee0 > 0) IERC20(pool.token0()).transfer(address(pool), amount0 + fee0);
        if (fee1 > 0) IERC20(pool.token1()).transfer(address(pool), amount1 + fee1);
    }
}

Balancer V2 Flash Loan (Zero Fee)

solidity
import {IFlashLoanRecipient} from
    "@balancer-labs/v2-interfaces/contracts/vault/IFlashLoanRecipient.sol";
import {IVault} from "@balancer-labs/v2-interfaces/contracts/vault/IVault.sol";

contract BalancerFlash is IFlashLoanRecipient {
    IVault public constant VAULT = IVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);

    function receiveFlashLoan(
        IERC20[] memory tokens,
        uint256[] memory amounts,
        uint256[] memory feeAmounts,
        bytes memory userData
    ) external override {
        require(msg.sender == address(VAULT), "unauthorized");

        // feeAmounts are 0 for Balancer
        // Your logic here

        for (uint256 i = 0; i < tokens.length; i++) {
            tokens[i].transfer(address(VAULT), amounts[i] + feeAmounts[i]);
        }
    }

    function execute(IERC20[] calldata tokens, uint256[] calldata amounts) external {
        VAULT.flashLoan(this, tokens, amounts, "");
    }
}

Arbitrage Pattern

1. Flash borrow X tokens of asset A from Aave
2. Swap A -> B on DEX₁ (where A is cheap)
3. Swap B -> A on DEX₂ (where A is expensive)
4. Repay X + premium to Aave
5. Keep profit (A_out - X - premium)

Profit condition: output - input - premium - gas > 0

Liquidation Bot Pattern

1. Monitor health factors via events or polling
2. Flash borrow the debt asset
3. Call liquidationCall() on Aave / absorb() on Compound
4. Receive discounted collateral
5. Swap collateral back to debt asset
6. Repay flash loan + premium
7. Keep liquidation bonus minus fees

Checklist

  • Always validate msg.sender is the lending pool in callbacks
  • Validate initiator is your own contract (prevents griefing)
  • Calculate profit after all fees (flash loan premium + swap fees + gas)
  • Use Balancer for zero-fee flash loans when assets are available
  • Approve exact repayment amount (principal + premium) before return
  • Test with forked mainnet to verify real liquidity and pricing
  • Add access control — only owner/keeper can trigger flash loans
  • Handle the case where arbitrage is unprofitable (revert early)

© ccashwell, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/flash-loan-usage of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Flash Loan Usage 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.

Flash Loan Usage compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Flash Loan Usage this skillccashwell/evm-cortex131—~1.6kAutomated safety check: PassMIT
Notebook To Strategytradingstrategy-ai/trade-executor160—~1.1kAutomated safety check: PassCustom licence
Building Blocksaustintgriffith/ethskills294—~2.9kAutomated safety check: PassNone
Oracle Flashloan Analysisquillai-network/quillshield_skills129—~2.8kAutomated safety check: PassMIT
Octav APIinternet-court/internet-court-skill6.4k—~3.8kAutomated safety check: PassMIT
Uniswap SwapNethereum/Nethereum2.3k—~2.1kAutomated safety check: PassMIT

Similar skills

  • Notebook To Strategy

    tradingstrategy-ai/trade-executor

    Transfer code from a backtesting Jupyter notebook to a Trade Executor strategy module

    160 GitHub stars~1.1k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Building Blocks

    austintgriffith/ethskills

    DeFi legos and protocol composability on Ethereum and L2s. An agent skill from austintgriffith/ethskills.

    294 GitHub stars~2.9k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Oracle Flashloan Analysis

    quillai-network/quillshield_skills

    Detects price oracle manipulation and flash loan attack vectors in DeFi smart contracts.

    129 GitHub stars~2.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Octav API

    internet-court/internet-court-skill

    Integrate with Octav API for cryptocurrency portfolio tracking, transaction history, and DeFi analytics across 50+ blockchain networks.

    6.4k GitHub stars~3.8k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Uniswap Swap

    Nethereum/Nethereum

    Swap tokens on Uniswap V2/V3/V4 using Nethereum (.NET/C). An agent skill from Nethereum/Nethereum.

    2.3k GitHub stars~2.1k tokensUpdated 3 days ago
    Business, Finance & HRAuto-check passed
  • Clanker

    alsk1992/CloddsBot

    Deploy ERC20 tokens with Uniswap V4 pools on Base, Ethereum, Arbitrum

    2.9k GitHub stars~782 tokensUpdated 6 days ago
    Business, Finance & HRAuto-check passed

More from ccashwell/evm-cortex

All 89 skills in this repo
  • Xray Pre Audit

    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.

    131 GitHub stars~25k tokensUpdated 8 days ago
    Auto-check passed
  • Aave Integration

    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.

    131 GitHub stars~1.3k tokensUpdated 8 days ago
    Auto-check passed
  • Access Control Patterns

    ccashwell/evm-cortex

    Access control design patterns for Solidity protocols. An agent skill from ccashwell/evm-cortex.

    131 GitHub stars~1.8k tokensUpdated 8 days ago
    Auto-check passed
  • Anvil Patterns

    ccashwell/evm-cortex

    A skill your agent uses when running a local Ethereum node with Anvil.

    131 GitHub stars~1.3k tokensUpdated 8 days ago
    Auto-check passed
  • Audit Breadth Scan

    ccashwell/evm-cortex

    A skill your agent uses when performing systematic breadth-first review of all contracts during a security audit.

    131 GitHub stars~1.4k tokensUpdated 8 days ago
    Auto-check passed
  • Audit Depth Analysis

    ccashwell/evm-cortex

    A skill your agent uses when performing deep analysis of specific findings or high-risk areas during a security audit.

    131 GitHub stars~1.6k tokensUpdated 8 days ago
    Auto-check passed

Works with

Questions about Flash Loan Usage

What does Flash Loan Usage do?

A skill your agent uses when implementing flash loan strategies including arbitrage, liquidation bots, collateral swaps, or debt refinancing. Flash Loan Usage is an agent skill from ccashwell/evm-cortex. Use when implementing flash loan strategies including arbitrage, liquidation bots, collateral swaps, or debt refinancing.

When should I use Flash Loan Usage?

Flash Loan Usage fits situations like: implementing flash loan strategies including arbitrage; liquidation bots; collateral swaps; debt refinancing.

How do I install Flash Loan Usage in Claude Code?

Run `npx skills add ccashwell/evm-cortex --skill flash-loan-usage -a claude-code`. Or copy the skill folder (skills/flash-loan-usage in ccashwell/evm-cortex) into .claude/skills/flash-loan-usage in your project. Claude Code loads it when a task matches its description.

How do I install Flash Loan Usage in Codex?

Run `npx skills add ccashwell/evm-cortex --skill flash-loan-usage -a codex`. Or copy the skill folder (skills/flash-loan-usage in ccashwell/evm-cortex) into .agents/skills/flash-loan-usage in your project. Codex loads it when a task matches its description.

Can I use Flash Loan Usage in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ccashwell/evm-cortex --skill flash-loan-usage -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/flash-loan-usage, .gemini/skills/flash-loan-usage, .github/skills/flash-loan-usage and .opencode/skills/flash-loan-usage in your project.

What does Flash Loan Usage need to run?

SKILL.md names no scripts, command-line tools or credentials: Flash Loan Usage is instructions for the agent only.

Does Flash Loan Usage access the network?

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.

Is Flash Loan Usage safe to install?

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.

What licence does Flash Loan Usage use?

Flash Loan Usage is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Flash Loan Usage use?

About 1.6k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Flash Loan Usage?

Skills that share tags, products or a category with Flash Loan Usage: Notebook To Strategy (tradingstrategy-ai/trade-executor, 160 stars), Building Blocks (austintgriffith/ethskills, 294 stars), Oracle Flashloan Analysis (quillai-network/quillshield_skills, 129 stars) and Octav API (internet-court/internet-court-skill, 6.4k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Flash Loan Usage?

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.