Portable instruction packages
Small folders that tell an assistant how to read a design file, what rules apply, and what output shape to produce.
A standalone note on how I turn design taste, examples, and workflow decisions into reusable AI systems: things an assistant can read, call, validate, and rebuild instead of guessing from scratch each session.
This is how I turn design examples and workflow decisions into reusable AI-readable systems.
Small folders that tell an assistant how to read a design file, what rules apply, and what output shape to produce.
Searchable stores of examples, notes, specs, records, and relationships that can be found by name, tag, or similarity.
Repeatable paths that turn source material into HTML, mockups, reports, packages, or code and then check the result.
AI assistants are good at generating plausible design and code. They are bad at reliably generating the same design twice unless the decisions are stored somewhere concrete.
The system stores the decisions outside chat: screenshots for diagnosis, .fig files for structure, skill.md files for instructions, examples for target shapes, scripts for repeatable generation, and databases for retrieval.
| Human library term | AI-readable equivalent | What it lets the assistant do |
|---|---|---|
| Visual reference | Screenshot, .fig file, annotated HTML | See the intended layout, structure, and interaction pattern |
| Component guideline | skill.md plus token and spacing references | Build the same pattern with the same constraints |
| Design review note | Validator rule, checklist, or shell script | Catch drift before the artifact is shared |
| Growing library | Structured retrieval system | Find the right example without re-uploading everything |
The system is organized in layers. Each layer solves a problem the previous layer cannot solve by itself.
| Layer | What lives there | Problem it solves |
|---|---|---|
| Visual Reference | Screenshots, .fig files, annotated HTML pages | Shows what the design should look like or how it is structured |
| Instructional Layer | skill.md, reference files, tokens, spacing rules, scripts | Tells the assistant how to think before it generates |
| Example Layer | Known-good templates, rendered HTML, component records | Gives the assistant a concrete target shape |
| Callable Tool Layer | Shell scripts, bash commands, Python validators, renderers | Makes generation and review repeatable |
| Structured Store | SQL, JSON, indexes, vector search, schemas, Obsidian links | Retrieves the right material when the library gets too large for one session |
This layer starts with what can be seen. Screenshots diagnose bugs or capture inspiration. .fig files go deeper: they carry component structure, naming, spacing, relationships, prototypes, and assets.
This layer tells the assistant how to read the source. It includes skill.md, token lists, color names with hex codes, spacing rules, naming conventions, and scripts that load the right files.
This layer stores known-good outputs as code or structured files. The assistant can read the end state directly instead of translating from a vague description.
This layer checks the work. Scripts, renderers, and validators return specific fixes: a missing state, a raw hex value, a broken field, or an output that does not match the expected shape.
This layer registers the pieces so they can be retrieved later. SQL tables, JSON records, search indexes, schemas, vector search, local folders, and Obsidian keep the library navigable.
A parallel layer runs beside all five: local file organization and Obsidian. That is the browsable surface for people. The machine-facing layer stores the same decisions in files, records, examples, and checks the assistant can use directly.
This is the same stack from the inside: the actual files and folders that make it work.
| Layer | Files | What they do |
|---|---|---|
| Visual Reference | design.fig, screenshot.png, annotated-page.html | Preserve the visible design, the component tree, and the reference state |
| Instructional Layer | skill.md, references/colors.md, references/spacing.md | Describe how the assistant should read, name, space, and style the work |
| Example Layer | examples/example.html, examples/component.yaml | Show the finished shape in a format the assistant can inspect |
| Callable Tool Layer | scripts/render.sh, scripts/check_tokens.py | Run repeatable generation and drift checks |
| Structured Store | records.json, design_examples.sql, schema.json | Register examples so they can be searched and reused |
The source of visual truth. The assistant reads frames, components, layout relationships, spacing, naming conventions, and linked assets.
The primary instruction file. It explains what the package is for, what to inspect first, and which reference files to load when needed.
The supporting memory: colors, tokens, spacing rules, naming conventions, accessibility notes, and common parsing problems.
The repeatable operations. A shell or bash script loads the inputs, runs generation, renders output, or checks whether a rule drifted.
A portable instruction package is small and readable: one skill.md plus optional references, scripts, assets, and examples. When the knowledge base gets large enough to need search, tags, schemas, and reliable retrieval, it becomes a structured retrieval system.
These are the kinds of files that sit behind the workflow. Each one solves a specific reliability problem.
This folder keeps the root readable while references, examples, and scripts carry the working memory.
filter-library-skill/
skill.md
README.md
references/
filter-library.fig
colors.md
spacing.md
figma-parsing-notes.md
examples/
filter-toolbar.html
selected-chip.yaml
scripts/
render.sh
check_tokens.py
The primary instruction file gives the assistant a reliable reading order before it starts generating UI.
# Filter UI Package
Use this package when building or reviewing compact filter controls.
Start by reading:
- references/filter-library.fig
- references/colors.md
- references/spacing.md
- references/figma-parsing-notes.md
- examples/filter-toolbar.html
When generating:
- match the component names and layout relationships in the .fig file
- keep token names unchanged
- include default, hover, focus, selected, and disabled states
- use the example HTML as the output shape, not as decoration
Before sharing:
- run scripts/render.sh
- run scripts/check_tokens.py build/filter-toolbar.html
A color list pairs plain-language meaning with hex values so the assistant uses the right color for the right job.
# Color Tokens
Action blue: #2563EB
Use for primary actions, active chips, and selected controls.
Surface white: #FFFFFF
Use for cards, menus, and editable panels.
Quiet border: #CBD5E1
Use for dividers, chip outlines, and inactive controls.
Warning coral: #F97316
Use only for recoverable warnings or attention states.
Spacing rules prevent the assistant from inventing a new rhythm every time it lays out the same pattern.
# Spacing Rules
4px: icon-to-label gap
8px: chip padding and small control gaps
12px: toolbar item gap
16px: card internal padding
24px: section gap
Do not create new spacing values unless the target layout requires a new scale step.
A short shell script makes the same generation path run the same way each time.
#!/usr/bin/env bash
set -euo pipefail
python scripts/build_component.py \
--source references/filter-library.fig \
--tokens references/colors.md \
--spacing references/spacing.md \
--example examples/filter-toolbar.html \
--out build/filter-toolbar.html
This validator catches raw color values in rendered HTML where named tokens should be used instead.
from pathlib import Path
import re
import sys
html = Path(sys.argv[1]).read_text()
raw_hex_values = sorted(set(re.findall(r"#[0-9A-Fa-f]{6}", html)))
if raw_hex_values:
print("Use named tokens instead of raw hex values:")
for value in raw_hex_values:
print(f"- {value}")
raise SystemExit(1)
A structured record lets a growing library retrieve the right component by name, tags, states, or source.
{
"id": "component.filter-chip",
"type": "component",
"name": "Filter chip",
"source": "references/filter-library.fig",
"tokens": ["action-blue", "surface-white", "quiet-border"],
"states": ["default", "hover", "focus", "selected", "disabled"],
"examples": ["examples/filter-toolbar.html"],
"retrieval_tags": ["filters", "chips", "compact-controls"]
}
The component spec stores anatomy and states in a compact form the assistant can reuse directly.
component: FilterChip
status: reusable
purpose: Narrow a result set without leaving the current surface.
source: references/filter-library.fig
anatomy:
- label
- selected state
- remove icon when active
states:
- default
- hover
- focus
- selected
- disabled
examples:
- examples/filter-toolbar.html
| File | Why it exists |
|---|---|
| skill.md | Primary instructions for reading and using the package |
| README.md | Human-facing summary of what the package contains |
| references/filter-library.fig | Visual structure, components, spacing, and naming |
| references/colors.md | Semantic names plus hex values |
| scripts/render.sh | Repeatable generation path |
| scripts/check_tokens.py | Token drift check |
| examples/filter-toolbar.html | Known-good output the assistant can inspect |
| records/filter-chip.json | Searchable registration when the library grows |
Your visual library is the human-facing start. The system adds the files that make each saved element reusable by an assistant.
| Your library stores | The system adds | Result |
|---|---|---|
| Screenshot | A note that says whether it is for diagnosis or inspiration | The image becomes a decision point, not a fragile source of truth |
| .fig file | skill.md, token references, examples, and parsing notes beside it | The file becomes a portable component package |
| Favorite interaction pattern | States, triggers, feedback rules, and accessibility notes | The assistant can rebuild the flow, not just copy the look |
| Growing set of examples | SQL or JSON records with tags, source links, and reusable parts | The library becomes searchable instead of memory-bound |
You still decide what is worth saving, what feels good, and what belongs in the library.
You decide whether an example is inspiration, a reusable pattern, a debugging reference, or a finished standard.
You decide whether the generated artifact actually matches the original design intent after the checks pass.
Tokens, spacing, layout rules, naming conventions, states, and component anatomy.
.fig files, HTML renders, component records, and known-good samples that show the target shape.
Shell scripts, bash commands, and validators that say exactly what drifted or what is missing.
I am curious whether this maps to how you already collect elements, where it feels useful, and where it gets too heavy.
Where did the layers click for you, and where did the explanation get fuzzy?
If you used this with one saved element, what feels worth doing, and what feels like too much overhead?
Is there something you already do that fits one of these layers: reference, rule, example, check, or searchable record?
If any of this sparked a thought about your own system, a question about how it works, or something that did not land, I would love to hear it.