Try contributing with your AI assistant. Point your AI at this repo (or the uipotion-manifest and potions-index), give it the schemas in src/statics/schema/ and existing potions in the same category as references, and ask it to draft a new potion (Markdown + JSON + index entry). Then run npm run build, refine the result, and open a PR. Many contributors use AI for the first draft and refine from there.
Quick Start
Follow these steps to add your potion to the collection:
- Fork this repository at github.com/uiPotion/uipotion
- Create your potion (Markdown + JSON + index entry) — see Creating a Potion below
- Validate with
npm run validate, which checks the JSON, the Markdown, and the index entry. The Schema Validator checks only the JSON, in your browser. - Run
npm run buildto validate and generate the production site - Submit a pull request with your new potion
We'll review your potion for schema compliance and best practices, then merge and publish when ready.
Creating a Potion
Each potion consists of two files:
- Markdown file (
src/potions/[category]/your-potion.md) — human-readable web version - JSON file (
src/statics/potions/[category]/your-potion.json) — AI-readable guide
Categories
Choose the appropriate category:
- layouts — Full-page layouts (dashboards, landing pages, app shells)
- components — Reusable UI elements (buttons, dialogs, forms, cards)
- features — Complete user flows (authentication, onboarding, checkout)
- patterns — Design patterns and guidelines
- tooling — Developer tools and infrastructure
Step 1: Create JSON File
Create src/statics/potions/[category]/your-potion.json
Use the category schema in src/statics/schema/categories/ and an existing potion as template (e.g., dialog.json for components, ai-agent-chat.json for layouts, ai-action-review.json for patterns, form-login-register.json for features). Write it the way those guides are written: they follow the Guide Rules, which not every older guide follows yet. Every guide requires the base fields $schema, id, version, name, category, tags, description, aiAgentInstructions, and meta. Each category schema adds required structures of its own, so start from an existing potion in the same category rather than treating this list as a complete template. See Available Schemas and Using Schemas with AI below for more.
Step 2: Create Markdown File
Create src/potions/[category]/your-potion.md
Required front matter: layout, title, publicationDate, excerpt, category, tags, agentManifest, and path. The agentManifest must point to your JSON file (e.g. potions/components/your-potion.json). The path is the page path without a leading slash or extension (e.g. potions/components/your-potion); the page's canonical URL and Markdown links are built from it. Then write comprehensive specifications in the body; see the Dialog potion (dialog.md) for format. Don't start it with a # title: the page shows title as its heading, so sections start at ##.
Example front matter:
---
layout: 'potion'
title: 'Your Potion Name'
publicationDate: 'YYYY-MM-DD'
excerpt: 'Brief description (1-2 sentences)'
category: 'Components'
tags:
- components
- tag1
- tag2
agentManifest: 'potions/components/your-potion.json'
path: 'potions/components/your-potion'
---Also add promptSubject, a short lowercase noun phrase such as 'modal dialogs' or 'a dashboard layout'. The potion page uses it in the prompts visitors copy. If the prompt's default reuse sentence doesn't fit your potion, as with tooling, add promptReuse with a replacement sentence. Optionally, add useWhen (one sentence that completes "Use this when"), specifies (three behaviors your guide specifies), and example (one short scenario that shows them) to show a short summary under the excerpt.
Step 3: Validate
Check your JSON in the Schema Validator, which compares it with its category schema. Fix any errors before continuing. The full check, npm run validate, also covers your Markdown and the index entry from Step 4, so run it after that step (npm run build runs it too).
Step 4: Update Potions Index and Dates
Add the matching entry to src/statics/potions-index.json, including id, name, category, tags, excerpt, webUrl, agentGuideUrl, markdownUrl, created, and updated. Use pretty web URLs without .html. Update totalCount and top-level lastUpdated, keep index dates synchronized with the guide metadata, and update the manifest meta.updated.
Step 5: Build and Verify
Run npm run build. The build validates every potion (its JSON, its Markdown, and the index), regenerates static discovery files, builds the Harold site, and cleans temporary Markdown publishing copies.
Understanding Schemas
UI Potion uses JSON Schema to ensure all potions follow a consistent structure. Schemas define:
- Required fields - What every potion must include
- Data types - The format of each field
- Validation rules - Constraints and patterns
- Category-specific requirements - What's needed for layouts, components, features, etc.
You can use these schemas with AI assistants to generate potions! Simply provide the schema to your AI and ask it to create a potion that follows the structure.
Available Schemas
Each category has its own schema. Choose the one that matches your potion type:
Base Schema
Common structure for all potions (required fields, metadata, AI instructions)
View Schema →Patterns
For design patterns and guidelines: accessibility patterns, interaction patterns
View Schema →Contract Schemas
These are reusable building blocks referenced by category schemas:
- Accessibility Contract - WCAG compliance, ARIA, keyboard navigation
- State Contract - State definitions and management
- Interactions Contract - User interaction patterns
Using Schemas with AI
You can use these schemas to generate potions with AI assistants. AI can help you create both the JSON and Markdown files:
Generating the JSON File
Example prompt for AI:
Create a UI Potion JSON file for a navigation bar component.
Use this schema as a reference: https://uipotion.com/schema/categories/components.schema.json
The component should:
- Have a logo on the left
- Navigation links in the center
- A user menu on the right
- Be responsive with a mobile hamburger menu
- Support sticky scroll behavior
Make sure the JSON follows the schema exactly and includes all required fields.
Write it like https://uipotion.com/potions/components/dialog.json, which follows the
Guide Rules in https://github.com/uiPotion/uipotion/blob/main/AGENTS.md.Generating the Markdown File
Once you have your JSON file, you can ask AI to create the Markdown version:
Example prompt for AI:
Create a Markdown file for a UI Potion based on this JSON file.
The Markdown should:
- Include YAML front matter with layout, title, publicationDate, excerpt, category, tags, agentManifest, path, and promptSubject
- Be human-readable and comprehensive
- Include detailed specifications, dimensions, states, accessibility requirements
- Be framework-agnostic in descriptions
- Follow the format of dialog.md: no # title in the body (sections start at ##), and no ASCII art,
text diagrams, emojis, or tables
The agentManifest should point to: potions/components/your-potion-name.json
The path should be: potions/components/your-potion-name
The promptSubject is a short lowercase noun phrase for the prompts on the potion page, such as 'a navigation bar'Treat the generated files as a draft: review them against a same-category potion, validate them, and refine them before submitting.
Validate Your Potion
Before submitting a pull request, always validate your potion. There are two validators, and they check different things:
Web-Based Validator
Select the category and paste your potion JSON. It checks that one JSON against its category schema, in your browser. It doesn't see your Markdown or the index.
CLI Validation Script
The Node.js CLI validation script checks every potion at once, and checks more than the web validator:
# Validate all potions
npm run validate
# Or run directly
node validate-potions.jsThe CLI script:
- Finds every potion in the category folders, and checks that each has both its Markdown and its JSON
- Selects the category schema from the potion directory, and fails on a folder without one
- Validates each potion against its category schema, including formats such as dates
- Checks guide identity and metadata against
potions-index.json - Checks the authoring rules in
AGENTS.md: the Markdown front matter, tags, names, and content rules, the guide URLs, related potions, dates, the guide's references to its own parts, and an acceptance checklist in every Markdown that matchestestingChecklist - Shows detailed error messages for any issues
- Runs automatically before
npm run build - Exits with error code if validation fails (useful for CI/CD)
Both validators will:
- Check that all required fields are present
- Verify data types (only the CLI script checks formats such as dates)
- Validate schema references
- Show detailed error messages if something is wrong
Testing Locally
Before submitting a PR, run the project locally:
npm ci
npm startVisit http://localhost:3000 to preview your changes. Before submitting, run npm run build; it validates the catalog, regenerates static files, and creates the production build.
Pull Request Guidelines
Before Submitting
- JSON validates with no errors (web validator or
npm run validate) - Markdown has correct front matter
- Ran
npm run build - Updated
potions-index.json - Tested locally with
npm start - Followed existing potion format
PR Description Should Include
- Category and potion name
- Brief description of what it provides
- Confirmation that it passes validation
- Example use case — when would someone use this potion?
We'll review your potion for schema compliance and best practices, suggest improvements if needed, then merge and publish when ready.
Best Practices
The Guide Rules list these in full, and every guide follows them.
Writing AI Agent Instructions
- Tell agents plainly to use the project's styling system and tokens, without "CRITICAL" or all-caps rules
- Tell them to build on suitable existing components, implement only what the task needs, keep existing APIs, and add no dependency without asking
- Use the Dialog guide's
projectDetectionfor the detection steps - Provide clear implementation steps, and say each rule once
- Include output constraints (what to avoid)
Framework Patterns
- Prefer platform features, such as
<dialog>,inert, andpopover, and stack-neutral examples - Keep code to short snippets in plain HTML, CSS, and JavaScript for the parts that are easiest to get wrong, the same in the Markdown and in
frameworkPatterns, and check them in a browser - Add framework examples only where they help, and label the framework version they're for
- Describe the state the behavior needs in stack-neutral terms
Accessibility
- For user-facing UI, target WCAG 2.2 AA and name the criteria that matter
- Include keyboard navigation requirements
- Document ARIA attributes needed
- Provide screen reader considerations
Testing
- End with a short acceptance checklist, the same in the Markdown and in
testingChecklist - Cover functional, accessibility, and responsive testing
- Include edge cases and error states
Content Guidelines
- Be comprehensive — Include all necessary details for AI to implement, and say each rule once
- Be framework-agnostic — Avoid framework-specific code in descriptions
- Include accessibility where relevant — WCAG 2.2 AA, ARIA, keyboard navigation
- Follow the Guide Rules — In
AGENTS.md, which every guide follows - Include responsive specs where relevant — Mobile, tablet, desktop breakpoints
- Keep code to short snippets — Plain HTML, CSS, and JavaScript for the parts that are easiest to get wrong, the same in the Markdown and the JSON, and checked in a browser
- End with a short acceptance checklist — What to verify after implementation, the same in the Markdown and the JSON (
testingChecklist)
Questions?
- Check existing potions for examples
- Review
AGENTS.mdin the repository for detailed project guidelines - Ask in your pull request if unsure
Resources
- Schema Validator — Validate your potions before submitting
- GitHub Repository — View the codebase and submit PRs
- About UI Potion — Learn more about the project
Get Started
Ready to contribute? Start by exploring the schemas and validating your first potion!