Watch on YouTubePlayPlays from YouTube. Google's privacy policy (opens in a new tab) applies.
Adam explains why sketching UI in code with your real components beats drawing it in Figma, then shares the prompt he used to have Claude build a personal playground for quick explorations, kept out of git and the team's checks. He tours its rounds and options and shows how to rebuild the winning option cleanly in the real code.
What you'll learn
- Claude creates and iterates on UI in HTML and CSS much more cheaply than drawing it on a Figma canvas.
- A design made in Figma still has to be rebuilt in code; a sketch in code already uses the real components and variables.
- Every codebase is different, so describe the approach to Claude and let it work out the setup, rather than copying one fixed recipe.
- Keep explorations out of git and out of the project's checks: they're throwaway, and code changes can break them later.
- A personal skill can hold the whole workflow, so each new exploration only needs what to explore and how many options.
- Explore in rounds with a few options each, comparing desktop and mobile side by side.
- Rebuild the chosen option from scratch in the real code, ideally in a new session, so no dead or messy code is left behind.
- For the last 10%, copy the view into Figma or Paper, refine it, and hand it back to Claude.
Chapters
- 00:00Why sketch in code
- 02:41A prompt for your playground
- 05:20Why it stays out of git
- 07:44Rounds and options in the playground
- 10:41Rebuilding the winner for real
- 12:44Final polish in Figma
- 00:00So, in the previous video, we talked about how we can use Claude code against that uh double diamond diagram from design thinking to expedite not just the execution part,
- 00:12but also the very early like the very first phases of the design process such as um exploration, research, uh problem definition, um and you know things along these lines.
- 00:25What we haven't talked about yet, however, is how we can use Claude code to also expedite iteration and creating new UIs from scratch.
- 00:36A lot of the designers uh will nowadays use Claude code to generate new designs right within Figma.
- 00:43Sometimes we wouldn't even use Claude code at all because Figma comes with their own AI agents built in right into the application.
- 00:50And while the results will were initially quite poor, uh we need to say it out loud, um there has been a meaningful improvement over the course of the last
- 01:00couple of months, but it is still um we still need to keep in mind one thing.
- 01:06It's a lot it's a lot um it's a lot cheaper for Claude to create UI and iterate on the UI in plain HTML and CSS rather than whatever Figma
- 01:19is doing, rendering these UIs with you know um um within a complicated canvas with complicated SVG.
- 01:27Um it's basically going to take a lot more time and it's going to burn through a a lot more tokens.
- 01:33And this will in turn yield um just basically worse results.
- 01:38It's not to say that you cannot get these results uh at all uh at a good level.
- 01:44And if your Figma file is really up to date with your product's design system and you have a clear mirror of all of your design variables, um all of
- 01:55your UI components that might actually be a good place for you, but even when end up creating a couple of um you know uh screens or um you know
- 02:06um or UI elements like small UI elements within Figma, you would still need someone or perhaps it's you to later recreate these elements from scratch in code.
- 02:16And that just takes time.
- 02:18Um now that you have access to a real real living thing, meaning you have access to a production codebase and you have access to a cloud to a tool
- 02:27such as Claude Code, what I would like to talk to you about in this video is creating these throwaway UI playgrounds um and using Claude to ideate and create
- 02:37new UIs directly in there and all the things that you need to watch out uh when you you know try to work this way.
- 02:45So um I'm going to go back to Claude Code desktop application and I'm going to talk to you about a thing that I did off the camera.
- 02:53Um I run this prompt to set up a new basically a new home or a new playground for my UI explorations in this particular codebase.
- 03:04And um while I would love to share this one prompt with you, the truth is that you know because different codebases comes in different shapes and sizes and there
- 03:14might have their all old uh their their own you know weird quirkiness or their own uh different dependencies, this process might you know actually look a little bit differently
- 03:26uh with each different with each codebase you are working on.
- 03:30So it's maybe best to um as a takeaway to just focus on the general approach and let Claude do the rest for you.
- 03:38The prompt that I ended up uh running against that uh mature version of the uh booking application which we have cloned in one of the previous modules is this.
- 03:49So what I said is um in this session Claude, I would like for you to create a skill and an environment for me to do these quick UI explorations
- 03:58grounded in our codebase, our UI components, and our styling variables.
- 04:04So, I'm starting off by stating like the high level goal and then I go on to explain why.
- 04:11Or basically or how specifically actually.
- 04:13Each time I invoke this skill, I'm saying I would I would tell you what I need what I need you to explore and how many options I want to
- 04:22see. Then I would usually pick one option and ask you to create a new iteration for it based on my feedback.
- 04:30And I would usually have you do two or three iterations, each with possibly couple of options.
- 04:38I would love to keep all my explorations in one place so that I can revisit them after a while.
- 04:44Though it is important that this entire setup and the skill is local to me and doesn't pollute the codebase for anyone else.
- 04:54Also, I am open to the idea that with the time the app's codebase might change to a point in which these explorations UI won't be possible to render because
- 05:04of missing dependencies, versions mismatch, or missing UI components, or their changed APIs.
- 05:11I wouldn't want it to hold us back when we work on real features and real code.
- 05:15So, it's probably best for these explorations to be excluded from any checks that we run locally.
- 05:20[snorts] Can you help me set it up?
- 05:23So, if this prompt is oddly specific, it's because it's based on my like prior experiences when when creating these UI explorations.
- 05:33First of all, for you really don't want these UI explorations to be living in your, you know, real existing or to be committed to the remote repository because they
- 05:46have this ephemeral nature.
- 05:48You do them once and you, you know, observe, you look at them, you create the real thing, and then, you know, these UI explorations are basically something that you
- 05:57don't really need anymore to keep to keep like like being with you.
- 06:02And then second thing is that code is that living thing.
- 06:06And you know over time um developers might change the way our database is shaped or they might change the way our UI components are used or we define our
- 06:17variables. And all of these UI explorations that we create are based, you know when we create them in a real code base they are based around the assumption that
- 06:27nothing really changes in the app.
- 06:30And so what it means is that the moment we pull the newest changes from the main when something changes these UI explorations would be breaking and we wouldn't be
- 06:38really it wouldn't be possible for us to create these new previews locally even when we work want to work on something totally else.
- 06:47So I'm saying explicitly to Claude that I would like for these UI explorations to be sort of excluded from all of this process and I am okay with the
- 06:56fact that they have this ephemeral nature.
- 07:00And I also mentioned that I would like for Claude to help me set up a skill that's going to be get exclude.
- 07:06Now the fact that the skill is get exclude is is you know I guess your own decision.
- 07:13If there are other designers on your team or if you like to share this workflow with other engineers feel free to make the skill available to them.
- 07:23For the purpose of this particular video I just went with the option of having the skill being local to me for the time being.
- 07:32I run this prompt in a plan mode.
- 07:34Claude asked me a couple of questions, wrote a plan and then did the first implementation and it went it it actually came out quite nicely.
- 07:44So let's take a look at what we ended up having.
- 07:47So first of all the way I would use this skill moving forward as Claude is actually explaining this to me over here is I would go on and I
- 07:57would just type in explore UI.
- 08:01And then I would just basically describe what is the thing that I want Claude to explore in the UI If I have any preferences or if I have any
- 08:10vision for these explorations to look in a specific way, how many options I'm going to need.
- 08:15And then everything else that Claude needs to know is already baked into that skill that it has just created for itself.
- 08:22And then once the work is done, it's going to give me a URL.
- 08:28In this case, this new server that it has been up and what it created is this brand new mini application that lives alongside this folder, alongside the main folder
- 08:40for this repo on my computer.
- 08:43And over here, this is where I'm going to be seeing all of my explorations laid out laid out to me like Figma files.
- 08:51So this is something that my Claude decided to do.
- 08:53Keep in mind that, you know, the way this is going to look like is going to be different based on your own application.
- 09:00But if you want it to look just like this version, feel free to specify it in your prompt.
- 09:05So I have this exploration.
- 09:07I can actually click into it.
- 09:09This is an imaginary exploration that Claude decided to use as a battleground for testing the skill.
- 09:15It decided to see if there are anything there is anything else we can do about the empty states for the my bookings view.
- 09:23It's breaking this down into rounds.
- 09:25And therefore each rounds we have like for this round one, we have two options, option A and option B.
- 09:32And I have these mini applications here that I can actually click into or I can open them up in a full screen if I want to really take a
- 09:40closer look. And over here, for each exploration, I have two viewports, a desktop viewport and a mobile viewport so that I can observe.
- 09:50And then over here, Claude is saying, you know, what's going to happen once the code moves moves along and, you know, something changes to our setup and it is
- 10:01no longer possible to display these explorations.
- 10:04This is actually going to be handled quite nicely and gracefully.
- 10:07I believe there was a screenshot showing this at some point.
- 10:12I believe not sure if I'll be able to see it now.
- 10:21No, not really. But essentially it's going to be handled gracefully gracefully or at least this is what Claude is claiming is going to happen.
- 10:30If it doesn't happen gracefully, I'm just going to go back to Claude and I'm going to ask it to re-evaluate the skill and the entire approach to keeping these
- 10:39UI explorations here in this particular application.
- 10:42But the thing about this is I can, you know, have these UI explorations spin up quite quite easily, really fast, and it really gives me a better way to
- 10:55to judge or evaluate my own ideas if I can click through them really quickly.
- 11:02And then depending on whether I like it or not, I will just ask it to do another round and another round until it, you know, feels right.
- 11:09And when it does, what I'm going to say to Claude is, okay, I'm really actually happy with that last iteration or with the option B of round three.
- 11:19And now what I would like you to do is basically recreate it from scratch again in the real codebase, not in this playground.
- 11:29Or better yet, I will actually spawn a new sub agent or create a brand new Claude session.
- 11:35I 'm going to point it to this exploration exploration.
- 11:38I'm going to explain that this is just a temporary thing we did and now I'm looking to actually build it for real.
- 11:45Here are the requirements.
- 11:47Here are the things that you need to know.
- 11:49Ask me questions, Claude, and let's create a new implementation plan for this so that it's clean.
- 11:55And this way it really unlike it really unlocks you.
- 12:00It gives you this ability to or this option this chance to be really messy about your explorations.
- 12:08One thing about doing explorations in code is that when you iterate on the real existing thing, you're most likely going to end up leaving tons of dead code and
- 12:19really spaghetti code behind if you are not careful enough.
- 12:23And by having these explorations actually kept in a separate dedicated space and then recreating them from scratch when you are happy, it really forces your Claude agents to create
- 12:37new and like nice and clean code every time you do this.
- 12:42So yeah, that is just a really nice thing about working with this.
- 12:46Now one thing that I would sometimes do when towards the end, when you know, let's say that third round iteration B looks almost right, but I'm really looking to
- 12:57iron out that last 10 %, what I'm going to do is I'm just going to use that extension from Figma which we we talked about a couple of videos
- 13:06ago or sometimes I would use paper as well.
- 13:10I'm just going to clone this view, copy I'm sorry, copy this view, paste it into Figma, you know, refine the details, come back to Claude and I'm going to
- 13:20say, okay, this is what I'm looking to implement for real now.
- 13:24So yeah, a really nice and neat way to expedite your process with these throwaway UI playgrounds.
- 13:35We haven't really talked about ideating or documenting your components or UI variables.
- 13:44And this is something we are going to talk about in the next video as we are going to unpack Storybook, which is something you might have heard of about,
- 13:52but you might have a vague understanding of you know, what it really is and how you can use it.
- 13:57So I hope I'm going to see you in the next video.
- 14:00Thank you.