/bn-fhevm:create-templatefrom bn-fhevm
Use when scaffolding a new FHEVM workspace -- contracts, Next.js frontend, or Vite frontend. Copies the canonical bundled template (project/ or templates/frontend-{next,vite}/) into a target directory and customizes package metadata, env-var defaults, and the Sepolia RPC URL via an interactive AskUserQuestion wizard.
Ships in bn-fhevm. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Scaffold a fresh FHEVM workspace from one of the bundle's canonical templates.
Core principle: Templates are the source of truth. The wizard copies, then patches — it never invents.
| Variant | Source path | Produces |
|---|---|---|
contracts | project/ | Hardhat workspace with the three flagships |
frontend-next | templates/frontend-next/ | Next.js 16 App Router app wired against ConfidentialVoting |
frontend-vite | templates/frontend-vite/ | Vite + React app wired against ConfidentialVoting |
both | project/ + templates/frontend-{next,vite}/ (chosen) | Parent dir containing contracts/ and frontend/ as sibling workspaces |
Use AskUserQuestion (single-select):
contracts — Hardhat workspace with ConfidentialCounter, ConfidentialToken, ConfidentialVoting.frontend-next — Next.js 16 reference app for ConfidentialVoting.frontend-vite — Vite reference app for ConfidentialVoting.both — fullstack: contracts + frontend (Next or Vite, chosen in step 2D) as siblings under one parent.Branch on the answer to one of the four step-2 paths below.
contracts sub-questionsUse a single AskUserQuestion call with up to 4 questions:
"Target dir"): default ./contracts. Reject answers that already exist as a non-empty directory — re-ask with a different default."Pkg name"): default the basename of the target dir (e.g. contracts)."RPC provider"):
Alchemy (default) — keep the URL template from project/hardhat.config.ts verbatim.Infura — rewrite the URL template to https://sepolia.infura.io/v3/${RPC_KEY}.Public RPC — rewrite to https://ethereum-sepolia-rpc.publicnode.com (constant; no key needed; user can still override per-deploy)."Wrap test"): default Yes. If No, drop contracts/mocks/, test/ConfidentialToken.ts's ConfidentialTokenWrapper describe block, and MockERC20/ERC7984ERC20WrapperMock typechain bindings.frontend-next sub-questions./frontend-next).NEXT_PUBLIC_CONFIDENTIAL_VOTING_ADDRESS). If a non-default name is chosen, rewrite every app/page.tsx and lib/*.ts reference.frontend-vite sub-questions./frontend-vite).VITE_CONTRACT_ADDRESS). Same rewrite rule as the Next variant.both sub-questions (contracts + frontend in one parent)Use a single AskUserQuestion call with up to 4 questions:
"Frontend"): Next.js (frontend-next) or Vite (frontend-vite)."Parent dir"): default ./my-app. Reject answers that already exist as a non-empty directory."RPC provider"): Alchemy (default) / Infura / Public RPC — applied to the contracts side only."Wrap test"): default Yes — same semantics as the contracts variant.Derived defaults (no question needed):
<parent-basename>-contracts<parent-basename>-frontendNEXT_PUBLIC_CONFIDENTIAL_VOTING_ADDRESS (Next) or VITE_CONTRACT_ADDRESS (Vite)The wizard creates this layout:
<parent>/
├── contracts/ # from project/
└── frontend/ # from templates/frontend-{next,vite}/ (variant chosen above)
Resolve <repo-root> to the directory containing CLAUDE.md and architecture.md. Resolve <source> to the source path from the table above (<repo-root>/project or <repo-root>/templates/<variant>).
Use cp -r (NOT git clone) and skip the listed paths via rsync or two-step copy:
| Variant | Skip paths |
|---|---|
contracts | node_modules, artifacts, cache, types, deployments, coverage, dist, fhevmTemp |
frontend-next | node_modules, .next, dist |
frontend-vite | node_modules, dist |
both | Run two copies: <parent>/contracts/ from project/ (same skip list as contracts), then <parent>/frontend/ from templates/frontend-{next,vite}/ (same skip list as the chosen frontend variant). |
Concretely:
rsync -a \
--exclude=node_modules \
--exclude=artifacts \
--exclude=cache \
--exclude=types \
--exclude=deployments \
--exclude=coverage \
--exclude=dist \
--exclude=fhevmTemp \
"$SOURCE/" "$TARGET/"
(Adapt the --exclude list per variant. For both, run this twice with different $SOURCE/$TARGET pairs.)
Apply the user's customizations to the copy, never to the source.
Always (every variant):
<target>/package.json:
"name": ... with the user's package name."version": "0.1.0"."homepage" and "repository" fields (or leave them up to the user — print a TODO).<target>/README.md if it references this repo by name; replace with a generic placeholder.Contracts variant only:
sepolia.url line in <target>/hardhat.config.ts from the Alchemy URL template to https://sepolia.infura.io/v3/${RPC_KEY}.https://ethereum-sepolia-rpc.publicnode.com and drop the RPC_KEY interpolation. Add a comment noting that public RPCs are rate-limited.<target>/contracts/mocks/.<target>/test/ConfidentialToken.ts, delete the second describe("ConfidentialTokenWrapper", ...) block.Frontend variants only:
<target>/app/page.tsx, <target>/src/App.tsx (Vite), <target>/lib/wagmi.ts, etc.Summarize what was done. Print the next-step commands the user should run, customized to the variant:
Contracts:
cd <target>
npm install
npx hardhat vars set MNEMONIC
npx hardhat vars set RPC_KEY
npm run compile
npm test
Frontend (Next):
cd <target>
npm install
echo "NEXT_PUBLIC_CONFIDENTIAL_VOTING_ADDRESS=0x..." > .env.local
npm run dev
Frontend (Vite):
cd <target>
npm install
echo "VITE_CONTRACT_ADDRESS=0x..." > .env.local
npm run dev
Both (fullstack):
# 1. Compile + test contracts side
cd <parent>/contracts
npm install
npx hardhat vars set MNEMONIC
npx hardhat vars set RPC_KEY
npm run compile && npm test
# 2. (Optional) deploy to Sepolia and capture the address
# npx hardhat run scripts/deploy.ts --network sepolia
# 3. Wire the address into the frontend env and start dev server
cd ../frontend
npm install
# For Next.js variant:
echo "NEXT_PUBLIC_CONFIDENTIAL_VOTING_ADDRESS=0x..." > .env.local
# For Vite variant:
# echo "VITE_CONTRACT_ADDRESS=0x..." > .env.local
npm run dev
AskUserQuestion with a different default. Never overwrite without explicit user confirmation.<repo-root>/project or <repo-root>/templates/<variant> doesn't exist, abort and explain — likely the user is invoking the skill outside the bundle.rsync not available. Fall back to cp -r plus a follow-up rm -rf <target>/{node_modules,...}.npm install && npm run compile in the target as a smoke test if the user opts in.fhevm-contracts / fhevm-erc7984 / fhevm-decryption skills directly.npx hardhat deploy --network sepolia themselves after hardhat vars set.project/, templates/frontend-{next,vite}/). The wizard is one-way — copy and patch.fhevm-contracts.@zama-fhe/[email protected] → fhevm-decryption + fhevm-frontend directly.project/ or templates/<variant>/ in place; do not invoke this wizard.fhevm-setup/SKILL.md — bootstrap from scratch (no template). Use only if the bundle isn't checked out alongside.fhevm-contracts/SKILL.md — Solidity authoring patterns inside the scaffolded contracts workspace.fhevm-frontend/SKILL.md — extending the scaffolded frontend (provider wiring, encrypt/decrypt hooks).What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
Generated from the plugin's indexed repository (bootnodedev/zama-s2-bounty-skills) — no native marketplace selected
npx claudepluginhub p/bootnodedev-bn-fhevm10 skills in this plugin
/fhevm-antipatternsUsed when reviewing, debugging, auditing, or pre-commit-checking FHEVM Solidity or client code. Catalogues the v0.11-era breaking renames (TFHE→FHE, SepoliaZamaFHEVMConfig→ZamaEthereumConfig, ConfidentialFungibleToken→ERC7984, TFHESafeMath→FHESafeMath, tokenURI→contractURI, isUserAllowed→canTransact), the removed FHE.requestDecryption API, deprecated fhevmjs, and high-frequency footguns (missing FHE.allowThis after state writes, view functions returning encrypted types, .env-based Hardhat secrets). Triggers on FHEVM code review, anti-pattern, audit, migration from pre-v0.9/v0.11, pre-commit check, ACLNotAllowed, EmptyDecryptionProof, or DeclarationError./fhevm-contractsUsed when writing, refactoring, or reviewing FHEVM Solidity contracts against the @fhevm/[email protected] API. Covers encrypted types (ebool, euint8..256, eaddress), FHE operations (arithmetic, comparison, FHE.select), the ACL lifecycle (FHE.allow, allowThis, allowTransient, isSenderAllowed, makePubliclyDecryptable), and the input-proof flow (externalEuint* + FHE.fromExternal). Triggers on FHEVM contract patterns, encrypted types, FHE.* library calls, ACL permissions, input proofs, ciphertext handles, ZamaEthereumConfig, or writing a confidential counter / voting / auction / vault contract./fhevm-decryptionUsed when implementing or debugging FHEVM decryption flows — user decryption (sdk.userDecrypt with the signer/keypair bound at instance creation) and public decryption (v0.9 three-step pattern: FHE.makePubliclyDecryptable on-chain → off-chain sdk.publicDecrypt → on-chain FHE.checkSignatures). Targets `@zama-fhe/[email protected]` (provider-agnostic; relayer-sdk is a transitive dep, not a direct install). Explicitly covers the removal of the deprecated FHE.requestDecryption oracle-callback API. Triggers on prompts mentioning userDecrypt, publicDecrypt, makePubliclyDecryptable, checkSignatures, EIP-712 decryption, reencrypt (legacy term), or the v0.9 migration of decryption./fhevm-erc7984Used when writing, refactoring, or reviewing FHEVM Solidity contracts that implement or extend ERC-7984 confidential tokens. Covers the IERC7984 interface (confidentialBalanceOf, confidentialTransfer, setOperator), FHESafeMath (tryIncrease, tryDecrease, tryAdd, trySub), the v0.4.0 extensions (Freezable, Restricted, Rwa, Omnibus, ObserverAccess, Votes, ERC7984ERC20Wrapper), the v0.4.0 finance/governance/utils/interfaces directories (VestingWalletConfidential, VotesConfidential, HandleAccessManager, IERC7984Rwa), the operator pattern that replaces approve/allowance, the euint64 supply ceiling and default-6-decimals trap, the v0.4 breaking change that switched unwrap request IDs from euint64 to bytes32, and the 2-step async-decrypt swap pattern for confidential AMMs (FHE.div plaintext-divisor constraint). Explicitly NOT for confidential NFTs — ERC-7984 is fungibles-only; ERC-721 + eaddress is the alternate route. Triggers on ERC7984, ERC-7984, IERC7984, confidentialBalanceOf, confidentialTransfer, setOperator, FHESafeMath, ConfidentialFungibleToken (legacy), ERC20Wrapper, ERC7984Restricted, ERC7984Rwa, ERC7984Freezable, ERC7984Omnibus, ERC7984ObserverAccess, ERC7984Votes, ERC7984Hooked, canTransact, IERC7984Rwa, forceConfidentialTransferFrom, confidentialFrozen, VestingWalletConfidential, BatcherConfidential, VotesConfidential, HandleAccessManager, confidential AMM, confidential DEX, euint64 overflow, decimals 6, or writing a confidential token / wrapper / RWA / governance token / AMM contract./fhevm-frontendUsed when building React frontends (Vite or Next.js App Router) that integrate with FHEVM confidential smart contracts. Covers the @zama-fhe/* SDK stack, ZamaProvider wiring, encrypt and decrypt hooks, ERC-7984 wrap and unwrap flows, and Next.js SSR or bundler configuration./fhevm-overviewUsed when an AI coding agent needs a mental model of the Zama Confidential Blockchain Protocol — FHEVM architecture, the four off-chain components (coprocessor, KMS threshold network, gateway, relayer), the on-chain contracts (ACL, FHEVMExecutor, KMSVerifier, InputVerifier), the ZKPoK-bound encrypted-input flow, and the v0.9+ async decryption pattern. Triggers on prompts mentioning FHEVM, confidential smart contracts, FHE on-chain, Zama protocol, coprocessor, KMS, relayer, gateway, input proofs, ciphertext handles, or how confidential transactions flow end-to-end.