Working with AI
Codegen is designed to be used with AI assistants. This document describes how to use Codegen with common AI tools, including Copilot, Cursor, Devin and more.
System Prompt
Codegen provides a .txt
file that you can drag-and-drop into any chat assistant. This is roughly 60k tokens and will enable chat assistants like, ChatGPT, Claude 3.5 etc. to build effectively with Codegen.
Download System Prompt
Download System Prompt
Generating System Prompts
The Codegen CLI provides commands to generate .md
files that can be fed to any AI assistant for more accurate and contextual help.
When you create a new codemod via codegen create
:
Codegen automatically generates an optimized “system prompt” that includes:
- An introduction to Codegen
- Codegen API documentation
- Examples of relevant transformations
You can find this generated prompt in the .codegen/prompts/<codemod-name>-system-prompt.md
file.
All contents of the .codegen/prompts
directory are by default ignored the
.gitignore
file. after running codegen init
This .md
file can be used with any AI assistant (Claude, GPT-4, etc.) to get more accurate and contextual help.
Example Workflow
Create a codemod with description
Use the create
command with a detailed description of what you want to accomplish:
Review the generated system prompt
Check the AI context that Codegen generated for your transformation: bash cat codegen-sh/codemods/modernize-components/prompt.md
Iterate in Copilot, Cursor or Windsurf
Reference your codemod when asking questions to get contextual help: @codegen-sh/codemods/modernize-components How should I handle componentDidMount?
Get contextual help
The AI will understand you’re working on React modernization and provide relevant suggestions about using useEffect hooks and other modern React patterns.
Copilot, Cursor and Windsurf (IDEs)
When using IDE chat assistants, you can leverage Codegen’s context by mentioning your codemod in composer mode:
This will ensure that the IDE’s native chat model is aware of the APIs and common patterns for Codegen.
Devin, OpenHands and Semi-autonomous Code Agents
Was this page helpful?