rebalance-positionRebalance an out-of-range Uniswap V3/V4 LP position by closing the old position and opening a new one centered on the current price. Handles fee collection, removal, range calculation, and re-entry in a single workflow. Use when a position is out of range and needs adjustment.
Install via ClawdBot CLI:
clawdbot install wpank/rebalance-positionWhen a V3/V4 LP position goes out of range, it stops earning fees. This skill handles the full rebalance workflow: collect accumulated fees, close the old position, calculate a new optimal range centered on the current price, and open a new position β all in a single operation.
This is a high-value skill because out-of-range positions are effectively dead capital. The difference between a monitored position that gets rebalanced promptly and an unmonitored one can be 15-30% APY in lost fee revenue.
Activate when the user says:
Also proactively suggest rebalancing when:
track-performance or portfolio-report shows an out-of-range position| Parameter | Required | Default | How to Extract |
| ------------ | -------- | ------------- | -------------------------------------------------------- |
| positionId | No* | β | Position ID, or "my ETH/USDC position" (resolved by search) |
| chain | No | ethereum | Chain where the position lives |
| newRange | No | Auto-optimal | "narrow" (Β±5%), "medium" (Β±15%), "wide" (Β±50%) |
*If no position ID: search with get_positions_by_owner, filter for out-of-range positions, and confirm with the user.
Before executing anything, gather data and present the situation to the user:
Step 1: IDENTIFY THE POSITION
βββ If position ID given β fetch via get_position
βββ If "my X/Y position" β search via get_positions_by_owner
β βββ Filter by token pair and out-of-range status
β βββ If multiple out-of-range β list all, ask which one
β βββ If none out-of-range β "All your positions are in range!"
βββ Validate: confirm the position IS actually out of range
Step 2: ANALYZE CURRENT SITUATION
βββ Current pool state via get_pool_info
β βββ Current price
β βββ Pool TVL, volume, fee APY
β βββ Tick distribution (where is liquidity concentrated?)
βββ Position details
β βββ Current tick range (lower, upper)
β βββ How far out of range (above or below?)
β βββ Uncollected fees
β βββ Current token balances in position
β βββ Time since going out of range (if estimable)
βββ Cost-benefit calculation
βββ Estimated gas cost for full rebalance (remove + add = ~$30-60 on mainnet)
βββ Estimated daily fee revenue if rebalanced (from pool APY + position size)
βββ Break-even time: gas_cost / daily_revenue
βββ If break-even > 30 days β WARN that rebalancing may not be worth it
Before executing, show the user exactly what will happen:
Rebalance Plan for Position #12345
Current Situation:
Pool: WETH/USDC 0.05% (V3, Ethereum)
Status: OUT OF RANGE β (price moved above your range)
Current: $1,963
Your range: $1,500 - $1,800 (position is 9% above upper bound)
Uncollected Fees: 0.01 WETH ($19.60) + 15.20 USDC ($15.20)
Position Value: ~$3,940
Proposed New Range:
Strategy: Medium (Β±15%)
Lower: $1,668 (current - 15%)
Upper: $2,258 (current + 15%)
Expected time-in-range: ~80-85%
Cost:
Gas (remove + add): ~$35
Break-even: ~2 days at current fee APY
Steps:
1. Collect uncollected fees ($34.80)
2. Remove all liquidity from position #12345
3. Add liquidity at new range ($1,668 - $2,258)
4. New position created with new NFT ID
Proceed? (yes/no)
Step 3: DELEGATE TO LIQUIDITY-MANAGER
βββ The agent executes atomically:
β a. Collect fees from old position
β b. Remove 100% liquidity from old position
β c. Calculate new tick range based on:
β - Current pool price
β - Selected range strategy (narrow/medium/wide)
β - Pool tick spacing
β d. Approve tokens for new position (if needed)
β e. Add liquidity at new range
β f. Each step validated by safety-guardian
βββ Returns: old position closed, fees collected, new position ID, new range, tx hashes
Step 4: PRESENT RESULT
βββ Confirmation of old position closure
βββ Fees collected (amounts + USD)
βββ New position details (ID, range, amounts deposited)
βββ Total gas cost for the operation
βββ Net cost/benefit of the rebalance
βββ Next steps for monitoring
When the user doesn't specify a range, use this decision framework:
| Pair Type | Recommended Range | Width | Rationale |
| --------------------- | ----------------- | ------ | --------------------------------------------------- |
| Stable-stable | Narrow | Β±0.5% | Price barely moves; maximize capital efficiency |
| Stable-volatile | Medium | Β±15% | Balance between earning and avoiding rebalance |
| Volatile-volatile | Wide | Β±30% | Reduce rebalance frequency; accept lower APY |
| User says "aggressive"| Narrow | Β±5% | Higher fees but frequent rebalancing needed |
| User says "passive" | Wide | Β±50% | Low maintenance, lower returns |
| Small position (<$1K) | Wide | Β±50% | Gas costs make frequent rebalancing uneconomical |
Proactively advise against rebalancing in these situations:
| Situation | Advice |
| ----------------------------------------- | ------------------------------------------------------------ |
| Position size < 10x gas cost | "Gas would cost ${gas} but your position is only ${value}." |
| Price is near range boundary (within 2%) | "Price is close to your range β wait to see if it re-enters."|
| Position went out of range < 1 hour ago | "Give it time β price may return to your range." |
| User has no strong view on direction | "Consider a wider range to reduce future rebalances." |
| Break-even time > 14 days | "At current fee rates, rebalancing won't pay for itself for {days} days." |
Position Rebalanced Successfully
Old Position: #12345 (CLOSED)
Received: 0.52 WETH + 950 USDC ($1,970)
Fees collected: 0.01 WETH + 15.20 USDC ($34.80)
New Position: #67890
Pool: WETH/USDC 0.05% (V3, Ethereum)
Deposited: 0.51 WETH + 965 USDC ($1,960)
Range: $1,668 - $2,258 (medium, Β±15%)
Current: $1,963 β IN RANGE β
Cost:
Gas: $32.50 (2 transactions)
Net: Position rebalanced with $2.30 lost to gas
Now earning ~15-21% APY in fees
Txs:
Remove: https://etherscan.io/tx/0x...
Add: https://etherscan.io/tx/0x...
Monitor: "How are my positions doing?" or "Track position #67890"
Position #12345 is IN RANGE β
Pool: WETH/USDC 0.05% (V3, Ethereum)
Current: $1,963
Range: $1,700 - $2,300
Status: Actively earning fees
No rebalance needed. Your position is healthy.
Uncollected fees: $34.80
Want to collect them? (This doesn't affect your position.)
| Error | User-Facing Message | Suggested Action |
| ------------------------------ | ---------------------------------------------------------- | --------------------------------------- |
| Position not found | "Position #{id} not found." | Check ID and chain |
| Position already in range | "Position is already in range β no rebalance needed." | Show position status instead |
| V2 position | "V2 positions cover the full price range and can't go out of range." | Explain V2 vs V3 differences |
| Wallet not configured | "No wallet configured for transactions." | Set WALLET_TYPE + PRIVATE_KEY |
| Insufficient gas | "Not enough ETH for gas." | Fund wallet with ETH |
| Safety check failed | "Safety blocked the rebalance: {reason}" | Review safety configuration |
| Remove tx failed | "Failed to remove liquidity: {reason}" | Check position status and try again |
| Add tx failed | "Removed old position but failed to add new one." | Tokens are in wallet; retry add manually|
| liquidity-manager unavailable | "Liquidity agent is not available." | Check agent configuration |
Generated Mar 1, 2026
A yield farmer uses this skill to automatically rebalance multiple out-of-range Uniswap V3/V4 LP positions across different token pairs, ensuring continuous fee earnings. It integrates with portfolio tracking tools to identify underperforming positions and execute rebalancing based on cost-benefit analysis, optimizing overall APY by 15-30%.
An institutional fund deploys capital into Uniswap V3/V4 for liquidity provision and uses this skill to maintain positions in-range during market volatility. It handles fee collection and range adjustments in a single workflow, reducing manual intervention and maximizing returns on large positions while managing gas costs efficiently.
A trading bot incorporates this skill to dynamically rebalance LP positions when price movements cause them to go out of range, integrating with real-time price feeds. This ensures the bot maintains active liquidity and fee income, enhancing automated trading strategies by reducing dead capital and improving overall profitability.
A DAO uses this skill to manage its treasury's Uniswap V3/V4 LP positions, rebalancing them to stay centered on current prices and collect fees. This helps optimize revenue from liquidity provision, supporting protocol sustainability and rewarding token holders without requiring constant manual oversight from community members.
A retail investor with limited DeFi experience uses this skill to easily rebalance out-of-range LP positions, prompted by alerts from performance tracking. It provides clear cost-benefit calculations and automated execution, enabling passive income generation from liquidity provision without deep technical knowledge of Uniswap mechanics.
Offer this skill as part of a subscription-based platform that monitors and rebalances Uniswap LP positions for users. Revenue comes from monthly fees, with tiered pricing based on the number of positions managed or total value locked, providing automated optimization to maximize fee earnings.
License this skill to cryptocurrency exchanges or DeFi platforms as a white-label feature for their users. Revenue is generated through licensing fees or revenue-sharing agreements, enhancing the platform's value by offering advanced liquidity management tools to attract and retain customers.
Provide this skill for free with basic rebalancing functionality, while charging for premium features like advanced analytics, multi-chain support, or priority execution. Revenue comes from upsells to power users and institutions seeking deeper insights and faster transaction processing.
π¬ Integration Tip
Integrate with portfolio tracking tools to trigger rebalancing alerts automatically, and ensure gas cost estimations are accurate to avoid user dissatisfaction from unexpected fees.
Connect Claude to Clawdbot instantly and keep it connected 24/7. Run after setup to link your subscription, then auto-refreshes tokens forever.
ERC-8004 Trustless Agents - Register, discover, and build reputation for AI agents on Ethereum. Use when registering agents on-chain, querying agent registries, giving/receiving reputation feedback, or interacting with the AI agent trust layer.
Autonomous crypto trading on Base via Bankr. Use for trading tokens, monitoring launches, executing strategies, or managing a trading portfolio. Triggers on "trade", "buy", "sell", "launch", "snipe", "profit", "PnL", "portfolio balance", or any crypto trading task on Base.
Deploy ERC20 tokens on Base using Clanker SDK. Create tokens with built-in Uniswap V4 liquidity pools. Supports Base mainnet and Sepolia testnet. Requires PRIVATE_KEY in config.
Query DeFi portfolio data across 50+ chains via Zapper's GraphQL API. Use when the user wants to check wallet balances, DeFi positions, NFT holdings, token prices, or transaction history. Supports Base, Ethereum, Polygon, Arbitrum, Optimism, and more. Requires ZAPPER_API_KEY.
Interact with Solana blockchain via Helius APIs. Create/manage wallets, check balances (SOL + tokens), send transactions, swap tokens via Jupiter, and monitor addresses. Use for any Solana blockchain operation, crypto wallet management, token transfers, DeFi swaps, or portfolio tracking.