Working with UDML in an Existing Codebase
UDML (Universal Design Markup Language) is a structured, semantic XML format used to describe user interfaces. When working in an existing project (e.g., a React + Tailwind codebase), your goal is not to regenerate everything, but to translate the intent and structure of the UDML into the appropriate parts of your application.
This guide shows how to write effective prompts for AI assistants like Cursor or Claude when integrating UDML-based UI specs into an active codebase.
β
What the AI Needs to Know
What UDML is
"This is an XML-based UI description. It defines screens, layouts, components, and styles in a way that is meant to guide interface generation."
How to interpret key sections
<instructions>
: High-level intent<meta>
: Project/library context<components>
: Custom UI blocks<tokens>
and<styles>
: Design system
Where and how to apply it
Targeted file or folder
Reuse of existing components
Refactoring existing UI
π Prompt Template for Existing Codebases
π§© Special Considerations
π― Target the Right File
Be explicit about where the output should go:
βUpdate
src/screens/Settings.tsx
using the UDML<screen name='Settings'>
definition.β
π§± Reuse Existing Components
Let the AI know when to use your codebase's components:
βMap
<button>
to ourButton
component from@components/ui
.β
π¨ Resolve Styles
If UDML uses:
Prompt:
βTranslate
textStyle='title-lg'
toclassName='text-2xl font-semibold'
, or useHeadingText
from our design system.β
π¬ Use Hints and Meta
βRefer to
ai-hint
attributes and<instructions>
for behavior and layout intent.β
π‘ Example Prompt for Cursor
π§ Summary
To prompt an AI assistant effectively using UDML in a real project:
Be explicit about what UDML is and how to interpret it
Define where in your codebase it should be applied
Guide the AI to reuse and refactor, not recreate
Direct attention to
<instructions>
,<meta>
, andai-hint
fieldsSpecify your target stack (framework, style system, file structure)
The more you provide context + intent, the better UDML becomes a seamless input for your codebase.
Last updated