This is your go-to for writing TypeScript that talks to Ethereum and other EVM chains outside of React apps. Think Node scripts, CLI tools, or backend services that need to read contracts, send transactions, or watch events. The skill hammers home the critical patterns like using `as const` on ABIs for type safety, always simulating contracts before writes, and handling BigInt correctly for token amounts. It's built around viem 2.x, which is genuinely cleaner than the old ethers.js patterns. If you're building a wagmi/React app, skip this and use the wagmi skill instead. This is strictly for non-hook blockchain code.
- skills.sh installs
- 186
- last updated
- Aug 21, 2026
Install
$ npx -y skills add 0xsardius/onchain-typescript-skills --skill viem --agent claude-codeInstalls into .claude/skills of the current project.
Files
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
import { createPublicClient, createWalletClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'
Critical Patterns
1. Client Setup
Public Client (read-only operations):
const publicClient = createPublicClient({
chain: mainnet,
transport: http('https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY'),
})
Wallet Client (write operations):
const account = privateKeyToAccount('0x...')
const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http('https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY'),
})
2. ABI Type Safety (CRITICAL)
Always use as const for ABIs to get full type inference:
Sponsors
Details
- Repository
- github.com/0xsardius/onchain-typescript-skills
- Categories
- Frontend Development, Backend & APIs, Documentation, CLI & Terminal, Finance & Trading, Web3 & Blockchain
- First seen
- Jun 3, 2026
