Discovering Useful Libraries with AI Coding Prompts

Asking models to solve coding problems surfaces unfamiliar libraries and tools, often revealing ready-made solutions you can reuse in projects.

One of my favorite things to do with models—going all the way back to GPT-3—is to ask them to do something in code and then see how they solve it. That’s honestly one of the best ways I’ve found to discover new APIs and libraries: everything from unofficial YouTube wrappers, to character generators, to other surprisingly useful tools that already exist out on the internet.

I think I’ve discovered some of my favorite libraries this way. For example, Compromise is a really robust library for doing in-browser NLP tasks—things like named entity extraction, finding the nearest named entity, and a bunch of other features. I found it because I asked GPT-3 one day how I’d do a specific thing, and it suggested using Compromise. After that, I started noticing the same pattern over and over: I’d ask how to solve a problem, and the model would surface a library or tool I didn’t even know existed.

And to me, when I sit down to do a large code project or build an app, often I can just say, “This is what I want to do—tell me how you’d do it,” and I’ll get some very cool suggestions I hadn’t thought of.

Even today, I was using the Codex app while working on an iOS app, and I kept going back and forth copying and pasting screenshots into the interface. Then I finally asked, “Hey, is there a better way?” And it was like, “Yeah—I can take control of the simulator, grab the screenshots myself, navigate through the app, and do that.” A billion-watt light bulb went off. I realized I could just give it a guideline of what I want and walk away, because it’s able to use a command-line tool for controlling the simulator—a tool I’d largely ignored, but to the model it’s basically second nature.

So I encourage people to throw crazy problems at these systems. Sometimes you’ll find out there’s a perfectly good solution ready to use, and all you had to do was ask. I’ve found that over and over again, time and time again. Sometimes I’m halfway through building something and I stop and go, “Wait—does this already exist?” And sure enough, a lot of the time, some developer has already built it, put it out there, and the model finds it.