mdocUI

Generate interactive LLM-driven UI by rendering Markdoc component tags inline with streamed markdown.

38|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/mdocui/mdocui --skill mdocui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mdocUI
Source: https://github.com/mdocui/mdocui/tree/main
Command: npx skills add https://github.com/mdocui/mdocui --skill mdocui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you build mdocUI “generative UI” outputs that mix normal markdown prose with interactive {% %} components, so you can stream content to users and still capture actions (buttons, forms, links) reliably.

Core Features & Use Cases

  • Produce mdocUI markup for streaming: Write tags like {% chart ... /%} and {% button ... /%} alongside prose, using the Markdoc {% %} tag syntax inline.
  • Auto-generate correct system prompts: Use generatePrompt() with a component registry so your LLM receives the exact tag syntax, component signatures, nesting rules, and streaming guidance.
  • Render interactive components with React: Use useRenderer() + Renderer to parse streamed text into a typed AST and render components with shimmer placeholders and error boundaries.
  • Handle interactions safely: Centralize all UI events through onAction, validate rendered props with Zod in dev, and recover from component render errors without breaking the rest of the UI.
  • Style from the app, not the model: Keep the library theme-neutral and apply classNames or CSS selectors targeting data-mdocui-* attributes.

Quick Start

Ask your AI coding agent to add mdocUI to your project, generate a system prompt from the default component registry, then stream LLM output into a React Renderer using useRenderer().

Frequently Asked Questions about mdocUI

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stream interactive UI components from an LLM in React?

To stream interactive UI components from an LLM in React, you use a streaming parser to convert text into a typed AST and render Markdoc-style `{% %}` tags inline with prose. This allows the model to emit buttons and charts while users receive text immediately.

How do I generate a system prompt for an LLM that outputs interactive markdown tags?

Generate a system prompt for interactive markdown tags by passing a component registry to a prompt generation function. This provides the LLM with exact tag syntax, component signatures, nesting rules, and streaming guidance to ensure valid markup output.

Can I use Zod validation with streamed LLM UI components?

Yes, you can use Zod validation with streamed LLM UI components. The renderer validates rendered props with Zod during development to ensure the LLM output matches the expected component schema before displaying it to users.

What is the best way to handle errors when rendering streamed LLM components?

The best way to handle errors when rendering streamed LLM components is using error boundaries within the React renderer. This setup recovers from component render errors without breaking the rest of the UI and centralizes events through an `onAction` handler.

How do I style interactive LLM UI components without overriding the model's output?

Style interactive LLM UI components by keeping the library theme-neutral and applying CSS selectors targeting `data-mdocui-*` attributes or custom `classNames`. This ensures styling is controlled from the app side rather than the model output.

Does this streaming UI approach work for agent workflows and dashboards?

Yes, this streaming UI approach works for agent workflows and dashboards. It fits chat, dashboards, and agent workflows where the model must emit interactive elements like buttons, forms, charts, and tables while users receive text immediately during streaming.