AI Rules: Authoritative rules and patterns for generating Airframe markup with AI. # AI Rules > Authoritative rules for generating Airframe markup with AI coding agents The authoritative rules ship with `@airframeui/core` as **`@airframeui/core/rules`** (`AIRFRAME_RULES.md`). This page is the docs summary agents and humans should follow when generating markup. ## For LLMs and coding agents [Section titled “For LLMs and coding agents”](#for-llms-and-coding-agents) Prefer these entry points over scraping the whole site: * [`/llms.txt`](/llms.txt) — curated index of documentation sets and package resources * [`/llms-small.txt`](/llms-small.txt) — abridged docs (best default context) * [`/_llms-txt/ai-rules.txt`](/_llms-txt/ai-rules.txt) — this page + AI engineering notes * [`/_llms-txt/getting-started.txt`](/_llms-txt/getting-started.txt) — install, usage, tokens, layouts After `npm install @airframeui/core`, load in-project resources: ``` // JSON (safe to import in Node / bundlers) import catalog from '@airframeui/core/catalog'; // component metadata import classes from '@airframeui/core/classes'; // class reference import examples from '@airframeui/core/examples'; // code examples // Markdown — resolve the package export and read as text (do not assume a JS default export) // @airframeui/core/rules → AIRFRAME_RULES.md // @airframeui/core/ai → AI_INTEGRATION.md ``` ## Non-negotiable rules [Section titled “Non-negotiable rules”](#non-negotiable-rules) * **Semantic HTML first** — ` ``` ### Semantic typography first [Section titled “Semantic typography first”](#semantic-typography-first) ```

Title

Body text

Visually H1, semantically H2

Caption

Title

``` ## Related tooling [Section titled “Related tooling”](#related-tooling) * [VS Code Extension](/docs/vscode-extension) — IntelliSense for tokens and classes * [ESLint plugin](/docs/eslint-plugin) — catch Tailwind/Bootstrap leftovers and prefer layout recipes * [AI and Human Engineering](/docs/ai-and-human-engineering) — why the structural contract exists # AI and Human Engineering > How Airframe provides a structural language for AI-generated and human-maintained UI **Airframe** is a structural UI system for humans and AI. Think of it like an aircraft airframe: it defines the shape and strength of the system. You bring the engine, whether that is React, Vue, Angular, AI-generated code, or whatever comes next. Building UI is easy. Keeping intent intact is hard. That is the gap between AI-generated code and human-maintained systems, and between prototype and production. **Frameworks are engines. Airframe is the structure.** ## The problem [Section titled “The problem”](#the-problem) AI can write UI quickly, but only if it has: * Predictable patterns * Clear constraints * Structural rules to follow Humans keep that code alive, and they need: * Readable markup * Consistent meaning * Room to refactor without breaking things ## The solution: a structural contract [Section titled “The solution: a structural contract”](#the-solution-a-structural-contract) Airframe is that shared contract. It gives AI and humans the same language for layout and components. 1. **Structural primitives.** `af-stack`, `af-inline`, and `af-grid` describe layout intent, not one-off styling tricks. 2. **Readable output.** Semantic markup people can review and change without decoding a wall of utilities. 3. **Safe constraints.** Tokens and cascade layers keep theming and overrides predictable. 4. **Clear rules.** `@airframeui/core` ships the contract in `AIRFRAME_RULES.md`. Frameworks can change. The structure stays. ## How it works [Section titled “How it works”](#how-it-works) ### For AI [Section titled “For AI”](#for-ai) * Follow the [AI Rules](/docs/ai-rules) (`@airframeui/core/rules`) * Prefer semantic HTML with `af-*` classes * Use layout primitives (`af-stack`, `af-inline`, `af-grid`) and patterns (`af-card`, `af-btn`) * Theme with CSS variables (`--af-*`). Do not invent unknown token names. ### For humans [Section titled “For humans”](#for-humans) * Review a DOM you can actually read * Override tokens in CSS (no build step for simple themes) * Extend with cascade layers * Use the same patterns the AI was given ## Real-world example [Section titled “Real-world example”](#real-world-example) **AI generates** (minimal classes; cards already stack): ```

Dashboard

Welcome back!

``` **Humans review:** * Clear component structure (`af-card`) * Layout intent where it matters (`af-inline` for actions) * Predictable spacing (`af-gap-sm`) * Named parts (`af-card__title`, `af-card__body`) Both sides get something useful. AI has rules it can follow. Humans get markup that still makes sense next month. The same contract holds across frameworks. ## Why this matters [Section titled “Why this matters”](#why-this-matters) Utility-first markup is easy for models to spit out and hard for people to own: ```

Title

Content

``` Airframe stays readable: ```

Title

Content

``` AI can generate either. Humans can maintain the second. Airframe is the structural language that makes AI output something people can keep shipping. ## Next steps [Section titled “Next steps”](#next-steps) * [AI Rules](/docs/ai-rules): generation rules, patterns, theme and MCP entry points * [Patterns](/docs/patterns/button): structural UI patterns * [Tokens](/docs/tokens) and [Theming](/docs/theming): design language and Theme Studio * [VS Code Extension](/docs/vscode-extension): IntelliSense for `af-*` and `--af-*` while you edit