At some point you’ve generated something with AI that was genuinely great: a perfectly styled image, a prompt that finally got the model to behave how you wanted, a clever bit of code that did exactly what you needed. And then you lost it.
Maybe you closed the tab, or ran the prompt again with slightly different wording and got a completely different result, or you can’t even remember which tool you used. Either way it’s gone and you can’t get it back.
This happens constantly, because AI output is ephemeral by default. The model doesn’t save your session, the randomness is baked in, and small changes in phrasing produce wildly different results. There’s no undo that takes you back to the exact configuration that produced the thing you liked.
Here’s the trick I use.
Feed it back and ask for a recipe
Once you have something you like, immediately ask the AI for a structured representation of it, something you can use to reproduce it later.
For an image, that might look like:
“Here’s an image I generated. Can you describe it in a YAML format that captures the key visual elements, style, mood, color palette, composition, and any prompt keywords that would be useful for regenerating something similar?”
The model gives you back something like:
subject: lone lighthouse on a rocky cliff
time_of_day: dusk
color_palette:
- deep amber
- slate blue
- warm grey
mood: melancholic, cinematic
lighting: dramatic side lighting, volumetric fog
style: digital painting, painterly brushstrokes
composition: rule of thirds, subject left, horizon low
negative_elements: no people, no modern structures
prompt_keywords:
- "lighthouse at dusk"
- "dramatic sky"
- "cinematic lighting"
- "digital painting"
- "highly detailed"
Now you have something durable. You can save it to a file, paste it into a note, or put it in a repo. When you want to regenerate the image or make variations, you feed this YAML back to the model and say “use this as a reference spec”. You’ll get much closer to the original than if you tried to reconstruct the prompt from memory.
It works for more than images
The same trick generalizes to almost anything AI can produce.
Prompts and system instructions. If you’ve tuned a system prompt through iteration and finally landed on something that makes the model behave right, ask it to summarise itself as a structured spec: tone, constraints, persona, formatting rules, what to avoid. That spec becomes the source of truth you can rebuild the prompt from later.
Code patterns. You asked for a function, got one you liked, tweaked it in a follow-up, and now it’s perfect. Ask the model to extract the pattern into a reusable template, or to describe the design decisions in structured form: which approach it took, what tradeoffs it made, what inputs it expects, what edge cases it handles. Then you can reconstruct the pattern even in a different language or framework.
Conversation configurations. If you’ve worked out how to phrase things to get a certain kind of response, useful for roleplay, tutoring, or brainstorming, ask the model to write you an “initialization prompt” that recreates the same dynamic from scratch, and save it.
Webpage designs. This one is underused. Take a screenshot of any page (a UI you built, a competitor’s layout, a design you stumbled on) and paste it into a multimodal model. Ask it to extract the design system as a structured spec, and you get a detailed inventory of every visual element on the page, in terms you can hand to any AI coding tool to recreate or riff on.
The prompt I use:
“Here’s a screenshot of a webpage. Please describe its design system in YAML: layout, typography, color palette, spacing, component hierarchy, and any notable UI patterns.”
Output for something like a minimal SaaS landing page might look like:
layout:
type: single-column
max_width: 1100px
sections:
- navbar
- hero
- features_grid
- testimonials
- cta_banner
- footer
navbar:
style: sticky, transparent on scroll
items: logo (left), nav links (center), cta button (right)
cta_button: filled, rounded-full
hero:
headline: large, bold, centered, ~56px
subheadline: muted gray, ~20px, max-width 600px centered
cta: two buttons — primary filled, secondary ghost
background: off-white with subtle radial gradient
typography:
font_family: Inter
scale:
h1: 56px, weight 800
h2: 36px, weight 700
body: 16px, weight 400
caption: 13px, muted
color_palette:
primary: "#6366F1" # indigo
primary_dark: "#4F46E5"
background: "#FAFAFA"
surface: "#FFFFFF"
text_primary: "#111827"
text_muted: "#6B7280"
border: "#E5E7EB"
spacing:
section_padding: 96px vertical
component_gap: 24px
inner_padding: 16px
features_grid:
columns: 3
card_style: white, 1px border, rounded-xl, subtle shadow on hover
icon: 32px, colored square background, rounded-md
Now you can paste this into a new conversation (“Build me a landing page using this design spec”) and any decent coding model will produce something structurally and visually faithful to the original. It also works as a reference when you’re building from scratch and want to stay consistent: check the spec instead of going back to the screenshot every time.
Why YAML specifically
You could ask for JSON, Markdown, a bulleted list, or plain prose. YAML tends to work well because it’s readable enough to scan quickly, structured enough that the model interprets it reliably when you paste it back, and a natural fit for the nested, hierarchical descriptions these prompts tend to need.
Match the format to what you’ll do with it, though. If you’re storing specs in a config file, JSON makes more sense. If you’re jotting notes in Notion, Markdown is easier. The format matters less than the habit.
The real problem this solves
Most people treat AI generation as a black box: put something in, hope something good comes out, repeat until it works. When something good does come out, they treat it as luck rather than signal.
The YAML trick reframes good output as structured knowledge. It makes the model surface what it “did” to produce the result, in a form you can inspect, edit, and reuse. You’re not just saving an artifact; you’re saving the configuration that produced it.
That’s the difference between generating something once and being able to work with it.
A quick workflow
- Generate something you like
- Immediately, in the same session: “Can you describe this as a YAML spec I could use to reproduce or build on it?”
- Copy the output somewhere durable: a note, a file, a repo
- Next time, paste the YAML into a new session as context, then give your new instruction
It costs a couple of seconds while you still have the context, and it saves you from starting over every time.