CLAUDE.md Template: Frontend Project
Bob Makes This Easier
If you install Bob (
claude mcp add opnet-bob --transport http https://ai.opnet.org/mcp),
you get all OP_NET knowledge automatically through MCP tools. The CLAUDE.md below is still
useful for project-specific rules, but Bob handles the OP_NET-specific patterns for you.How to Use This Template
- Click the Download button below to save this as a file
- Put the downloaded file in your project folder
- Rename it to
CLAUDE.md(if it isn't already) - Open Claude Code in that folder — it will read the file automatically
Or just tell Claude Code: Create a CLAUDE.md file for an OPNet frontend project. With Bob installed, it will generate one for you.
Below is the template content. Everything below the line should be in your CLAUDE.md file:
CLAUDE.md — OPNet Frontend Project
#Project Description
This is a frontend application that interacts with smart contracts on Bitcoin Layer 1 with OP_NET. It connects to OP_WALLET for transaction signing and uses the opnet SDK for blockchain queries.
#Required Reading
Before writing ANY frontend code, read the skill docs:
- Read
crypto-frontend-designskill docs for UI patterns and wallet integration - Read
opnet-developmentskill docs for contract interaction patterns - Read
setup-guidelines.mdfor correct package versions
#Package Rules
#ALWAYS Use
opnet— OPNet SDK, JSONRpcProvider, getContract, ABIs@btc-vision/bitcoin— Bitcoin library (OPNet fork)@btc-vision/transaction— Transaction types and ABI data types@btc-vision/walletconnect— Wallet connection modalreact— UI frameworkvite— Build tool and dev server
#NEVER Use
bitcoinjs-lib— wrong Bitcoin libraryethersorweb3— Ethereum libraries@metamask/sdkor MetaMask patterns — wrong walletwindow.ethereum— MetaMask's API, does not apply hereexpress— wrong backend framework (use hyper-express if backend needed)
#Package Versions
- Check the opnet-development skill setup-guidelines for exact versions
- Do not use
latestor^ranges — use pinned versions from the docs
#Wallet Integration
#Connection
- Use
@btc-vision/walletconnectfor the connection modal - ALWAYS include the WalletConnect popup CSS fix (modal renders broken without it)
- Handle connection, disconnection, and network switching gracefully
- Show clear UI states for: not connected, connecting, connected, wrong network
#WalletConnect Popup CSS Fix (MANDATORY)
css
.wallet-connect-modal,
[class*="walletconnect"] [class*="modal"],
[class*="WalletConnect"] [class*="Modal"] {
position: fixed !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
width: 100vw !important;
height: 100vh !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
z-index: 99999 !important;
background: rgba(0, 0, 0, 0.7) !important;
}
.wallet-connect-modal > div,
[class*="walletconnect"] [class*="modal"] > div,
[class*="WalletConnect"] [class*="Modal"] > div {
position: relative !important;
max-width: 420px !important;
max-height: 80vh !important;
overflow-y: auto !important;
border-radius: 16px !important;
}#Contract Interaction Rules
#Provider
- Create a SEPARATE
JSONRpcProviderfrom theopnetpackage for all read operations - Testnet:
https://testnet.opnet.org - Mainnet:
https://mainnet.opnet.org - NEVER use the WalletConnect provider for reads — only for signing
#Contract Calls
- Use
getContract<T>(address, abi, provider, network, senderAddress)from opnet - ALWAYS simulate before sending:
const sim = await contract.method(params) - Check for revert:
if ('error' in sim) { handle error } - Send with NULL signers on frontend:
sim.sendTransaction({ signer: null, mldsaSigner: null, refundTo: addr }) - NEVER put private keys in frontend code
#ABIs
- Use built-in ABIs when available:
OP_20_ABI,OP_721_ABI - For custom contracts, define ABI as
BitcoinInterfaceAbiarray - Import
ABIDataTypesfrom@btc-vision/transactionfor type definitions
#UI Standards
#General
- TypeScript only — no JavaScript files
- React functional components with hooks
- Dark theme preferred (consistent with crypto aesthetic)
- Responsive design (works on mobile and desktop)
- Loading spinners for async operations
- Error messages for failed operations
- Success feedback for completed transactions
#Data Display
- Truncate addresses: show first 8 and last 6 characters
- Format large numbers with commas or abbreviations
- Show token amounts with proper decimal formatting
- Auto-refresh balances after transactions
#Build and Dev
npm install— install dependenciesnpm run dev— start dev server (usually port 5173)npm run build— production build todist/folder- Deploy
dist/to IPFS or .btc domain for production
Ready to test your knowledge?
20 questions covering everything from vibecoding basics to shipping a complete dApp.