test-hardhat

Generates comprehensive Hardhat test suites for Solidity contracts with structured coverage methodology.

Updated Apr 3, 2026
One-click install
npx skills add https://github.com/Ayoub-ouederni/SENTINEL --skill test-hardhat-ayoub-ouederni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-hardhat
Source: https://github.com/Ayoub-ouederni/SENTINEL/tree/main/.claude/skills/test-hardhat
Command: npx skills add https://github.com/Ayoub-ouederni/SENTINEL --skill test-hardhat-ayoub-ouederni

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing thorough smart contract tests is time-consuming and error-prone, and missing revert paths or edge cases can leave vulnerabilities untested. This Skill produces a complete, well-organized Hardhat test suite that systematically covers modifiers, require statements, happy paths, edge cases, and end-to-end flows. ## Core Features & Use Cases - Targeted Test Generation: Test an entire contract, a single function by name, or a function identified by file and line number. - Structured Coverage Methodology: Enforces a mandatory test ordering (access control reverts, input validation reverts, happy path, edge cases) matching the contract source order. - Hardhat v3 Best Practices: Uses loadFixture, exact event and custom error assertions, balance change matchers, time manipulation, and snapshot helpers. - Use Case: Point the Skill at Vault.sol and receive a production-grade TypeScript test file with deployment tests, per-function describe blocks, integration scenarios, and a printed coverage summary. ## Quick Start Generate a comprehensive Hardhat test suite for the Vault.sol contract covering all reverts, state changes, and edge cases.

Frequently Asked Questions about test-hardhat

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate Hardhat tests for a Solidity contract?

Provide the contract filename, a function name, or a file with line number as the argument. The Skill reads the contract and its dependencies, builds a test plan covering reverts, happy paths, and edge cases, then writes a complete TypeScript test suite.

How to test a single function instead of a whole contract?

Pass the function name (e.g., deposit) or a file with line number (e.g., Vault.sol#42) as the argument. The Skill still reads the full contract for context but only produces tests for the targeted function.

Does Hardhat v3 support both Solidity and TypeScript tests?

Yes, Hardhat v3 supports both. This Skill defaults to TypeScript tests for multi-step flows and chain-level inspection, while Solidity tests suit internal function testing and fuzz or invariant scenarios.

Should I use loadFixture or beforeEach for test deployment?

Use loadFixture. It snapshots EVM state and reverts between tests for speed and isolation, whereas deploying in beforeEach is slower. The Skill never uses hardhat_reset between tests.

What edge cases do smart contract tests need to cover?

Cover zero values, empty arrays and bytes, address(0), max uint256 boundary values, threshold minus/plus one, and reentrancy attempts. Every require statement and modifier should also be triggered individually with exact error matching.