viem-best-practices
Installation
SKILL.md
Viem best practices
Use when building or reviewing TypeScript Ethereum integrations with viem.
Mental model
- viem is a low-level, typed, stateless Ethereum interface built around clients, transports, actions, and typed utilities.
- Keep client setup, transport choice, account ownership, and contract interaction explicit.
- Prefer composable viem helpers over broad wrappers that obscure what RPC calls and signing behavior are actually happening.
Clients and transports
- Choose the correct client type for the job: public client for reads, wallet client for signing and writes, test client for local-chain control.
- Make transport selection explicit: http, webSocket, or custom EIP-1193 transport depending on the environment.
- Keep authenticated RPC provider configuration centralized and avoid scattering raw URLs across the codebase.