Created
March 4, 2025 16:21
-
-
Save jayhack/d742b701a38a5b5274517afce2d253c2 to your computer and use it in GitHub Desktop.
Delete Dead Code Devin Prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Hey @Devin! | |
| I have a bunch of dead code. I want to delete all of it. | |
| (Dead code is something that is not used elsewhere in the codebase, but there are many exceptions, for example tests, API endpoints, etc.) | |
| In order to do this, I want you to use the `codegen` CLI. Here are the steps: | |
| • Call `codegen init` to set it up. | |
| ◦ if `codegen` is not installed, you can install it with `uv tool install codegen --python 3.13` | |
| ◦ `codegen init` will create a .codegen/.venv, which contains a python 3.13 installation w/ dependencies it will use to run | |
| • Call codegen create -d "... delete dead code ..." | |
| ◦ This will generate a first draft of the codemod | |
| ◦ The codemod will be saved to .codegen/codemods/{name} | |
| ◦ It will also include a text file in that directory that contains docs and relevant examples that are helpful. | |
| • Then you can run this codemod with codegen run {name} | |
| ◦ This will handle codebase parsing + caching | |
| ◦ Note: don't try to run the codemod file directly. It can get very confusing with codebase paths, virtualenvs, etc. | |
| • You can see the diff on the filesystem with git diff | |
| ◦ Make sure that things got moved around correctly, tests still pass, lint passes, etc. | |
| • If there are changes you need to make after the first run: | |
| ◦ Edit the file `.codegen/codemods/{name}/{name}.py` | |
| ◦ Call `codegen reset` - this will blow away all your changes outside of the `.codegen` directory | |
| ◦ Got back to the `codegen run {name}` step - rinse, wash and repeat! | |
| Once you have something working, the final PR should include: | |
| • all changes from the codemod | |
| • The codemod itself. | |
| Godspeed, Devin! 🚀 excited to see what you come up with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment