Migrate with an AI agent
If you use an AI coding agent, our Foundry to Hardhat migration skill allows it to perform a structured migration of your project.
Install the skill
Section titled “Install the skill”Install the skill in your project:
npx skills add nomicfoundation/hardhat-skills --skill migrate-foundry-to-hardhatpnpm dlx skills add nomicfoundation/hardhat-skills --skill migrate-foundry-to-hardhatyarn dlx skills add nomicfoundation/hardhat-skills --skill migrate-foundry-to-hardhatThis launches an interactive CLI that will walk you through installing the migration skill for your agent. For instance, you can choose to install into your current project (rather than globally) and specifically for Claude, which writes the skill files into .claude/skills/ at the repository root.
Run the migration
Section titled “Run the migration”Open your project in your coding agent and ask it to migrate from Foundry to Hardhat 3, for example:
Migrate this project from Foundry to Hardhat 3 using the Hardhat migration skill.
For Claude you can invoke the migration as a command with:
/migrate-foundry-to-hardhatThe agent will use the skill to start a campaign to migrate the repo to Hardhat 3. The agent will migrate the project by systematically working through the following steps in order:
- Analyze the Foundry project including
foundry.toml, remappings, submodules, inline config, and scripts. - Add Hardhat to the project with the detected package manager.
- Create
hardhat.config.ts, mapping everyfoundry.tomlsection across. - Handle absolute imports and remapping differences.
- Compile the contracts.
- Run Solidity tests and get them passing.
- Migration report covering migration gaps and a Foundry cleanup checklist.
Review the result
Section titled “Review the result”The skill automates the migration, but you should still review the changes and verify your core development workflows are correct, for example:
npx hardhat buildnpx hardhat testFurther manual migration may be necessary for additional workflows e.g. CI, deployment, specialist scripts etc.