How I force Copilot to write deterministic React UI (using a custom Markdown Skill) #189283
Replies: 1 comment
-
|
Hey @MegaByteMark, this is a really clever approach and the timing is great because I've been wrestling with the exact same problem. The flakiness you're describing with natural language UI prompts is real. I've noticed that the more specific the layout constraint (things like "card centered, checkbox left-aligned, link right-aligned on the same row"), the worse natural language gets, because the model is inferring spatial relationships from text rather than parsing a structure. Your DSL sidesteps that entirely by making layout syntactically unambiguous. The ||| COLUMN ||| / === ROW === nesting is especially smart, it maps almost 1:1 to Flexbox/Grid mental models, so there's no translation loss. A few questions / thoughts: On the design-system.md file, are you storing raw Tailwind class mappings in there (e.g. primary-button: bg-blue-600 rounded-xl font-bold), or is it more semantic/token-based? Curious how opinionated the schema is. On alternatives considered, did you look at anything like Storybook's CSF format or a JSON schema approach before landing on Markdown? Just curious why Markdown won out (my guess: it's the most token-efficient + human-readable combo). Going to try dropping this into a project this weekend. The repo structure looks clean. Nice work making it installable as a single skill file drop-in, that's the right distribution model for this kind of thing. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
General
Copilot Feature Area
Copilot Agent Mode
Body
Hi,
I've been heavily using Copilot's Agent mode to scaffold frontend code, particularly React which I'm relatively new to. It’s amazing, but I found that writing natural language prompts for complex UI layouts ("make a login page with a card in the middle and a dark button") was too flaky. Sometimes it hallucinates, totally misses constraints, or generates spaghetti CSS that doesn't match the theme I'm trying to implement.
I wanted a way to give Copilot strict "wireframes" it could actually understand. Figma is too token-heavy, paired with the fact LLM's don't have eyeballs so its doing its best guess of pixel math to work out how things should be arranged, and trying to explain intricate layout in English is equally cumbersome.
So I built an open-source intermediate representation which I've called the Markdown-UI DSL.
I packaged it as a Copilot Custom Skill that you can just drop into .github/skills/markdown-ui-agent/SKILL.md.
Once installed, you can write dumb-simple .ui.md files like this:
Why this works so well with Copilot Agent Mode:
If you are trying to implement true "Spec-Driven Development" (SDD) using Copilot agents, you might find this really useful.
I wrote up a quick 2-minute installation guide in the repo here: https://github.com/MegaByteMark/markdown-ui-dsl
Would love to know how you guys handle UI design prompting with Copilot and if you find this DSL useful!
Beta Was this translation helpful? Give feedback.
All reactions