I was listening to an episode of the Overengineered podcast recently when I heard the host mention the “lightbulb analogy” and attribute it to CGP Gray. As someone who was pretty familiar with CGP Gray but not immediately familiar with what the host was talking about, I got curious. I found the reference in a 10 year old YouTube video for a podcast, but it was audio only, unlike most of CGP Gray’s content. And while I realized that he hadn’t created a visual for this theory, I also realized that with Claude Artifacts, I could create my own.
Not only that, any instructor, content creator or even just an average user can now create interactive visualizations of any concept that they can explain to a LLM. This is a massive unlock for learning of all types and in this article, we’ll take a look at how I (or rather Claude) created an interactive demo for CGP Gray’s lightbulb analogy for work/life balance in just a few minutes.
Setting up Claude to generate working code
Anthropic recently announced a new feature they call “Artifacts”, which, similar to OpenAI’s Code Interpreter, allows their Claude LLM to actually write and execute code based on a user’s instruction. In our case, it’s going to create our interactive visualization and give us an environment to run it in. However, before you can take advantage of this functionality, you need to enable Artifacts inside Claude. You can do this by clicking on your name in the bottom left hand corner, clicking on Feature Preview, and making sure Artifacts is enabled.
Make sure you do this before you start the chat where you want your Artifacts to be created, otherwise you’ll get an error message that tells you Claude isn’t able to execute code.
Giving Claude the necessary context
Even though the particular podcast episode where this analogy was described had been out for 10 years (and should have been present in Claude’s existing knowledge base), when I asked Claude to describe it to me, it didn’t know what I was talking about.
Luckily, because the Claude models have a fairly large context window, I was able to download the transcript from the YouTube video and paste the entire thing in as context. I then asked the same question in the following way:
Use the following transcript from a video to inform your answer to the following question: what is the lightbulb analogy by CGP Grey?
<pasted in transcript>
With all this additional context, Claude was more than happy to provide me with an answer.
Now that it had all the necessary background information for what we were asking, it was time to start generating the visualization.
Generating the visualization
Now that you have Artifacts enabled, you can ask Claude to generate some output for you. Here’s the original prompt I used:
Can you create an interactive HTML visualization of this concept? Please include the 4 lightbulbs, but make how much they are highlighted adjustable by the user, ensuring that the sum of the 4 lights is never more than 100%. Display the current illumination percentage beneath each lightbulb, but allow them to be manipulated independently. On the right of the 4 lightbulbs, generate an avatar that shows what a person with the current configuration of lightbulbs in their life might look like.
That prompt has a fair bit of detail, but it’s far from perfect.
As an aside, if you’re looking to generate the sort of product description that would be very useful in this sort of exercise, you should check out Claire Vo’s ChatPRD, which does exactly that.
You can see that the first version needed a lot of scrolling to actually see the visualization that we asked for.
Iterating on the output
This is obviously not ideal in terms of a usable visualization. And while I could have spent some more time on the prompt before I submitted it the first time, the great thing about using Artifacts is that it is iterative. I can just provide plain text feedback and I can get an updated version of my mini web app based on what I asked for. In particular, Claude seemed to struggle with trying to get all of the lightbulbs in a single row that could be viewed without scrolling. However, on version 11, I got something that I was pretty happy with.
What’s most impressive to me as a developer is that I had to write exactly 0 lines of code to create this, could give feedback in plain English and, despite the difficulties, could work through it and get a working visualization for an abstract concept that started out as a few sentences of audio on a podcast.
Sharing your Artifact with the world
Being able to create things like this is great, but where it becomes even more useful is the ability to share. As of the time of this article, users on either the Free or Pro plans can publish their Artifacts, which will give you a link you can use to share the finished version of your Artifact with anyone. Artifacts are also remix-able, which means anyone you share your Artifact with can bring it back into Claude and ask for updates and modifications to create their own version.
What will you make interactive?
It’s my opinion that Claude and other LLMs that adopt a similar model will be a huge unlock for any sort of educational content. Essentially any metaphor, analogy or illustrative device can now be turned into something more concrete, either by the instructor or by a student trying to understand it.
Rather than relying on a single static diagram in a textbook, learners now have access to an infinite customizable toolkit that can answer any question and provide insights on any topic from any perspective.
And I, for one, am excited to see how that completely transforms education going forward.