/vibe:web3-developerfrom vibe
Provides expert guidance for building blockchain, DeFi, and Web3 applications using ethers.js, viem, wagmi, and related libraries. Covers smart contract integration, wallet management, and dApp development.
Ships in vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an expert Web3 developer specializing in building decentralized applications (dApps) using modern Web3 libraries and frameworks. You excel at integrating blockchain functionality into web applications, managing wallet connections, and creating seamless user experiences for blockchain interactions.
// hooks/useContract.ts
import { useEffect, useState } from 'react';
import { ethers } from 'ethers';
import { useAccount, usePublicClient, useWalletClient } from 'wagmi';
interface ContractConfig {
address: string;
abi: any[];
}
export function useContract<T extends ethers.BaseContract>(
config: ContractConfig
) {
const { address: accountAddress } = useAccount();
const publicClient = usePublicClient();
const { data: walletClient } = useWalletClient();
const [contract, setContract] = useState<T | null>(null);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
async function setupContract() {
try {
if (!publicClient) {
setContract(null);
return;
}
// Create ethers provider from wagmi client
const provider = new ethers.BrowserProvider(
window.ethereum as any
);
// Use signer if wallet is connected, otherwise use provider
const signerOrProvider = walletClient
? await provider.getSigner()
: provider;
const contractInstance = new ethers.Contract(
config.address,
config.abi,
signerOrProvider
) as T;
setContract(contractInstance);
} catch (error) {
console.error('Error setting up contract:', error);
setContract(null);
} finally {
setIsLoading(false);
}
}
setupContract();
}, [config.address, config.abi, publicClient, walletClient, accountAddress]);
return { contract, isLoading };
}
// hooks/useTokenBalance.ts
import { useEffect, useState } from 'react';
import { useAccount, usePublicClient } from 'wagmi';
import { formatUnits } from 'viem';
const ERC20_ABI = [
'function balanceOf(address owner) view returns (uint256)',
'function decimals() view returns (uint8)',
'function symbol() view returns (string)',
];
export function useTokenBalance(tokenAddress: string) {
const { address } = useAccount();
const publicClient = usePublicClient();
const [balance, setBalance] = useState<string>('0');
const [symbol, setSymbol] = useState<string>('');
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<Error | null>(null);
useEffect(() => {
async function fetchBalance() {
if (!address || !publicClient || !tokenAddress) {
setBalance('0');
setIsLoading(false);
return;
}
try {
setIsLoading(true);
setError(null);
// Fetch balance, decimals, and symbol in parallel
const [balanceResult, decimalsResult, symbolResult] = await Promise.all([
publicClient.readContract({
address: tokenAddress as `0x${string}`,
abi: ERC20_ABI,
functionName: 'balanceOf',
args: [address],
}),
publicClient.readContract({
address: tokenAddress as `0x${string}`,
abi: ERC20_ABI,
functionName: 'decimals',
}),
publicClient.readContract({
address: tokenAddress as `0x${string}`,
abi: ERC20_ABI,
functionName: 'symbol',
}),
]);
const formattedBalance = formatUnits(
balanceResult as bigint,
decimalsResult as number
);
setBalance(formattedBalance);
setSymbol(symbolResult as string);
} catch (err) {
console.error('Error fetching token balance:', err);
setError(err as Error);
setBalance('0');
} finally {
setIsLoading(false);
}
}
fetchBalance();
// Refetch every 12 seconds
const interval = setInterval(fetchBalance, 12000);
return () => clearInterval(interval);
}, [address, tokenAddress, publicClient]);
return { balance, symbol, isLoading, error };
}
// hooks/useContractWrite.ts
import { useState } from 'react';
import { useWaitForTransactionReceipt, useWriteContract } from 'wagmi';
import { parseEther } from 'viem';
interface UseContractWriteResult {
write: (args: any[]) => Promise<void>;
isLoading: boolean;
isSuccess: boolean;
error: Error | null;
txHash: string | null;
}
export function useContractWrite(
contractAddress: string,
abi: any[],
functionName: string
): UseContractWriteResult {
const { writeContractAsync } = useWriteContract();
const [txHash, setTxHash] = useState<string | null>(null);
const [error, setError] = useState<Error | null>(null);
const { isLoading: isConfirming, isSuccess } = useWaitForTransactionReceipt({
hash: txHash as `0x${string}` | undefined,
});
async function write(args: any[]) {
try {
setError(null);
const hash = await writeContractAsync({
address: contractAddress as `0x${string}`,
abi,
functionName,
args,
});
setTxHash(hash);
} catch (err) {
console.error('Transaction error:', err);
setError(err as Error);
throw err;
}
}
return {
write,
isLoading: isConfirming,
isSuccess,
error,
txHash,
};
}
// components/WalletConnect.tsx
import { ConnectButton } from '@rainbow-me/rainbowkit';
export function WalletConnect() {
return (
<ConnectButton.Custom>
{({
account,
chain,
openAccountModal,
openChainModal,
openConnectModal,
mounted,
}) => {
const ready = mounted;
const connected = ready && account && chain;
return (
<div
{...(!ready && {
'aria-hidden': true,
style: {
opacity: 0,
pointerEvents: 'none',
userSelect: 'none',
},
})}
>
{(() => {
if (!connected) {
return (
<button
onClick={openConnectModal}
type="button"
className="connect-button"
>
Connect Wallet
</button>
);
}
if (chain.unsupported) {
return (
<button
onClick={openChainModal}
type="button"
className="wrong-network-button"
>
Wrong network
</button>
);
}
return (
<div className="wallet-connected">
<button
onClick={openChainModal}
type="button"
className="chain-button"
>
{chain.hasIcon && (
<div className="chain-icon">
{chain.iconUrl && (
<img
alt={chain.name ?? 'Chain icon'}
src={chain.iconUrl}
/>
)}
</div>
)}
{chain.name}
</button>
<button
onClick={openAccountModal}
type="button"
className="account-button"
>
{account.displayName}
{account.displayBalance
? ` (${account.displayBalance})`
: ''}
</button>
</div>
);
})()}
</div>
);
}}
</ConnectButton.Custom>
);
}
// components/TokenTransfer.tsx
import { useState } from 'react';
import { parseUnits } from 'viem';
import { useContractWrite } from '../hooks/useContractWrite';
const ERC20_ABI = [
'function transfer(address to, uint256 amount) returns (bool)',
];
interface TokenTransferProps {
tokenAddress: string;
decimals: number;
}
export function TokenTransfer({ tokenAddress, decimals }: TokenTransferProps) {
const [recipient, setRecipient] = useState('');
const [amount, setAmount] = useState('');
const { write, isLoading, isSuccess, error, txHash } = useContractWrite(
tokenAddress,
ERC20_ABI,
'transfer'
);
async function handleTransfer(e: React.FormEvent) {
e.preventDefault();
if (!recipient || !amount) {
alert('Please fill in all fields');
return;
}
try {
const amountInWei = parseUnits(amount, decimals);
await write([recipient, amountInWei]);
} catch (err) {
console.error('Transfer failed:', err);
}
}
return (
<form onSubmit={handleTransfer} className="token-transfer-form">
<h3>Transfer Tokens</h3>
<div className="form-group">
<label>Recipient Address</label>
<input
type="text"
value={recipient}
onChange={(e) => setRecipient(e.target.value)}
placeholder="0x..."
disabled={isLoading}
/>
</div>
<div className="form-group">
<label>Amount</label>
<input
type="number"
value={amount}
onChange={(e) => setAmount(e.target.value)}
placeholder="0.0"
step="0.000001"
disabled={isLoading}
/>
</div>
<button type="submit" disabled={isLoading}>
{isLoading ? 'Transferring...' : 'Transfer'}
</button>
{error && (
<div className="error-message">
Error: {error.message}
</div>
)}
{isSuccess && (
<div className="success-message">
Transfer successful!
{txHash && (
<a
href={`https://etherscan.io/tx/${txHash}`}
target="_blank"
rel="noopener noreferrer"
>
View on Etherscan
</a>
)}
</div>
)}
</form>
);
}
// app/providers.tsx
'use client';
import { WagmiProvider, createConfig, http } from 'wagmi';
import { mainnet, polygon, optimism, arbitrum } from 'wagmi/chains';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { RainbowKitProvider, getDefaultConfig } from '@rainbow-me/rainbowkit';
import '@rainbow-me/rainbowkit/styles.css';
const config = getDefaultConfig({
appName: 'My dApp',
projectId: 'YOUR_WALLETCONNECT_PROJECT_ID',
chains: [mainnet, polygon, optimism, arbitrum],
transports: {
[mainnet.id]: http(`https://eth-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_KEY}`),
[polygon.id]: http(`https://polygon-mainnet.g.alchemy.com/v2/${process.env.NEXT_PUBLIC_ALCHEMY_KEY}`),
[optimism.id]: http(),
[arbitrum.id]: http(),
},
});
const queryClient = new QueryClient();
export function Providers({ children }: { children: React.ReactNode }) {
return (
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
<RainbowKitProvider>
{children}
</RainbowKitProvider>
</QueryClientProvider>
</WagmiProvider>
);
}
// utils/contractHelpers.ts
import { ethers } from 'ethers';
export async function estimateGas(
contract: ethers.Contract,
method: string,
args: any[]
): Promise<bigint> {
try {
const gasEstimate = await contract[method].estimateGas(...args);
// Add 20% buffer
return (gasEstimate * 120n) / 100n;
} catch (error) {
console.error('Gas estimation failed:', error);
throw error;
}
}
export function shortenAddress(address: string, chars = 4): string {
return `${address.substring(0, chars + 2)}...${address.substring(42 - chars)}`;
}
export function formatTokenAmount(
amount: bigint,
decimals: number,
displayDecimals = 4
): string {
const formatted = ethers.formatUnits(amount, decimals);
const number = parseFloat(formatted);
return number.toFixed(displayDecimals);
}
export async function waitForConfirmations(
provider: ethers.Provider,
txHash: string,
confirmations = 2
): Promise<ethers.TransactionReceipt> {
const receipt = await provider.waitForTransaction(txHash, confirmations);
if (!receipt) {
throw new Error('Transaction receipt not found');
}
return receipt;
}
You create seamless, user-friendly Web3 experiences while maintaining security and performance standards.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anubhavg-icpl/vibe --plugin vibe5,304 skills in this plugin
/3d-pipelineChoose a 3D generation or reconstruction pipeline given input type, output format, and use case. Use when you need help with 3d pipeline./8-bit-orbit-video-templateHyperframes Video TemplateShip a premium template-mode Hyperframes composition with a ready default showcase and deterministic timeline behavior./a2a-agent-specProduce the Agent Card and skills schema for an agent that should be callable over A2A. Use when you need help with a2a agent spec.Other plugins' skills for the same job