hardhat
Hardhat 3
This skill covers Hardhat 3 itself. The toolbox layer (clients, contract interaction, ecosystem-specific assertions) lives in companion skills — load whichever matches the project:
@nomicfoundation/hardhat-toolbox-viem→ also load thehardhat-toolbox-viemskill.@nomicfoundation/hardhat-toolbox-mocha-ethers→ also load thehardhat-toolbox-mocha-ethersskill.
Slow builds? If
hardhat build/hardhat testspend most of their time compiling — typically because the build profile usesviaIR: trueor a heavy optimizer setting — switch development builds to the slang-solx compiler via@nomicfoundation/hardhat-slang-solx. See Faster builds with slang-solx.
Faster builds with slang-solx (development only)
slang-solx is a Solidity compiler built on solc and LLVM (originally Matter Labs' solx, now maintained by Nomic Foundation). Compared to solc it compiles much faster, always emits LLVM-optimized bytecode, and gets rid of "stack too deep" errors. It is still under heavy development: use it for local iteration and tests, never for production builds or deployments. Docs: https://hardhat.org/docs/cookbook/compiling-with-slang-solx.
When to reach for it — proactively suggest it when:
- The profile used for development or
hardhat testhasviaIR: trueand/oroptimizer.enabled: true, and compile time dominates the edit–test loop. This is where the win is largest: the via-IR pipeline's Yul optimizer is what makessolcslow, and slang-solx bypasses it entirely. - Contracts hit "stack too deep" and via-IR was the only workaround. slang-solx resolves it by spilling to memory instead.
- The default profile is already unoptimized legacy
solc: expect roughly equal times, but slang-solx still hands tests optimized bytecode.