jeremylongshore/tons-of-skills-marketplace / plugins/crypto/defi-yield-optimizer/skills/optimizing-defi-yields
optimizing-defi-yields
VerifiedFind and compare DeFi yield opportunities across protocols with APY calculations, risk assessment, and optimization recommendations. Use when searching for yield farming opportunities, comparing DeFi protocols, or analyzing APY/APR rates. Trigger with phrases like "find DeFi yields", "compare APY", "best yield farming", "optimize DeFi returns", "stablecoin yields", or "liquidity pool rates".
| File | Kind | Size |
|---|---|---|
| ARD.md | markdown | 9.5 KB |
| PRD.md | markdown | 6.1 KB |
| SKILL.md | skill md | 5.6 KB |
| config/settings.yaml | config | 3.5 KB |
| references/errors.md | markdown | 4.5 KB |
| references/examples.md | markdown | 6.9 KB |
| references/implementation.md | markdown | 5.6 KB |
| scripts/formatters.py | script | 13.9 KB |
| scripts/protocol_fetcher.py | script | 7.9 KB |
| scripts/risk_assessor.py | script | 11.8 KB |
| scripts/yield_calculator.py | script | 8.7 KB |
| scripts/yield_optimizer.py | script | 6.4 KB |
references/errors.md
View on GitHub# Error Handling Reference
## API Errors
### DeFiLlama API Timeout
```
Error: requests.exceptions.Timeout: Request timed out after 30s
```
**Cause**: DeFiLlama API is slow or unavailable.
**Solution**:
- Script automatically falls back to cached data
- If cache is also unavailable, uses mock data for basic functionality
- Wait a few minutes and retry with `--no-cache` flag
### DeFiLlama Rate Limit
```
Error: 429 Too Many Requests
```
**Cause**: Too many API requests in short period.
**Solution**:
- DeFiLlama has generous limits, this is rare
- Cache is used by default (5 minute TTL)
- Wait 1 minute before retrying
### Network Connection Error
```
Error: requests.exceptions.ConnectionError: Failed to establish connection
```
**Cause**: No internet connection or DNS issues.
**Solution**:
- Check network connectivity
- Script falls back to cached data automatically
- Use `--verbose` to see cache status
## Data Errors
### No Pools Found
```
No pools match your criteria. Try broadening filters.
```
**Cause**: Filters are too restrictive.
**Solution**:
- Remove some filters (e.g., remove `--audited-only`)
- Lower `--min-tvl` threshold
- Try fewer chains or protocols
- Use `--top 50` to see more results
### Invalid Chain Name
```
Warning: No pools found for chain 'eth'
```
**Cause**: Chain name doesn't match DeFiLlama format.
**Solution**: Use correct chain names:
- `ethereum` (not `eth` or `mainnet`)
- `arbitrum` (not `arb`)
- `polygon` (not `matic`)
- `optimism` (not `op`)
- `bsc` (for Binance Smart Chain)
### Invalid Protocol Name
```
Warning: No pools found for protocol 'aave'
```
**Cause**: Protocol slug doesn't match exactly.
**Solution**: Use exact slugs:
- `aave-v3` or `aave-v2` (not just `aave`)
- `compound-v3` (not `compound`)
- `curve-dex` (not `curve`)
- `convex-finance` (not `convex`)
- `yearn-finance` (not `yearn`)
## Cache Errors
### Cache Read Error
```
Warning: Could not read cache file
```
**Cause**: Cache file corrupted or permissions issue.
**Solution**:
- Delete cache file: `rm ~/.defi_yield_cache.json`
- Script will fetch fresh data on next run
### Stale Cache Warning
```
Using stale cache (15 min old)
```
**Cause**: Cache TTL exceeded but API unavailable.
**Solution**:
- Not a critical error - data is still usable
- Retry later for fresh data
- Use `--no-cache` to force refresh when API is back
## Import Errors
### Missing requests Library
```
Warning: requests library not available, using mock data
```
**Cause**: Python `requests` package not installed.
**Solution**:
```bash
pip install requests
```
### Module Not Found
```
ModuleNotFoundError: No module named 'protocol_fetcher'
```
**Cause**: Running script from wrong directory.
**Solution**:
```bash
# Run from scripts directory or use full path
cd /path/to/skills/optimizing-defi-yields/scripts
python yield_optimizer.py --help
```
## Output Errors
### File Write Permission Denied
```
PermissionError: [Errno 13] Permission denied: 'yields.json'
```
**Cause**: Cannot write to output file location.
**Solution**:
- Check file/directory permissions
- Try a different output path
- Use stdout (no `--output` flag) and redirect
### Invalid Output Format
```
Error: Invalid format 'xml'
```
**Cause**: Unsupported output format specified.
**Solution**: Use supported formats:
- `table` (default)
- `json`
- `csv`
## Risk Assessment Warnings
### Unknown Protocol Risk
```
Risk Score: 5.0/10 (default - protocol not in database)
```
**Cause**: Protocol not in known audited protocols list.
**Solution**:
- Not an error - default medium risk applied
- Manually verify protocol's audit status
- Consider additional due diligence for unknown protocols
### High APY Warning
```
Risk Factor: Very high APY (150.0%) - verify sustainability
```
**Cause**: APY exceeds expected sustainable levels.
**Solution**:
- High APY often indicates:
- Temporary incentive programs
- High-risk opportunities
- Possible scams (if extremely high)
- Research the protocol thoroughly before investing
## Recovery Commands
### Reset Cache
```bash
rm ~/.defi_yield_cache.json
```
### Test API Connectivity
```bash
curl -s "https://yields.llama.fi/pools" | head -c 100
```
### Verbose Mode for Debugging
```bash
python yield_optimizer.py --verbose --top 5
```
### Check Specific Protocol
```bash
python yield_optimizer.py --protocol aave-v3 --verbose
```
---
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |