fhevm-skill — Production-Ready FHEVM Skill for AI Coding Agents (Bounty Track Submission)

Submission for: Zama Developer Program Mainnet Season 2 — Bounty Track
Author: @Dannytrillion
GitHub: GitHub - DannyTrillion/fhevm-skill: FHEVM skill for Claude Code, Cursor, and Anthropic-compatible agents. Submission to Zama Developer Program — Mainnet Season 2 Bounty Track. 21 passing Hardhat tests, 5/5 agent test results. · GitHub
Demo video (3:02): youtube.com/watch?v=i_OHMYBUj_M

What it is

A Claude Code skill that teaches AI coding agents to write correct FHEVM smart contracts from a single natural-language prompt. Built and verified the hard way — by actually breaking things during development and documenting every failure mode.

The differentiator: verified by real test runs

Most FHEVM resources tell you what to do. This skill goes further: every anti-pattern in §13 is captured from an actual test failure in test/FHECounter.mistakes.ts. The error string in the docs matches what the relayer actually returns. No theory, no generated reference material.

What’s included

  • SKILL.md with 14 sections covering encrypted types, FHE operations, access control, input proofs, decryption patterns, and frontend integration
  • 13 documented anti-patterns, each verified by a real assertion in a deliberate-mistakes test file
  • 21 passing Hardhat tests across FHECounter and SealedAuction contracts
  • 5/5 agent tests passing in clean Claude Code sessions, with 14 bonus catches documented
  • Reference templates for confidential ERC-7984 tokens and frontend integration

How to verify

git clone the repo, npm install, npx hardhat test. All 21 tests pass against a local FHEVM mock node. The deliberate-mistakes test file proves each anti-pattern entry in §13 is grounded in a real failure.

Demo

The 3-minute video shows Claude Code with the skill loaded, building a sealed-bid auction from one prompt. The agent produces 8 passing tests on the first run — no edits, no debugging round-trips.

Notable moments:

  • Imports ZamaEthereumConfig (the deprecated ZamaSepoliaConfig is caught by the skill)
  • Uses FHE.select for the bid comparison (not if (ebool), which won’t compile)
  • Always-write pattern on both highest bid and winner address — gas trace identical whether you won or lost
  • Dual ACL: FHE.allowThis(winner) plus FHE.allow(winner, owner) — the skill catches that possession does not equal permission

Built and tested on Node.js 22, Hardhat with @fhevm/hardhat-plugin, Solidity 0.8.24.

Feedback welcome.