I gave some insights on the SQL thing above. For the refactor broadly, it's useful when I have something that's a bit too squishy for my IDE refactoring tools/multicursor editing/vim macros, but easy enough to do or provide an example for. One thing I mentioned is having consistent variable names.
I would highly recommend taking a piece of code (any code) and then just start experimenting. Here's a few prompt ideas:
- make this a singleton
- use more classes
- use less classes
- create more functions
- use lambdas
- rewrite in a functional pipeline style
- extract higher order types
- use fluent APIs
- use a query builder
- transform to a state machine
- make it async
- add cancellation
- use a work queue
- turn it into a microservice pipeline
- turn it into a text adventure
- create a declarative DSL to simplify the core logic
- list the edge cases
- write unit tests for each edge case
- transform the unit tests into table-driven tests
- create a fuzzing harness
- transform into a REST API
- write a CLI tool
- write a websocket server to stream updates into a graph
- generate a HTML frontend
- add structured logging
- create a CPU architecture to execute this in hardware
- create a config file
- generate test data
- generate a bayesian model to generate test data
- generate a HTML frontend to generate a bayesian model to generate test data and download as a csv
- etc...
If you are not feeling inspired, take a random computer science book, open at a random page, and literally just paste some jargon in there and see what happens. You don't need correct sentences or anything, just random words.
There really is nothing that can go wrong, in the worst case the result is gibberish. The code doesn't even need to build or be correct for it to be useful. These models are trained to be plausible, and even more importantly, self-consistent.
When prompted with code in-context, these things are amazing at figuring out consistent, plausible, elegant, mainstream APIs. Implementing them correctly is something I usually tend to do manually instead of bludgeoning the LLM.