Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One thing I really like using them for is refactoring/reorganizing. The tedious nature of renaming, renaming all implementations, moving files around, creating/deleting folders, updating imports exports, all melts away when you task an agent with it. Of course this assumes they are good enough to do them with quality, which is like 75% of the time for me so far.


I've found that it can be hard or expensive for the agent to do "big but simple" refactors in some cases. For example, I recently tasked one with updating all our old APIs to accept a more strongly typed user ID instead of a generic UUID type. No business logic changes, just change the type of the parameter, and in some cases be wary of misleading argument names by lazy devs copy pasting code. This ended up burning through the entire context window of GPT-5-codex and cost the most $ of anything I've ever tasked an agent with.


The way I do this is I task the agent with writing a script which in turn does the updates. I can inspect that script, and I can run it on a subset of files/folders, and I can git revert changes if something went wrong and ask the agent to fix the script or fine-tune it myself. And I don't burn through tokens :)

Also, another important factor (as in everything) is to do things in many small steps, instead of giving one big complicated prompt.


does it use the smart refractoring hooks of the IDEs or does it do blunt text replacement


Blunt text replacement so far. There are third-party VSCode MCP and LSM MCP servers out there that DO expose those higher-level operations. I haven't tried them out myself -- but it's on my list because I expect they'd cut down on token use and improve latency substantially. I expect Anthropic to eventually build that into their IDE integration.


Currently it's very slow because it does text replace. It would be way faster if it could use the IDE functions via an MCP.


The later


Especially when you work with a language where an unfinished refactoring with give you the type error.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: