hardhat
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "hardhat" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-d62603e0ed5cc580dc5732ed9a2a3e48a0e61cedcd481739e2b12ecd5fa777d7. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Hardhat: development and testing for Ethereum smart contracts. Suitable for setting up a Solidity development environment, writing and running contract tests, deploying to testnets, and debugging Ethereum transactions.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: hardhat
description: >-
Develop and test Ethereum smart contracts with Hardhat. Use when a user asks
to set up a Solidity development environment, test smart contracts, deploy
to testnets, or debug Ethereum transactions.
license: Apache-2.0
compatibility: 'Node.js 18+'
metadata:
author: terminal-skills
version: 1.0.0
category: development
tags:
- hardhat
- ethereum
- solidity
- testing
- deploymentHardhat
Overview
Hardhat is the most popular Ethereum development environment. It provides local blockchain (Hardhat Network), Solidity compilation, testing framework, deployment scripts, and debugging tools. Extensible with plugins for verification, gas reporting, and coverage.
Instructions
Step 1: Setup
mkdir my-contract && cd my-contract
npm init -y
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
npx hardhat init # choose TypeScript project
Step 2: Write Tests
// test/Token.test.ts — Smart contract tests
import { expect } from 'chai'
import { ethers } from 'hardhat'
import { loadFixture } from '@nomicfoundation/hardhat-toolbox/network-helpers'
describe('MyToken', function () {
async function deployFixture() {
const [owner, user1, user2] = await ethers.getSigners()
const Token = await ethers.getContractFactory('MyToken')
const token = await Token.deploy()
return { token, owner, user1, user2 }
}
it('Should assign total supply to owner', async function () {
const { token, owner } = await loadFixture(deployFixture)
const total = await token.totalSupply()
expect(await token.balanceOf(owner.address)).to.equal(total)
})
it('Should transfer tokens', async function () {
const { token, owner, user1 } = await loadFixture(deployFixture)
const amount = ethers.parseEther('100')
await token.transfer(user1.address, amount)
expect(await token.balanceOf(user1.address)).to.equal(amount)
})
it('Should fail if sender has insufficient balance', async function () {
const { token, user1, user2 } = await loadFixture(deployFixture)
await expect(token.connect(user1).transfer(user2.address, 1))
.to.be.revertedWithCustomError(token, 'ERC20InsufficientBalance')
})
})
Step 3: Configure Networks
// hardhat.config.ts — Network configuration
import { HardhatUserConfig } from 'hardhat/config'
import '@nomicfoundation/hardhat-toolbox'
const config: HardhatUserConfig = {
solidity: '0.8.24',
networks: {
sepolia: {
url: process.env.SEPOLIA_RPC_URL,
accounts: [process.env.PRIVATE_KEY!],
},
mainnet: {
url: process.env.MAINNET_RPC_URL,
accounts: [process.env.PRIVATE_KEY!],
},
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
}
export default config
Step 4: Deploy and Verify
npx hardhat compile
npx hardhat test
npx hardhat test --gas-report # show gas costs
npx hardhat coverage # test coverage
# Deploy to testnet
npx hardhat run scripts/deploy.ts --network sepolia
# Verify on Etherscan
npx hardhat verify --network sepolia CONTRACT_ADDRESS
Guidelines
- Hardhat Network forks mainnet — test with real state without spending real ETH.
- Use
loadFixturefor fast test setup — it snapshots and reverts between tests. - Always verify contracts on Etherscan after deployment — builds trust.
- For faster compilation and testing, consider Foundry (Rust-based alternative).
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 Hardhat 智能合约开发、测试、部署完整闭环流程
- 覆盖搭建环境、测试合约、部署测试网、调试交易等高频刚需场景
Highlights
- 触发词精准覆盖多种变体(搭建环境、测试、部署、调试)
- 边界清晰,不易与其他 Skill 重叠
Highlights
- Phase 划分清晰(Setup/Write Tests/Configure Networks/Deploy and Verify)
- 包含端到端 TypeScript 代码示例和配置示例
- frontmatter 完整,单文件结构良好
Highlights
- 工具来源明确(npm 官方包 @nomicfoundation/hardhat-toolbox)
- 参数正确,覆盖主要异常场景(如余额不足测试)
- 部署/验证等不可逆操作有明确命令指引
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 34, 35, 104, 105, 106 -
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 95
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.