Skip to content
Back to skills

Web3 Frontend

ASecurity

Wire a dapp frontend to contracts with wagmi/viem (or ethers) for wallet, reads, and writes

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 3, 2026
ai-agentsgoreactapifrontendbackend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill web3-frontend --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Web3 Frontend?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Web3 Frontend
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-web3-frontend/badge)](https://www.skillsdirectory.com/skills/black141312-web3-frontend)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: web3-frontend
description: Wire a dapp frontend to contracts with wagmi/viem (or ethers) for wallet, reads, and writes
category: web3
---

# Web3 Frontend

Use when connecting a React/Next dapp to on-chain contracts. Prefer wagmi + viem for typed, hook-based access; ethers is the fallback.

1. Install and configure: `wagmi`, `viem`, and a connector kit (RainbowKit/ConnectKit); define `chains`, transports (RPC URLs from env), and wrap the app in `WagmiProvider` + a React Query client.
2. Handle connection: render a connect button, read account/chain via `useAccount`/`useChainId`, and prompt a network switch when the wrong chain is active.
3. Load typed ABIs: import the contract ABI `as const` so viem infers argument and return types.
4. Read state with `useReadContract`/`useReadContracts`; batch related reads and key cache invalidation on the relevant block/account.
5. Send transactions with `useWriteContract` + `useWaitForTransactionReceipt`; surface pending → confirmed → error states in the UI.
6. Decode reverts and events into human-readable messages; format token amounts with `formatUnits`/`parseUnits` using the token's decimals.
7. Test against a local fork/testnet (Anvil/Hardhat) before pointing at mainnet.

## Rules
- Never hardcode private keys or seed phrases in frontend code — the wallet signs, the app never holds keys.
- Put RPC URLs and API keys in env vars and proxy paid RPC through a backend to avoid leaking quota.
- Always check `chainId` and the connected account before a write; guard against wrong-network sends.
- Use `parseUnits`/`formatUnits` with correct decimals; never do token math in floats.
- Show explicit loading/pending/error states — transactions are async and can fail or be dropped.
- Validate addresses (`isAddress`) and handle user rejection (code 4001) gracefully.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…