Building codemods
Codemods can be built using:- MCP — AI-assisted creation in your IDE (recommended for getting started)
- CLI — Scaffold and build locally with
npx codemod init - Studio — Web-based prototyping with live runner and AST viewer
- MCP (AI-assisted)
- CLI (Manual)
- Studio (Web)
1
Generate a codemod
Make sure you have MCP installed, then ask your AI assistant to create a codemod. Be specific about what you want to transform:You’ll get a complete package structure:For more on package structure, see Package Structure.Need the live runner or AST viewer? If you need tools like the live runner, AST viewer, or shareable links, you can bring your codemod into Codemod Studio and continue development there.
MCP best practices
Tips for writing effective prompts and getting the most out of your AI assistant.
my-codemod
README.md
codemod.yaml
workflow.yaml
scripts
codemod.ts
tests
fixtures
input.tsx
expected.tsx
2
Validate your codemod
Run tests to ensure your codemod works correctly:For test structure, CI integration, and debugging strategies, see Testing.
3
Run your codemod
Run your codemod on a target codebase:For all CLI options and running from the registry, see CLI reference.
4
Publish your codemod
Share your codemod with your team or the community:Your codemod is now in the Codemod Registry and runnable via
npx codemod @codemod-name.For CI/CD automation and more publishing features, see Publishing guide.Getting help
Join the community
Ask questions, get help, and connect with other framework maintainers on Slack.
Book a call
Schedule a demo or get hands-on help from the Codemod team.