blockchain-testing
Use this skill when asked about testing smart contracts, Foundry tests, Hardhat tests, fuzz testing, invariant testing, property-based testing, formal…
от j4flmao★ 47 звёзд на GitHub
Установить blockchain-testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Blockchain Testing
Purpose
Guide blockchain smart contract testing covering the full testing pyramid: unit tests, integration tests, fuzz tests, invariant tests, formal verification, and audit preparation. Ensures contract correctness before deployment.
Agent Protocol
Trigger
"smart contract test", "foundry test", "forge test", "hardhat test", "truffle test", "fuzz testing", "invariant testing", "property-based testing", "echidna", "certora", "formal verification", "audit preparation", "blockchain testing", "web3 testing", "dapp testing", "contract audit", "gas benchmark", "mainnet fork test", "integration test blockchain", "e2e blockchain test", "foundry cheatcode", "forge snapshot"
Input Context
- Smart contracts to test (with source files)
- Framework preference (Foundry/Hardhat/Truffle)
- Testing phase (unit/fuzz/invariant/formal/audit)
- Existing test suite and coverage
- Target chains (EVM/Solana/Cosmos)
- Security requirements (audit timeline, TVL at risk)
Output Artifact
Testing strategy specification: framework setup, test organization, fuzz/invariant properties, gas benchmarking, and audit preparation checklist.
Response Format
- Test strategy: unit vs integration vs fuzz vs invariant vs formal (testing pyramid)
- Framework setup: Foundry/Hardhat configuration, fork URLs, test accounts
- Unit tests: function-by-function coverage with boundary conditions
- Fuzz tests: input ranges, invariant properties, assertion types
- Integration tests: mainnet fork, multi-contract flows, protocol composition
- Gas & performance: benchmark snapshot, optimization targets
- Security audit: tooling (Slither, Mythril, Halmos), manual review checklist
Completion Criteria
- Unit tests cover all functions with boundary values and error cases
- Fuzz tests defined for all numeric inputs with reasonable ranges
- Invariant tests capture protocol-level properties (solvency, access control, correctness)
- Integration tests validate against mainnet fork with real protocol interactions
- Gas benchmarks established and tracked in CI
- Audit prep checklist completed (static analysis, fuzz, invariant, manual review)
Max Response Length
4000 tokens
Decision Trees
Testing Framework Selection
Blockchain platform:
├── EVM (Ethereum, Polygon, Arbitrum, etc.)
│ ├── Solidity → Foundry (default — fastest, most ergonomic)
│ │ ├── forge test: unit + integration + fuzz
│ │ ├── forge coverage: line/branch coverage
│ │ ├── forge snapshot: gas benchmarking
│ │ └── Foundry fuzz: built-in parameterized + stateful fuzzing
│ ├── JavaScript/TypeScript → Hardhat
│ │ ├── Hardhat network: mainnet forking, mining control
│ │ ├── Hardhat chai matchers: ethers-native assertions
│ │ └── Hardhat console.log: debug in Solidity
│ └── Legacy → Truffle (not recommended)
├── Solana → Anchor test framework
│ ├── TypeScript SDK for integration tests
│ ├── Local validator (solana-test-validator)
│ └── Mainnet fork via bankrun
├── Cosmos → Cosmos SDK test suite
│ ├── Go unit tests for modules
│ ├── Integration tests with simapp
│ └── E2E with test network
└── Cairo → StarkNet Foundry / Protostar
Test Type Selection
What to test:
├── Individual function correctness?
│ ├── Unit test: specific input → expected output
│ ├── Boundary test: edge cases (0, max, negative, empty)
│ └── Revert test: expected failure conditions
├── Parameter-based correctness?
│ ├── Fuzz test: random inputs for numeric parameters
│ ├── Stateless fuzz: each call independent (forge fuzz)
│ └── Stateful fuzz: sequence of calls with state (foundry invariant, echidna)
├── Protocol-level properties?
│ ├── Invariant test: properties that must always hold
│ └── Examples: totalSupply = sum of balances, solvency, access control
├── Real-world interaction?
│ ├── Mainnet fork test: interact with deployed protocols
│ ├── Integration test: multi-contract flows
│ └── E2E test: complete user journey
└── Security?
├── Static analysis (Slither, Aderyn)
├── Symbolic execution (Mythril, Halmos)
├── Formal verification (Certora CVL)
└── Manual review (line-by-line)
Foundry Test Configuration
forge test options:
├── Verbosity: -vv (debug), -vvv (stack traces), -vvvv (all traces)
├── Match test: --match-test testTransfer -vv
├── Match contract: --match-contract TokenTest
├── Fuzz runs: --fuzz-runs 10000 (default 256)
├── Fuzz seed: --fuzz-seed 42 (reproducible)
├── Gas reporting: --gas-report
├── Coverage: forge coverage --report lcov
├── Fork: --fork-url $RPC_URL --fork-block-number 18000000
└── Multi-fork: --chain-id 1,137,42161 (simulate cross-chain)
Foundry Testing Patterns
Basic Unit Test
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "forge-std/Test.sol";
import "../src/Token.sol";
contract TokenTest is Test {
Token public token;
address alice = makeAddr("alice");
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/audit-preparation-checklist.md
- references/blockchain-testing-advanced.md
- references/blockchain-testing-fundamentals.md
- references/chaos-testing.md
- references/differential-fuzz-regression.md
- references/formal-verification.md
- references/foundry-testing.md
- references/fuzz-property-testing.md
- references/hardhat-testing.md
- references/integration-e2e.md
- references/reference_guide_1.md
- references/reference_guide_2.md
- references/reference_guide_3.md
- references/reference_guide_4.md
- references/reference_guide_5.md
- references/reference_guide_6.md
- references/reference_guide_7.md
- references/reference_guide_8.md
FAQ
Что делает скилл blockchain-testing?
Use this skill when asked about testing smart contracts, Foundry tests, Hardhat tests, fuzz testing, invariant testing, property-based testing, formal verification, audit preparation, integration testing for dApps, and blockchain testing patterns. Covers Foundry cheatcodes, Echidna fuzzing, Certora verification, Hardhat network forking, mainnet simulation, gas benchmarking, and security audit workflows. Do NOT use for: general web3 frontend testing (use blockchain-web3), smart contract development (use blockchain-application), or core protocol testing (use blockchain-core).
Как установить скилл blockchain-testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл blockchain-testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…