
Simulating Flash Loans
FreeEvaluate flash loan strategies without real transactions.
Free · Opens the source repo
What Simulating Flash Loans does
Simulating Flash Loans is a Python-based skill designed for developers and financial analysts interested in decentralized finance (DeFi). This tool allows users to simulate various flash loan strategies across popular protocols such as Aave, dYdX, and Balancer. By providing profitability calculations, gas cost estimations, and risk assessments, it enables users to evaluate potential opportunities without the need to execute actual transactions on the blockchain.
The skill includes a variety of simulation options, allowing users to analyze arbitrage opportunities, evaluate liquidation scenarios, and compare different flash loan providers. For instance, users can simulate a two-DEX arbitrage to determine the best trading strategy or assess liquidation profitability on lending protocols. The output can be tailored to provide quick insights or detailed breakdowns of transaction flows, making it suitable for both quick assessments and comprehensive analyses.
To get started, users need to ensure they have Python 3.9+ installed along with specific libraries such as web3 and httpx. Configuration involves setting up an RPC endpoint, which can be done using public RPCs. The skill is triggered using simple command-line phrases, making it accessible even for those who may not be deeply familiar with programming or blockchain technology.
Overall, this skill is ideal for anyone looking to deepen their understanding of flash loans and DeFi strategies, whether they are developers building applications or analysts seeking to optimize trading strategies. It's particularly useful for those who want to explore the potential of flash loans without the risks associated with live transactions.
When to use it
Use this skill when you want to analyze flash loan opportunities, assess profitability, or compare providers in a risk-free environment.
When not to use it
This skill is not suitable for executing real transactions or for users looking for a simple, non-technical overview of flash loans.
What you can build with it
Arbitrage Simulation
Simulate a two-DEX arbitrage to find the best trading strategy without risking real funds.
Liquidation Analysis
Evaluate potential liquidation opportunities on lending protocols like Aave to identify profitable trades.
Provider Comparison
Compare flash loan providers to determine the most cost-effective option for your trading strategy.
How to install Simulating Flash Loans
View source1. Install with the skills CLI
npx skills add jeremylongshore/claude-code-plugins-plus-skills/simulating-flash-loans --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by jeremylongshoreSimulating Flash Loans
Contents
Overview | Prerequisites | Instructions | Output | Error Handling | Examples | Resources
Overview
Simulate flash loan strategies across Aave V3, dYdX, and Balancer with profitability calculations, gas cost estimation, and risk assessment. Evaluate flash loan opportunities without executing real transactions.
Prerequisites
- Install Python 3.9+ with
web3,httpx, andrichpackages - Configure RPC endpoint access (free public RPCs via https://chainlist.org work fine)
- Optionally add Etherscan API key for better gas estimates
- Set RPC in
${CLAUDE_SKILL_DIR}/config/settings.yamlor useETH_RPC_URLenv var
Instructions
-
Simulate a two-DEX arbitrage with automatic fee and gas calculation:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py arbitrage ETH USDC 100 \ --dex-buy uniswap --dex-sell sushiswap -
Compare flash loan providers to find the cheapest for your strategy:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py arbitrage ETH USDC 100 --compare-providers -
Analyze liquidation profitability on lending protocols:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py liquidation \ --protocol aave --health-factor 0.95 -
Simulate triangular arbitrage with multi-hop circular paths:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py triangular \ ETH USDC WBTC ETH --amount 50 -
Add risk assessment (MEV competition, execution, protocol, liquidity) to any simulation:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py arbitrage ETH USDC 100 --risk-analysis -
Run full analysis combining all features:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py arbitrage ETH USDC 100 \ --full --output json > simulation.json
Output
- Quick Mode: Net profit/loss, provider recommendation, Go/No-Go verdict
- Breakdown Mode: Step-by-step transaction flow with individual cost components
- Comparison Mode: All providers ranked by net profit with fee differences
- Risk Analysis: Competition, execution, protocol, and liquidity scores (0-100) with viability grade (A-F)
See ${CLAUDE_SKILL_DIR}/references/implementation.md for detailed output examples and risk scoring methodology.
Error Handling
| Error | Cause | Solution |
|---|---|---|
| RPC Rate Limit | Too many requests | Switch to backup endpoint or wait |
| Stale Prices | Data older than 30s | Auto-refreshes with warning |
| No Profitable Route | All routes lose after costs | Try different pairs or amounts |
| Insufficient Liquidity | Trade exceeds pool depth | Reduce amount or split across pools |
See ${CLAUDE_SKILL_DIR}/references/errors.md for comprehensive error handling.
Examples
Basic arbitrage simulation:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py arbitrage ETH USDC 100 \
--dex-buy uniswap --dex-sell sushiswap
Find cheapest provider:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py arbitrage ETH USDC 100 --compare-providers
Liquidation opportunity scan:
python ${CLAUDE_SKILL_DIR}/scripts/flash_simulator.py liquidation --protocol aave --health-factor 0.95
See ${CLAUDE_SKILL_DIR}/references/examples.md for multi-provider comparison and backtesting examples.
Resources
${CLAUDE_SKILL_DIR}/references/implementation.md- Provider comparison, strategy details, risk scoring, output modes- Aave V3 Flash Loans
- dYdX Flash Loans
- Balancer Flash Loans
- Flashbots Protect
Frequently asked questions about Simulating Flash Loans
Similar skills
WinMD API Search
Easily find and explore Windows desktop APIs.
WebMCPify
Transform any web app into an agent-ready platform.
Phoenix Tracing
Instrument LLM applications with OpenInference tracing.
Foundry Hosted Agent CopilotKit
Guidance for developing agentic web apps on Azure.
Power Automate Foundation
Connect AI agents to Power Automate seamlessly.
Power Automate Flow Builder
Efficiently build and deploy Power Automate flows programmatically.
