hardhat

Installation
SKILL.md

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 the hardhat-toolbox-viem skill.
  • @nomicfoundation/hardhat-toolbox-mocha-ethers → also load the hardhat-toolbox-mocha-ethers skill.

Slow builds? If hardhat build / hardhat test spend most of their time compiling — typically because the build profile uses viaIR: true or 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 test has viaIR: true and/or optimizer.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 makes solc slow, 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.
Installs
127
GitHub Stars
2
First Seen
May 19, 2026