viem — viem ethereum client Project-Remora-Frontend, community, viem ethereum client, ide skills, viem type safety, viem contract interactions, Claude Code, Cursor, Windsurf

v2.x
GitHub

About this Skill

Perfect for Blockchain Agents needing secure Ethereum smart contract interactions and type safety. Viem is a TypeScript interface for Ethereum, providing a modern approach to client setup, contract interactions, and type safety.

Features

Imports Ethereum clients via `createPublicClient` and `createWalletClient`
Supports HTTP requests using `http` from 'viem'
Utilizes `mainnet` from 'viem/chains' for chain configuration
Enables account management with `privateKeyToAccount` from 'viem/accounts'
Ensures type safety for contract interactions
Provides a quick reference guide for common use cases

# Core Topics

pelith pelith
[0]
[0]
Updated: 3/8/2026

Agent Capability Analysis

The viem skill by pelith is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance. Optimized for viem ethereum client, viem type safety, viem contract interactions.

Ideal Agent Persona

Perfect for Blockchain Agents needing secure Ethereum smart contract interactions and type safety.

Core Value

Empowers agents to securely interact with Ethereum smart contracts using the Viem TypeScript interface, ensuring correct patterns for contract interactions, client setup, and type safety with libraries like 'viem' and protocols such as HTTP.

Capabilities Granted for viem

Automating Ethereum smart contract deployments
Generating secure client setups for mainnet and testnet interactions
Debugging type safety issues in Ethereum smart contract integrations

! Prerequisites & Limits

  • Requires TypeScript environment
  • Ethereum blockchain only
  • Private key management required for wallet client setup
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

viem

Install viem, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Viem Skill

Version: Viem 2.x | Official Docs

Viem is the modern TypeScript interface for Ethereum. This skill ensures correct patterns for contract interactions, client setup, and type safety.

Quick Reference

typescript
1import { createPublicClient, createWalletClient, http } from 'viem' 2import { mainnet } from 'viem/chains' 3import { privateKeyToAccount } from 'viem/accounts'

Critical Patterns

1. Client Setup

Public Client (read-only operations):

typescript
1const publicClient = createPublicClient({ 2 chain: mainnet, 3 transport: http('https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY'), 4})

Wallet Client (write operations):

typescript
1const account = privateKeyToAccount('0x...') 2const walletClient = createWalletClient({ 3 account, 4 chain: mainnet, 5 transport: http('https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY'), 6})

2. ABI Type Safety (CRITICAL)

Always use as const for ABIs to get full type inference:

typescript
1// ✅ CORRECT - Full type safety 2const abi = [ 3 { 4 name: 'balanceOf', 5 type: 'function', 6 stateMutability: 'view', 7 inputs: [{ name: 'owner', type: 'address' }], 8 outputs: [{ name: '', type: 'uint256' }], 9 }, 10] as const 11 12// ❌ WRONG - No type inference 13const abi = [{ name: 'balanceOf', ... }] // Missing `as const`

3. Contract Read Pattern

typescript
1const balance = await publicClient.readContract({ 2 address: '0x...', // Contract address 3 abi, 4 functionName: 'balanceOf', 5 args: ['0x...'], // Args are fully typed when using `as const` 6})

4. Contract Write Pattern (Simulate First!)

Always simulate before writing to catch errors early:

typescript
1// Step 1: Simulate 2const { request } = await publicClient.simulateContract({ 3 account, 4 address: '0x...', 5 abi, 6 functionName: 'transfer', 7 args: ['0x...', 1000000n], // Use BigInt for uint256 8}) 9 10// Step 2: Execute 11const hash = await walletClient.writeContract(request) 12 13// Step 3: Wait for receipt 14const receipt = await publicClient.waitForTransactionReceipt({ hash })

5. Event Watching

typescript
1const unwatch = publicClient.watchContractEvent({ 2 address: '0x...', 3 abi, 4 eventName: 'Transfer', 5 onLogs: (logs) => { 6 for (const log of logs) { 7 console.log(log.args.from, log.args.to, log.args.value) 8 } 9 }, 10}) 11 12// Clean up 13unwatch()

6. Multicall for Batch Reads

typescript
1const results = await publicClient.multicall({ 2 contracts: [ 3 { address: '0x...', abi, functionName: 'balanceOf', args: ['0x...'] }, 4 { address: '0x...', abi, functionName: 'totalSupply' }, 5 ], 6}) 7// results[0].result, results[1].result

Common Mistakes

MistakeFix
Missing as const on ABIAdd as const for type inference
Using Number for amountsUse BigInt literals: 1000000n
Writing without simulateAlways simulateContract first
Hardcoding gasLet viem estimate, or use gas: await publicClient.estimateGas(...)
Not awaiting receiptsUse waitForTransactionReceipt for confirmation

Chain Configuration

typescript
1import { mainnet, polygon, arbitrum, optimism, base } from 'viem/chains' 2 3// Custom chain 4const customChain = { 5 id: 123, 6 name: 'My Chain', 7 nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 }, 8 rpcUrls: { 9 default: { http: ['https://rpc.mychain.com'] }, 10 }, 11}

Error Handling

typescript
1import { BaseError, ContractFunctionRevertedError } from 'viem' 2 3try { 4 await publicClient.simulateContract({ ... }) 5} catch (err) { 6 if (err instanceof BaseError) { 7 const revertError = err.walk(e => e instanceof ContractFunctionRevertedError) 8 if (revertError instanceof ContractFunctionRevertedError) { 9 const errorName = revertError.data?.errorName 10 // Handle specific revert reason 11 } 12 } 13}

References

For detailed patterns, see:

  • references/contract-patterns.md - Advanced contract interaction patterns
  • references/common-errors.md - Error handling and debugging guide
  • Viem Documentation - Official docs
  • Viem GitHub - Source and releases

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is viem?

Perfect for Blockchain Agents needing secure Ethereum smart contract interactions and type safety. Viem is a TypeScript interface for Ethereum, providing a modern approach to client setup, contract interactions, and type safety.

How do I install viem?

Run the command: npx killer-skills add pelith/Project-Remora-Frontend/viem. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for viem?

Key use cases include: Automating Ethereum smart contract deployments, Generating secure client setups for mainnet and testnet interactions, Debugging type safety issues in Ethereum smart contract integrations.

Which IDEs are compatible with viem?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for viem?

Requires TypeScript environment. Ethereum blockchain only. Private key management required for wallet client setup.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add pelith/Project-Remora-Frontend/viem. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use viem immediately in the current project.

Related Skills

Looking for an alternative to viem or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI