Detects Solidity development framework (Foundry, Hardhat, or Hybrid) and adapts workflows accordingly. Use at the start of any Solidity development task to determine which tools and commands to use.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill enables automatic detection of the Solidity development framework being used in a project and adapts workflows accordingly.
Use this skill at the beginning of any Solidity development workflow to:
Check for foundry.toml in the project root:
# Foundry indicator
if [ -f "foundry.toml" ]; then
echo "Foundry detected"
fi
Foundry-specific files:
foundry.toml - Main configuration filelib/ directory - Dependencies (via git submodules)test/ directory with .t.sol filesscript/ directory for deployment scriptsCommands:
forge buildforge testforge scriptforge coverageCheck for hardhat.config.js or hardhat.config.ts in the project root:
# Hardhat indicator
if [ -f "hardhat.config.js" ] || [ -f "hardhat.config.ts" ]; then
echo "Hardhat detected"
fi
Hardhat-specific files:
hardhat.config.js or hardhat.config.ts - Main configurationpackage.json with hardhat dependenciesnode_modules/ directorytest/ directory with .js or .ts filesscripts/ directory for deploymentCommands:
npx hardhat compilenpx hardhat testnpx hardhat run scripts/deploy.jsnpx hardhat coverageBoth frameworks can coexist in the same project:
# Hybrid indicator
if [ -f "foundry.toml" ] && ([ -f "hardhat.config.js" ] || [ -f "hardhat.config.ts" ]); then
echo "Hybrid setup detected"
fi
Hybrid workflow strategy:
# Foundry
forge build
# Hardhat
npx hardhat compile
# Hybrid (prefer Foundry)
forge build
# Foundry
forge test
forge test -vvv # Verbose
forge test --match-test testName
# Hardhat
npx hardhat test
npx hardhat test --grep "pattern"
# Hybrid
forge test # Fast unit tests
npx hardhat test # Integration tests with JS tooling
# Foundry
forge script script/Deploy.s.sol:DeployScript --rpc-url $RPC_URL --broadcast
# Hardhat
npx hardhat run scripts/deploy.js --network mainnet
# Hybrid (prefer Hardhat for deployment)
npx hardhat run scripts/deploy.js --network mainnet
# Foundry
forge test --gas-report
# Hardhat
REPORT_GAS=true npx hardhat test
# Hybrid
forge test --gas-report # More detailed
# Foundry
forge coverage
forge coverage --report lcov
# Hardhat
npx hardhat coverage
# Hybrid (prefer Foundry)
forge coverage --report lcov
All agents should call this skill first before executing any framework-specific commands:
**Framework Detection Process:**
1. Check for foundry.toml → Foundry detected
2. Check for hardhat.config.js/ts → Hardhat detected
3. Both present → Hybrid detected
4. Neither present → Prompt user or initialize
**Step 1: Detect Framework**
I'll first check which framework is configured in this project.
[Uses Bash tool to check for foundry.toml and hardhat.config.*]
**Framework detected:** Foundry
**Step 2: Adapt Commands**
Based on Foundry detection, I'll use:
- Compilation: `forge build`
- Testing: `forge test`
- Coverage: `forge coverage`
[Proceeds with Foundry-specific workflow...]
When both frameworks are detected, follow these guidelines:
Use Foundry for:
Use Hardhat for:
If neither framework is detected:
⚠️ **No Solidity framework detected**
I couldn't find foundry.toml or hardhat.config.js/ts in this project.
Would you like to:
1. Initialize Foundry (`forge init`)
2. Initialize Hardhat (`npx hardhat init`)
3. Skip framework setup (manual configuration)
If commands fail due to wrong framework assumptions:
⚠️ **Framework mismatch detected**
The command failed. Let me re-check the framework configuration and adapt.
[Re-runs framework detection]
Switching to [detected framework] workflow...
This skill is foundational and should be referenced by:
foundry-setup skillhardhat-setup skill| Task | Foundry | Hardhat | Hybrid Strategy |
|---|---|---|---|
| Compile | forge build | npx hardhat compile | Use Foundry |
| Test | forge test | npx hardhat test | Use Foundry |
| Coverage | forge coverage | npx hardhat coverage | Use Foundry |
| Deploy | forge script | npx hardhat run | Use Hardhat |
| Verify | forge verify-contract | npx hardhat verify | Use Hardhat |
| Gas Report | forge test --gas-report | REPORT_GAS=true npx hardhat test | Use Foundry |
Remember: Framework detection is the first step in any Solidity workflow. Always detect before executing commands.