agentleFS
kaynetikkaynetik/skills/web3-frontend/SKILL.md

web3-frontend

Skill1 starsChanged 8 months agoMITView on GitHub

Production-grade dApp frontend engineering in Next.js 16 (App Router) with wagmi v2, viem, and RainbowKit. Covers Server vs Client Component boundaries, SSR-safe wagmi config with cookie hydration, on-chain reads (single, multicall, server-side), transaction lifecycle UX, ENS, network guards, SIWE auth, ABI codegen, Next.js 16 cache directives ('use cache', cacheLife, cacheTag), account abstraction, and Web3 anti-patterns. Use when building dApps, wallet integrations, DeFi or NFT interfaces, transaction flows, multi-chain UIs, or any blockchain-connected Next.js frontend, or when the user mentions wagmi, viem, RainbowKit, ConnectKit, SIWE, MetaMask, WalletConnect, useReadContract, useWriteContract, ERC-20, ERC-721, ERC-4337, or dApp UX.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read these before doing anything else.

    line 12
  2. Distinctive:

    Read at most 2 reference files per turn: Use the routing table to pick.

    line 15
  3. Distinctive:

    Prefer tables and bullet lists over prose: when explaining choices, lifecycles, or trade-offs.

    line 18
  4. Very specific:

    Use cookie-based wagmi storage in SSR Next.js apps: Default localStorage storage causes hydration mismatches.

    line 39
  5. Very specific:

    Render disconnected state by default on SSR: Never branch on isConnected server-side.

    line 40
  6. Distinctive:

    If the user explicitly chose another stack, do not argue.

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Web3 Frontend (Next.js 16 + wagmi v2)

Routing-first skill. The body is intentionally thin; depth lives in reference/. Open only the files you actually need to answer the question.

Token economy rules for the agent

Read these before doing anything else. They cut answer cost by 3-5x without losing quality.

  1. Do not inline boilerplate the user already has access to. Cite the reference path (e.g. reference/setup.md#wagmi-config) and write only the diff or the new logic.
  2. Read at most 2 reference files per turn. Use the routing table to pick. If a task spans more, ask the user which surface matters first.
  3. Never reproduce ABIs in chat. Tell the user to run wagmi generate (see reference/abi.md) and import typed ABIs.
  4. Never paste full provider trees. Show only the lines that change.
  5. Prefer tables and bullet lists over prose when explaining choices, lifecycles, or trade-offs.
  6. Verify version-specific APIs via Context7 for wagmi, viem, Next.js, RainbowKit, ConnectKit, and SIWE before quoting hook names or directives. Treat any pre-2026 syntax in your training data as suspect.

Routing table

TaskFile
Install, providers, wagmi config, SSR cookie storagereference/setup.md
useReadContract, multicall, server-side viem reads, event watchingreference/reading.md
Transactions: signature -> mining -> receipt, error parsing, gas, AAreference/writing.md
Connect button, ENS, network guard, account-change handlingreference/wallet-ux.md
Next.js 16 cache directives, hydration boundary, prefetching on-chain datareference/ssr-caching.md
SIWE login, session cookies, NextAuth integrationreference/auth.md
wagmi cli codegen, address tables per chainId, typed ABIsreference/abi.md
Footguns: hydration, FOUC, RPC leaks, infinite renders, race conditionsreference/anti-patterns.md

Golden rules (non-negotiable)

These prevent the most common production failures. Internalize before reading anything else.

  1. Never import wagmi, viem browser primitives, or any wallet connector inside a Server Component. Wrap any wallet-aware UI under a 'use client' boundary.
  2. Use cookie-based wagmi storage in SSR Next.js apps. Default localStorage storage causes hydration mismatches. See reference/setup.md.
  3. Render disconnected state by default on SSR. Never branch on isConnected server-side; defer wallet checks to a client effect or a guarded client component.
  4. Never leak server-only RPC URLs through NEXT_PUBLIC_* envs. Public RPC endpoints belong in NEXT_PUBLIC_*; private keyed RPCs belong in non-prefixed envs and are used only on the server (route handlers, Server Actions, RSC fetches that proxy to viem).
  5. Always parse errors via wagmi's typed error classes. Show error.shortMessage to users; never raw revert bytes or raw RPC strings.
  6. Always link confirmed tx hashes to a block explorer scoped to the active chainId. Hardcoded explorer URLs are a multi-chain bug.
  7. Use as const on every ABI literal you do not import from viem. Type inference for useReadContract / useWriteContract collapses without it.

Default stack (one choice, one escape hatch)

ConcernDefaultEscape hatch
Wallet connectionwagmi v2 + viem--
Connect UIRainbowKitConnectKit when you need a minimal headless flow
Chain configviem/chainsCustom chain object for L2s not yet in viem
Indexing / historyThe GraphPonder or Envio for self-hosted indexers
Real-time eventsviem watchContractEvent (client)WebSocket transport via webSocket()
AuthSIWE + signed cookie sessionNextAuth + SIWE provider for full session orchestration
ABI typingwagmi cli codegenHand-curated as const ABI literals

If the user explicitly chose another stack, do not argue; help them with what they have.

Decision matrix: where does this code go?

NeedComponent typeWhy
Static layout, metadata, server-fetched REST/GraphQLServer ComponentNo wallet involvement
Public, address-agnostic on-chain read (e.g. token total supply)Server Component using viem createPublicClientCacheable, no wallet, runs on the edge or Node
Anything that reads useAccount, useChainId, signer, or balances of the connected walletClient ComponentBrowser-only state
Transaction submit / signClient ComponentRequires injected provider
Hybrid (server-prefetched, client-interactive)Server Component prefetches via viem; passes data to a Client Component childSee reference/ssr-caching.md for hydration boundary pattern

When NOT to apply this skill

  • Smart contract authoring -> use ultimate-web3.
  • Solidity patterns and secure fixes -> use solidity-security.
  • A codebase audit, pen test, or findings report -> use security-audit.
  • Smart contract testing (Hardhat/Foundry) -> use web3-testing.
  • Pure design tokens, typography, color systems -> use frontend-design.
  • Generic Next.js questions with no wallet/chain involvement -> use base Next.js knowledge; do not load this skill's reference files.

Companion skills

  • frontend-design -- visual design tokens, motion, typography
  • ultimate-web3 -- protocol architecture
  • web3-testing -- contract test suites
  • solidity-security -- contract-side hardening
  • security-audit -- coverage-led codebase audit and findings report

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.