用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mikailustuner/OmniRule --skill defi-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Bun runtime: HTTP server, file I/O, SQLite, test runner, package manager, bundler — all-in-one JS toolchain.
Clerk: Drop-in auth UI, Organizations, User management, JWT templates, webhooks, Next.js middleware integration.
Gelişmiş masaüstü, tarayıcı ve işletim sistemi kontrol yeteneği. Görsel (koordinat tabanlı) fare/klavye otomasyonu, DOM manipülasyonu, pencere yönetimi, gelişmiş dosya, ağ ve süreç yönetimini kapsar.
基于 SOC 职业分类
正在显示 SKILL.md
| name | defi-patterns |
| description | DeFi Patterns: AMM, lending, staking, tokenomics, yield farming, DAOs. |
| triggers | {"extensions":[".sol"],"directories":["defi/","protocols/","token/"],"keywords":["defi","amm","uniswap","lending","aave","compound","yield","staking","dao","governance","swap"]} |
| auto_load_when | Building DeFi protocols or integrating DeFi |
| agent | blockchain-developer |
| tools | ["Read","Write","Bash"] |
Focus: AMMs, lending, staking, governance, tokenomics
AMM Patterns:
├── Constant Product (x * y = k)
│ ├── Uniswap V2 style
│ └── Arbitrage keeps price aligned
│
├── Stable Swap (Curve)
│ ├── Stable asset swaps (USDC/USDT)
│ └── Concentrated liquidity (Uniswap V3)
│
├── Hybrid (Balancer)
│ ├── Multiple tokens, weighted
│ └── Smart order routing
│
└── Reading price from AMM
├── getAmountOut(tokenIn, amountIn)
└── Price impact = slippage
Key formulas:
Output amount = (amountIn * reservesOut * 997) / (reservesIn * 1000 + amountIn * 997)
k = tokenA * tokenB (constant)
Lending Patterns (Aave/Compound):
├── Lending Pool
│ ├── Deposit collateral (approve → deposit)
│ ├── Borrow against collateral (overcollateralized)
│ └── Interest earned by suppliers
│
├── Liquidation
│ ├── When health factor < 1
│ ├── Liquidators pay debt + get collateral
│ └── Bot arbitrage on liquidations
│
├── Interest Rates
│ ├── Supply APY = utilization * borrow APY
│ └── Variable (flexible) vs stable (fixed)
│
└── Flash Loans
├── Borrow without collateral (same block)
└── Must return + fee by end of tx
└── No state change if not repaid
Staking Patterns:
├── Direct Staking
│ ├── Lock tokens for rewards
│ └── Linear/unlocking vesting
│
├── Liquid Staking (LSD)
│ ├── Stake → get receipt token (stETH, rETH)
│ └── Receipt token = fungible, tradeable
│ └── Underlying stake accrues value
│
├── Governance Staking
│ ├── Stake → voting power
│ └── Delegate to others
│ └── Quadratic voting
│
├── Reward Distribution
│ ├── Merkle tree (airdrop claims)
│ └── Linear vesting contracts
│ └── Batch distribution
Token Design Patterns:
├── Utility Tokens
│ ├── Fee discount (like BNB)
│ ├── Governance voting
│ └── Staking rewards
│
├── Governance Tokens
│ ├── Voting power = token balance
│ └── Timelock on proposals
│ └── Quorum requirements
│
├── Revenue Share
│ ├── Protocol revenue → token buyback
│ └── Or distribution to stakers
│
└── Vesting
├── Team/investor unlock schedule
├── Linear or cliff
└── TGE (token generation event) % first
DAO Patterns:
├── Governance Structure
│ ├── Token holder voting
│ ├── Executive (execute passed proposals)
│ └── Timelock (delay before execution)
│
├── Proposal Lifecycle
│ ├── Submit → Discussion → Vote → Queue → Execute
│ └── Minimum quorum required
│
├── Voting Mechanisms
│ ├── Direct (one token = one vote)
│ ├── Quadratic (sqrt reduces whale power)
│ └── Conviction voting (time-based)
│
└── Execution
└── Gnosis Safe + Zodiac modules
└── Teller (automatic execution)
❌ No slippage protection — MEV extracts value
✅ Set max slippage, use TWAP for large trades
❌ No access control on critical functions
✅ OnlyOwner or role-based, timelock
❌ Reentrancy in lending — can drain pool
✅ Follow CEI pattern, ReentrancyGuard
❌ No oracle for price — easy to manipulate
✅ Use Chainlink, TWAP, multiple sources
❌ No upgrade path — contract immutable forever
✅ Proxy pattern for upgradability, or plan for immutability
| Pattern | Protocol | Key Feature |
|---|---|---|
| AMM | Uniswap V2/V3 | Constant product |
| Stable Swap | Curve | Low slippage |
| Lending | Aave/Compound | Overcollateralized |
| Flash Loan | Aave | No collateral |
| Staking | Lido, Rocket Pool | Liquid staking |
| Governance | Compound, Uniswap | Token voting |
| Oracle | Chainlink | Decentralized |
| Aggregator | 1inch | Best price |