khuon
README.md
# Khuôn
**Mobile UI styles, packaged for AI.** Khuôn is a local workbench of hand-made mobile UI style packs and
micro-interactions — each with a guide, design tokens, reference screens and an AI-ready spec — so Claude,
Cursor, Codex and friends build on-brand screens on the first try, without the generic "AI look".
**[▶ Live demo](https://vandanhtran95.github.io/khuon/)** — browse the styles, tap the micro-interactions, copy prompts. · [Tiếng Việt](README.vi.md)

- **Style packs** — guide + tokens + photo-led reference screens per style: Soft Minimal, Organic Nature, Warm Pop, the dark editorial **Dark Roast** (specialty coffee), the ivory magazine **Editorial Luxe** (beauty and fashion), the frosted-glass **Liquid Glass** (travel), the graphite **Bento Ledger** (finance) and the pastel **Soft Clay** (kids and learning).
- **Micro-interactions** — interactive demos (like burst, add-to-cart fly, toggle spring, bottom-sheet snap…)
with millisecond-level specs; they re-skin to any style's tokens.
- **Component sheets** — every style ships 24 shared components (nav, buttons, inputs, chips, stepper, cart line, price summary, order steps, ticket, toast, sheet…) with their states; copy one in the gallery or fetch it over MCP.
- **Make it your brand** — swap a style's primary/accent colors and fonts (19 Vietnamese-ready Google Fonts) for a client and watch every screen and component update; on-colors and contrast are checked for you. Copy the branded tokens or pass `brand` over MCP; the phone QR preview shows the branded version too.
- **Copy prompt** — one click builds a complete brief (rules + guide + tokens + optional code).
- **MCP server** — your AI reads styles and motions directly and can save screens for preview.
- **Phone preview + tap-to-annotate** — scan a QR code, tap on the screen to leave notes, your AI reads them
over MCP, fixes the file, and the phone reloads.
- **Vietnamese-ready** — every sample is checked for Vietnamese diacritics, VND formats and text length.
- **Zero dependencies** — plain Node ≥ 18. No build step.
| Style pack with reference screens | Micro-interactions that re-skin to any style |
|---|---|
|  |  |


## Quick start
```bash
cd khuon
npm run dev # gallery at http://localhost:5178
```
## Connect your AI (MCP)
Open the gallery → **Connect AI** for ready-to-copy configs (Claude Code, Cursor, Codex CLI, Claude Desktop,
VS Code). For Claude Code:
```bash
claude mcp add khuon --scope user -- node "/absolute/path/to/khuon/mcp.js"
```
Then ask: *"Use Khuôn to build a phone-number sign-in screen in the Soft Minimal style."*
| Tool | What it does |
|---|---|
| `list_styles` / `get_style` / `get_screen` | Pick a style, read its guide + tokens, see a reference screen |
| `get_component` | One ready-made component of a style (tab bar, button, input, stepper, cart line, steps, toast…): recipe + CSS + HTML with states |
| `build_prompt` | Full design brief, same as the gallery's "Copy prompt" |
| `brand` option | On `get_style`, `build_prompt`, `save_draft`: `{ primary, accent, font_display, font_body }` re-skins the style for a client brand, with a contrast report |
| `list_motions` / `get_motion` | Micro-interaction specs (+ optional reference code) |
| `save_draft` | Save a screen for phone preview — pass `style` and it injects the tokens + fonts, then returns a lint report |
| `edit_draft` | Small find/replace edits to a draft (no need to resend the whole file) |
| `list_photos` | Approved free Unsplash photos of a style |
| `get_feedback` / `resolve_feedback` | Read the notes tapped on the phone, mark them fixed |
| `get_format` | The style pack format, for creating new packs |
After updating Khuôn, start a new AI session to pick up new tools.
Also: the `use_style` prompt (`/mcp__khuon__use_style` in Claude Code) and `khuon://` resources.
## Phone preview
```bash
npm run tunnel # public https link via Cloudflare Quick Tunnel — works on any network, even 4G
npm run lan # same Wi-Fi only
```
Gallery → **Device** → scan the QR code. Tap **✎** then the spot to change. Only people with the QR code
(it carries a token) can view or annotate. `npm run tunnel` needs `cloudflared` in `../tools/cloudflared/`,
your `PATH`, or the `CLOUDFLARED` env variable.
## Project layout
```
khuon/
server.js gallery server, notes API, live reload, LAN/tunnel modes
mcp.js MCP server (stdio JSON-RPC, no dependencies)
lib/ shared readers: styles, motions, notes & drafts
web/ gallery (index.html, app.js, app.css), prompt.js, annotate.js
styles/ style packs — see styles/_format.md
motions/ micro-interactions — see motions/_format.md
scripts/ check-style, check-motion, test-mcp, pack
```
## Checks and demo build
```bash
npm test # style + motion checks and an MCP client test
npm run build # static demo in site/ (deployed to GitHub Pages by .github/workflows/pages.yml)
```
## Free and Pro packs
Free packs live in this repository under the MIT license. Commercial packs live in folders named `pro-*`,
which are git-ignored and distributed separately (`node scripts/pack.mjs pro-<id>` builds a zip).
## Photos
Only **free** Unsplash photos are used (never Unsplash+), hotlinked and declared per pack in `meta.json`.
They are covered by the [Unsplash License](https://unsplash.com/license).
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
## License
[MIT](LICENSE) © 2026 Khuôn contributors