Lesson Description
The "Import/Export Feature Prompt" Lesson is part of the full, Practical Prompt Engineering course featured in this preview video. Here's what you'd learn in this lesson:
Sabrina uses the chain-of-thought prompting technique to implement and import/export features for the Prompt Library. After the code is generated, the features are tested. During the test, the wrong export files were selected, and Sabrina added an additional feature to support legacy formats.
Transcript from the "Import/Export Feature Prompt" Lesson
[00:00:00]
>> Sabrina Goldfarb: Let's do one more chain-of-thought prompt with Claude, and we can kind of utilize this one as if we were making an AI application. So, my plant's leaves are turning yellow. What could be wrong? And instead, I'm going to kind of adjust it a little bit to just say diagnose this step-by-step, kind of see if I get the same or different type of thing by saying it this other way. So maybe I have this AI application where a user can be like, hey, there's something wrong with my plant, but I'm really not sure what.
[00:00:36]
My plant's leaves are turning yellow, help me, right? And we can use one of these assistants to give them an answer of what's happening. I'll help you diagnose the yellowing leaves systematically. Let's work through the most common causes. Step one, check watering issues. Overwatering, the most common cause. And then it says, are the leaves yellow and wilting or mushy? Is the soil constantly wet or soggy?
[00:01:02]
Does the pot have drainage holes? Overwatering suffocates roots, preventing nutrient absorption. Underwatering, are the leaves dry, crispy, and yellow? Is the soil completely dried out? Has it been a while since you watered? Step 2, examine the light conditions. Step 3, assess the nutrient deficiency. Step 4, look for other clues, and then quick diagnostic questions that we can look at to kind of keep answering, OK?
[00:01:30]
We can see that this looks slightly different, but we are still getting that same chain-of-thought of, OK, step one, you want to do this. Is this happening because of this? This is why it would happen. Step 2, is this happening? Let's look at this, and then keep going, right? Step 3, and so on and so forth. So now we're going to use this because we know this makes our assistants that much better. We are going to build the most complex part of our prompting library using this let's think step-by-step approach.
[00:02:05]
We are going to build the import/export functionality for our prompts, right? Since we are only saving these to local storage, they're just going to disappear on us if we try and open it somewhere else, right? But I want to save my prompts. I want to make sure I have them for other times. If we build an export system where we can get the prompts in JSON, then we can download the JSON and then we can import the JSON next time.
[00:02:30]
So now we don't have to worry about where the files live, we don't have to worry about making this go live, we don't need to add a database. We don't need to worry about any of that, right? We're just going to export as JSON and be able to import as JSON. So let's use this chain-of-thought prompting technique to build this import/export feature as our very last big feature of this project. We do have other techniques we're going to cover today, but we're going to look at them slightly differently than in the coding approach and focus on how we would use those in architecture approaches instead.
[00:03:02]
So this will be the last main feature of our Prompt Library. So let's go over to Copilot or whatever you're using. And let's open up. I'm opening up a new chat and I am going to say, let's build a complete export import system step-by-step. And then I'm going to copy the rest and we'll go through it. And you're going to see I'm being a little bit redundant, and I'll tell you where in a second, but step one, first analyze what data we need to export all prompts with their metadata.
[00:03:42]
Step 2, design the export JSON schema that includes version number for future compatibility and export timestamp, statistics, and a complete prompts array. Step 3, create the export function that gathers all data from local storage, validates the data integrity, and creates a blob and triggers download with timestamp. Step 4, create the import function that reads the uploaded file, validates the JSON structure and version, checks for duplicate IDs, and merges or replaces existing data based on user choice.
[00:04:19]
Step 5, add error recovery. Back up existing data before import, roll back on failure, and provide detailed error messages. Add the export and import buttons and merge conflict resolution prompts. Implement the system with all steps, think step-by-step. And here's where I was a little bit redundant because I did say we were going to build our system step-by-step, but I really wanted to make sure that we add, and I'm even going to change this a little bit to say let's think step-by-step, just to kind of show the power of this step-by-step thought in our chain-of-thought prompting.
[00:04:56]
I do want to cover one other thing about this. The whole day, it has looked to us, possibly, like Copilot is already doing this chain-of-thought prompting, right? Because we see gathering current code to understand reading HTML to determine this, reading CSS to prepare. This is different still than us adding, let's think step-by-step. And I just want to make that very clear. Just because Copilot and Cursor and some of these other applications do kind of have their own show of this chain-of-thought, that doesn't mean that you shouldn't be utilizing this chain-of-thought prompting technique along with this, right?
[00:05:37]
We still want to prime the model and tell the model, make sure you're thinking step-by-step, use a specific technique and talk me through exactly what you're doing. So let's keep all of our changes, and let's go over to our localhost and take a look at our Prompt Library now. We can see that this time, right? We see that this all came up with something pretty different than what I showed you all at the beginning.
[00:06:00]
We asked for light mode, so I can't say that that's a big difference, but export and import are in a different place. Everything kind of looks different, right? And so you do have the code from both in case you have a preference for one or the other, or maybe whatever your LLM that you chose decided to make whatever you like. But let's add something here, and we will say chain-of-thought prompt. And we are going to say that this was on Claude 4.5 Sonnet, and we will add our can penguins fly prompt.
[00:06:45]
Save the prompt, mark it as a 5 star because we really liked it, and our notes will say this was a chain-of-thought prompt. OK, great. So now we have a prompt, and now we should be able to export it. And we can see here that we do have it exported, right? So now we have this Prompt Library export, and let's see if it'll let us import it. So downloads this one, if we actually look at it really quickly, I can try and make this a bit bigger.
[00:07:21]
If it'll let me, it won't let me, but we can see it has version one, exported at, it has stats, total prompts, average rating, most used model, prompts, the ID, the title, the content, created at rating, the metadata, the notes, and the note IDs within it. So we can see that we have text from the notes as well. And now we can try and import it. And this is a pretty complex task, so we'll see if it works or not.
[00:07:50]
OK, import failed unsupported file type. So we might have to go back and kind of adjust our import feature a little bit, right, because that's what we said, right? We were going to try and build something that's incredibly complex, utilizing this new technique to see if we could just build something in one step that's very complex. So if I go back over to my code editor, I can now say, import functionality failed, and let's go back and actually see what that failure was, so we can tell it.
[00:08:32]
Wonder if this is the. I think this is the one. Import failed, unsupported file type. OK. And now we'll say with the failure. On import failed, unsupported file type, fix this, let's think step-by-step. And now we'll let it try and fix this. OK, updating import parser to support legacy export formats, array or object without type, and fix unsupported file types. Implemented a more flexible import parser to fix the unsupported file type failure.
[00:09:04]
Now it accepts current schema and a legacy object or array. Now, in theory, it would have been great if I could have copied over the JSON and showed it what JSON I was trying to upload, right? So now we'd be adding all the structured output information, we'd be adding a shot to it of exactly what broke and why it broke, but since I wasn't able to get it to open for me, then at least we can try and say, OK, let's think step-by-step, and let's try and make this just generally more flexible and see if it is.
[00:09:52]
OK, let's try and import it. Today 9. OK, great. Sample prompt. This was the prompt I asked for GPT 5, tokens 5 to 8 high. This was a prompt I had earlier this morning, 9:49 a.m. That I had exported, and now I'm able to add it back into my Prompt Library. Now, if I wanted to, I could continue to add from it, add notes to it, and all of that, right? So now we have this export and this import feature.
Learn Straight from the Experts Who Shape the Modern Web
- 250+In-depth Courses
- Industry Leading Experts
- 24Learning Paths
- Live Interactive Workshops