agentleFS
vaquarkhanvaquarkhan/web3-agent-skills/skills/skill-15-mev-protection/SKILL.md

skill-15-mev-protection

Skill2 starsChanged 6 months agoMITView on GitHub

Protects transactions from MEV via Flashbots, intent-based trading, sandwich attack mitigation, and TWAP orders. Use for high-value swaps, liquidations, or any MEV-exposed on-chain activity.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    No revert protection by default — add X-Flashbots-Signature for bundles

    line 41
  2. Distinctive:

    Prefer intent-based routing for trades > $10,000.

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

MEV Protection

When to Use

  • Executing swaps > $1,000 on public mempools
  • Protecting against sandwich attacks
  • Submitting liquidation transactions
  • Implementing TWAP/VWAP execution strategies
  • Using intent-based protocols (CoW Swap, UniswapX)

Prerequisites

  • MCP: blockchain-rpc-server, price-feed-server
  • Skill-12 for private tx submission

MEV Attack Vectors

AttackMechanismMitigation
SandwichFront-run buy + back-run sellPrivate mempool, slippage limits
FrontrunningCopy profitable tx with higher gasFlashbots bundle, commit-reveal
BackrunningArbitrage after your txAccept (usually harmless)
JIT LiquidityTemporary LP around your swapTWAP, smaller chunks

Workflow

1. Private Transaction Submission

Ethereum (Flashbots Protect):

RPC: https://rpc.flashbots.net
  • No revert protection by default — add X-Flashbots-Signature for bundles
  • Transactions not visible in public mempool

MEV-Share: Share MEV refund with searchers while maintaining privacy.

2. Intent-Based Trading

ProtocolChainMechanism
CoW SwapEthereumBatch auctions, MEV redistribution
UniswapXMultiDutch auctions, filler network
1inch FusionMultiResolver competition

Prefer intent-based routing for trades > $10,000.

3. TWAP Execution

For large orders splitting across time:

chunkSize = totalAmount / numChunks
interval = totalDuration / numChunks
  1. Split order into N equal chunks
  2. Execute each via private RPC with randomized timing (±10%)
  3. Monitor cumulative slippage vs benchmark price
  4. Pause if cumulative slippage exceeds threshold

4. Slippage Configuration

Trade SizeRecommended SlippageMethod
< $1K0.5%Public or private
$1K–$10K0.5–1%Private mempool
$10K–$100KTWAP 5–10 chunksIntent or Flashbots
> $100KTWAP + intent protocolCoW/UniswapX

Pre-Execution

  • Private RPC configured for target chain
  • Slippage and deadline set on swap params
  • Simulation confirms no revert
  • User confirmed if trade > $10,000

References

  • references/flashbots-setup.md
  • references/intent-protocols.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.