defi-portfolio-scanner/SKILL.md
Cross-protocol DeFi position aggregator for Stacks wallets — 5 parallel scanners covering Bitflow HODLMM LP bins, Zest lending/borrowing (V2 pool-borrow-v2-3), ALEX pool shares, Styx bridge deposits, and Hiro wallet balances. Produces a unified portfolio view with USD estimation (CoinGecko) and risk scoring.
npx skillsauth add aibtcdev/skills defi-portfolio-scannerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cross-protocol DeFi position aggregator for Stacks wallets. Scans four major Stacks DeFi protocols and produces a unified portfolio view with aggregate totals and risk scoring.
defi-portfolio-scanner queries four Stacks DeFi protocols in parallel and returns a single, normalized JSON report for any given STX address:
| Protocol | What is scanned | |---|---| | Bitflow HODLMM | LP positions across all active HODLMM pools — token pair, share amount, estimated USD value | | Zest Protocol | Lending deposits (collateral supplied) and active borrows — asset, principal, LTV ratio | | ALEX DEX | Pool token balances representing LP shares in ALEX liquidity pools | | Styx Bridge | Pending and completed bridge deposits between Bitcoin L1 and Stacks |
The skill also queries the Hiro API for baseline token balances so the portfolio view includes idle wallet holdings alongside active DeFi positions.
Autonomous agents managing DeFi strategies need a consolidated view of where capital is deployed before they can make allocation decisions. Without this skill, an agent would need to query each protocol separately, normalize different response schemas, and manually compute concentration metrics. This skill does all of that in a single call and returns a typed, predictable JSON contract that downstream skills can consume directly.
Common agent workflows:
call-read via Hiro API.doctorHealth check across all upstream dependencies. Returns per-endpoint latency and reachability status.
bun run defi-portfolio-scanner.ts doctor
Output: JSON object with status: "ok" | "degraded" | "down" per endpoint plus overall system status.
scan --address <stx-address>Full position scan across all four protocols plus Hiro token balances.
bun run defi-portfolio-scanner.ts scan --address SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KR9
Output: JSON object containing:
wallet — base token balances (STX, sBTC, stablecoins)protocols.bitflow — array of HODLMM LP positionsprotocols.zest — lending/borrowing positions with LTVprotocols.alex — pool token balances and estimated underlyingprotocols.styx — bridge deposit recordstotals — aggregate estimated USD value across all protocolsscannedAt — ISO-8601 timestampsummary --address <stx-address>Condensed portfolio overview with computed risk score.
bun run defi-portfolio-scanner.ts summary --address SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KR9
Output: JSON object containing:
address — the scanned addresstotalEstimatedUsd — aggregate portfolio valueprotocolBreakdown — per-protocol USD allocation and percentageriskScore — numeric score 0-100 (higher = riskier)riskFactors — array of human-readable risk observationstopHoldings — top 5 positions by valuescannedAt — ISO-8601 timestampEvery command returns JSON matching this envelope:
{
"success": true,
"skill": "defi-portfolio-scanner",
"command": "<command-name>",
"data": { ... },
"timestamp": "2026-03-31T12:00:00.000Z"
}
On error:
{
"success": false,
"skill": "defi-portfolio-scanner",
"command": "<command-name>",
"error": "Human-readable error message",
"details": { ... },
"timestamp": "2026-03-31T12:00:00.000Z"
}
| Source | Endpoint | Purpose |
|---|---|---|
| Bitflow API | https://bff.bitflowapis.finance/api/app/v1/pools | HODLMM pool list and position data |
| Zest Protocol | Hiro call-read on SP2VCQJGH7PHP2DJK7Z0V48AGBHQAW3R3ZW1QF4N.pool-borrow-v2-3 | Lending/borrowing user data via get-user-reserve-data |
| ALEX DEX | https://api.alexlab.co/v1/pool_tokens/balances/<address> | Pool token balances |
| Styx Bridge | https://app.styxfinance.com/api | Bridge deposit records |
| Hiro API | https://api.hiro.so/extended/v1/address/<addr>/balances | Token balances, contract reads |
This skill aggregates positions from the following protocol-specific scanners:
| # | Protocol | Scanner | What it detects |
|---|---|---|---|
| 1 | Bitflow HODLMM | scanBitflow() | LP bin positions across all active HODLMM pools via /users/{addr}/positions/{pool}/bins, with Hiro fallback for LP receipt tokens |
| 2 | Zest Protocol | scanZest() | Supply collateral and borrow balances via Hiro call-read on pool-borrow-v2-3.get-user-reserve-data, plus Zest receipt token detection from Hiro balances |
| 3 | ALEX DEX | scanAlex() | Pool token balances from ALEX /pool_tokens/balances API, with Hiro fallback for ALEX LP tokens in wallet |
| 4 | Styx Bridge | scanStyx() | Pending and completed BTC→sBTC bridge deposits from Styx /deposits API |
| 5 | Wallet base | scanWalletBalances() | STX, sBTC, and all fungible token balances from Hiro API — provides the idle-capital baseline |
All five scanners run in parallel via Promise.all. Each returns a typed ProtocolResult<T> with status, positions, and estimatedUsd. USD estimation uses CoinGecko STX and BTC spot prices.
"status": "unavailable" rather than failing the entire scan.Winner of AIBTC x Bitflow Skills Pay the Bills competition. Original author: @azagh72-creator Competition PR: https://github.com/BitflowFinance/bff-skills/pull/121
development
Web of Trust operations for Nostr pubkeys — trust scoring, sybil detection, trust path analysis, neighbor discovery, follow recommendations, and network health. Free tier (wot.klabo.world, 50 req/day) with paid fallback (maximumsats.com, 100 sats via L402). Covers 52K+ pubkeys and 2.4M+ zap-weighted trust edges. Use --key-source to select nip06 (default), taproot, or stacks derivation path.
data-ai
BTC ordinals marketplace operations via Magic Eden — browse active listings, list inscriptions for sale via PSBT flow, submit signed listings, buy inscriptions, and cancel active listings. BTC ordinals only (not Solana). Mainnet-only.
testing
Pay-per-call access to LunarCrush social and market intelligence (Galaxy Score, AltRank, market cap rank, price, 24h change) via x402 on Stacks. USD-pegged pricing recomputed hourly from live STX/USD. Mainnet endpoint live; testnet supported.
devops
Detects HODLMM LP inventory drift (token-ratio imbalance from one-sided swap flow) and restores the target ratio via a corrective Bitflow swap plus a hodlmm-move-liquidity redeploy, gated by the 4h per-pool cooldown.