git clone https://github.com/vibeforge1111/vibeship-spawner-skills
finance/blockchain-defi/skill.yamlid: blockchain-defi name: Blockchain DeFi category: finance description: Use when building DeFi protocols, implementing AMMs, yield farming strategies, or integrating with Ethereum/L2s - covers smart contract patterns, liquidity pools, and security considerations
patterns: golden_rules: - rule: "Audit before deploy" reason: "Bugs are permanent and exploitable" - rule: "Use battle-tested code" reason: "Don't reinvent OpenZeppelin" - rule: "Check-Effects-Interactions" reason: "Prevents reentrancy attacks" - rule: "Never trust external calls" reason: "Any callback can be malicious" - rule: "Assume oracles can fail" reason: "Use multiple sources, circuit breakers"
defi_stack: applications: "Yield Aggregators, Dashboards, Wallets" protocols: "Uniswap, Aave, Compound, Curve, MakerDAO" primitives: "AMMs, Lending, Stablecoins, Oracles" l2_scaling: "Arbitrum, Optimism, Base, zkSync" l1_blockchain: "Ethereum, Solana, Avalanche"
amm_formula: | Constant Product: x * y = k Price impact: dy = y - k/(x + dx) LP tokens: sqrt(x * y) Fee: 0.3% on swaps (Uniswap)
impermanent_loss: | IL = 2 * sqrt(price_ratio) / (1 + price_ratio) - 1
Examples: - 2x price change: -5.7% IL - 5x price change: -25.5% IL - 0.5x price change: -5.7% IL
security_patterns: reentrancy_guard: "Lock state during external calls" check_effects_interactions: "Update state before external calls" access_control: "onlyOwner, role-based permissions" emergency_pause: "Circuit breaker for exploits" slippage_protection: "minAmountOut on swaps" deadline: "Prevent stale transactions"
anti_patterns:
- pattern: "Spot price oracle" problem: "Flash loan manipulation" solution: "Use TWAP"
- pattern: "No slippage protection" problem: "Sandwich attacks" solution: "Set minAmountOut"
- pattern: "Unlimited approvals" problem: "Token theft if contract compromised" solution: "Approve exact amounts"
- pattern: "Hardcoded addresses" problem: "No upgradeability" solution: "Use registry pattern"
- pattern: "No deadline" problem: "Stale transactions execute" solution: "Always set deadline"
- pattern: "Single oracle" problem: "Oracle failure" solution: "Multiple sources + circuit breaker"
implementation_checklist: smart_contracts: - "Use OpenZeppelin contracts for standard patterns" - "Implement reentrancy guards on state-changing functions" - "Use Check-Effects-Interactions pattern" - "Add access control for admin functions" user_protection: - "Add slippage protection with minAmountOut" - "Include transaction deadlines" - "Implement emergency pause mechanism" oracles: - "Use TWAP for price oracles" - "Implement circuit breakers for extreme values" - "Consider multiple oracle sources" deployment: - "Get professional security audit before mainnet" - "Test with fork of mainnet" - "Set up monitoring for unusual activity"
handoffs:
- skill: algorithmic-trading trigger: "DeFi trading strategies"
- skill: risk-modeling trigger: "DeFi protocol risk assessment"
- skill: fintech-integration trigger: "fiat on/off ramps"
ecosystem: development: - "Foundry - Fast Solidity framework" - "Hardhat - JS development environment" - "OpenZeppelin - Security standards" testing: - "Forge - Fuzz testing" - "Slither - Static analysis" - "Echidna - Property testing" integration: - "web3.py - Python integration" - "ethers.js - JavaScript integration" - "viem/wagmi - React hooks"
sources: tutorials: - "Uniswap V4 Hooks Documentation" - "DeFi Yield Farming 2025" articles: - "Gemini Yield Farming Guide" - "Compound Protocol Docs"