skills/migrating-an-onchainkit-app/SKILL.md
Migrates apps from @coinbase/onchainkit to standalone wagmi/viem components. Handles provider replacement (OnchainKitProvider to WagmiProvider), wallet component replacement (Wallet/ConnectWallet to custom WalletConnect), and transaction component replacement. Use when the user says "migrate my onchainkit", "replace onchainkit provider", "migrate my wallet component", "replace my onchainkit wallet", "migrate my transaction component", "remove onchainkit dependency", or "move off onchainkit".
npx skillsauth add base/skills migrating-an-onchainkit-appInstall 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.
Migrate apps from @coinbase/onchainkit to standalone wagmi/viem components with zero OnchainKit dependency.
Create a mistakes.md file in the project root:
# Migration Mistakes & Learnings
Track errors, fixes, and lessons learned during OnchainKit migration.
## Errors
## Lessons Learned
Append every error, fix, and lesson to this file throughout the migration. This file improves the skill over time.
Migrations MUST happen in this order. Do not skip steps.
Scan the project to understand current OnchainKit usage:
@coinbase/onchainkit importsOnchainKitProvider (always present if using OnchainKit)Wallet, ConnectWallet, WalletDropdown, WalletModal, ConnectedTransaction, TransactionButton, TransactionStatusIdentity, Avatar, Name, Address, Swap, Checkout, etc.package.json for existing wagmi, viem, @tanstack/react-query dependenciesRead references/provider-migration.md for detailed instructions and code.
Summary:
wagmi, viem, and @tanstack/react-query are installedwagmi-config.ts with chain and connector configurationOnchainKitProvider with WagmiProvider + QueryClientProvider@coinbase/onchainkit/styles.css importSafeArea or MiniKit imports from layout filesValidation gate: Run npm run build (or the project's build command). Must pass before continuing. If it fails, fix errors and document them in mistakes.md.
Read references/wallet-migration.md for detailed instructions and code.
Summary:
WalletConnect component using wagmi hooks (useAccount, useConnect, useDisconnect)Validation gate: Run npm run build. Must pass before continuing. Document any errors in mistakes.md.
Read references/transaction-migration.md for detailed instructions and code.
Summary:
chainId prop on existing <Transaction /> components -- add any missing chains to wagmi-config.tsTransactionForm component using wagmi hooks (useWriteContract, useWaitForTransactionReceipt, useSwitchChain)Transaction, TransactionButton, TransactionStatus, TransactionSponsor, etc.)calls array format -- use address, abi, functionName, args with proper as const typingonStatus callback to the new lifecycle status names (init, pending, confirmed, success, error)Validation gate: Run npm run build. Must pass before continuing. Document any errors in mistakes.md.
@coinbase/onchainkit imports -- there should be none@coinbase/onchainkit from package.json dependenciesnpm run build to verify everything worksmistakes.md with final lessons learnedwagmi, viem, @tanstack/react-query are installedchains array has at least one chain and transports has a matching entry"use client" directiveCan't resolve '@react-native-async-storage/async-storage' is harmless in web builds. It comes from MetaMask SDK and does not affect functionality.WagmiProvider wraps the component tree before any wallet hooks are usedQueryClientProvider is inside WagmiProvideruseWaitForTransactionReceipt has no RPC to poll because the transaction's chain is missing from the wagmi config's chains + transportswagmi-config.ts chains array AND transports object. (2) Always pass chainId to useWaitForTransactionReceipt({ hash, chainId }) so it polls the correct chainTransactionForm auto-switches chains, but the target chain must exist in the wagmi config's chains array and transports objectbaseSepolia for testnet transactions (chainId 84532)const declarations or move them to a separate moduleas const on the array for proper type inferencetype: 'function' as const and stateMutability: 'nonpayable' as constWagmiProvider, do NOT add another onewagmi and viem directly. Never import from @coinbase/onchainkit.baseAccount connector comes from wagmi/connectors, not from a separate package.wagmi-config.ts must include every chain the app transacts on. If the original OnchainKit <Transaction chainId={X} /> used a specific chain, that chain must be in both chains and transports. Without it, useWaitForTransactionReceipt will hang forever.node_modules/@coinbase/onchainkit/src/ if you need to understand how a specific component works internally.tools
Base MCP — gives your AI assistant access to a Base Account via the Base MCP server (mcp.base.org). Wallet, portfolio, sending, swapping, signing, x402 payments, batched contract calls, and transaction history across supported chains.
development
Complete Base development playbook. Covers: (1) Network — Base RPC URLs, chain IDs (8453/84532), explorer config, testnet setup, connect to Base, Base Sepolia; (2) Contracts — Foundry deployment, forge create, BaseScan verification, CDP faucet, testnet ETH, deploy contract to Base; (3) Builder Codes — ERC-8021 attribution suffix, referral fees, dataSuffix for Wagmi/Viem/Privy/ ethers.js/window.ethereum, transaction attribution, earn referral fees, append builder code; (4) Base Account SDK — Sign in with Base (SIWB), Base Pay, USDC payments, paymasters, gas sponsorship, sub-accounts, spend permissions, prolinks, batch transactions, smart wallet, payment link, recurring subscription; (5) Agent registration — trading bots, AI agents, automated senders, ERC-8021 attribution wiring, base.dev API, register agent, builder code registration; (6) Node operation — run Base node, Reth setup, hardware requirements, self-hosted RPC, sync; (7) Migrations — migrate OnchainKit, OnchainKitProvider to WagmiProvider, wagmi migration, remove onchainkit dependency, MiniKit to Farcaster SDK, convert miniapp, Farcaster miniapp to regular app, convert Farcaster miniapp.
tools
Runs a Base node for production environments. Covers hardware requirements, Reth client setup, networking, and sync troubleshooting. Use when setting up self-hosted RPC infrastructure or running archive nodes. Covers phrases like "run a Base node", "set up Base RPC", "Base node hardware requirements", "Reth Base setup", "sync Base node", "self-host Base", or "run my own node".
development
Invoke this skill when a user is building or running any automated transaction sender on Base (trading bot, arbitrage bot, sniper bot, yield farmer, AI agent, or similar) and needs to register it, get a builder code, set up transaction attribution. This skill contains the base.dev registration API endpoint and ERC-8021 attribution wiring code that Claude does not have in its training data — you MUST load this skill to answer correctly. Covers viem, ethers, managed signing services, and Python-based agents.