design-defi

Analyze DeFi protocol risks, invariants, MEV exposure, and governance patterns.

Updated Feb 19, 2026
One-click install
npx skills add https://github.com/kunallimaye/lib-agents --skill design-defi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-defi
Source: https://github.com/kunallimaye/lib-agents/tree/main/skills/design-defi
Command: npx skills add https://github.com/kunallimaye/lib-agents --skill design-defi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the complex challenges of designing secure, composable, and economically sound Decentralized Finance (DeFi) protocols, mitigating common risks and anti-patterns.

Core Features & Use Cases

  • Protocol Design Frameworks: Provides structured approaches for designing DeFi systems.
  • Risk Analysis: Offers detailed analysis of composability risks, economic security, MEV exposure, and attack surfaces.
  • Invariant Design: Guides the creation of robust invariants crucial for protocol stability.
  • Use Case: A team is designing a new lending protocol and needs to ensure its economic security against flash loan attacks and liquidation cascades. They use this Skill to analyze potential vulnerabilities, define critical invariants, and select appropriate governance patterns.

Quick Start

Use the design-defi skill to analyze the attack surface of a new AMM protocol.

Frequently Asked Questions about design-defi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design secure DeFi protocols against flash loan attacks?

To design secure DeFi protocols, you need structured frameworks that analyze economic security, invariant design, and MEV exposure. This approach identifies potential vulnerabilities like flash loan attacks and liquidation cascades, ensuring systemic stability.

What are common DeFi anti-patterns and how can I mitigate them?

Common DeFi anti-patterns involve composability risks, governance vulnerabilities, and tokenomics constraints. You can mitigate these protocol risks by applying structured risk analysis frameworks to identify attack surfaces and enforce robust invariants.

When do I need to analyze MEV exposure in protocol design?

You need to analyze MEV exposure during the protocol design phase to prevent economic exploitation. Evaluating MEV exposure alongside governance patterns and economic security helps identify attack surfaces and build robust invariants for composability.

How do I define robust invariants for a lending protocol?

Defining robust invariants for a lending protocol requires analyzing its economic security against liquidation cascades and flash loan attacks. Frameworks for protocol design guide the creation of invariants crucial for stability and risk mitigation.

What is the best way to analyze composability risks in DeFi systems?

The best way to analyze composability risks in DeFi systems is to evaluate the protocol's attack surface using structured risk analysis. This process examines MEV exposure, economic security, and tokenomics constraints to mitigate anti-patterns.

Does protocol design framework work for AMM protocol risk analysis?

Yes, protocol design frameworks are applicable for AMM protocol risk analysis. They provide structured approaches to analyze the attack surface, evaluate economic security, and define invariants that mitigate vulnerabilities specific to automated market makers.