# uicraft

Adopt this skill: https://proskills.md/skills/other/aicosmo1-uicraft

Page: https://proskills.md/skills/other/aicosmo1-uicraft
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: bundled-skills/ui-copywriting/SKILL.md
size: 8265
sha: 55af7c49757157b20e800f1e64f90d96e6df1a96
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/bundled-skills/ui-copywriting/SKILL.md

```text
---
name: ui-copywriting
description: >-
  Guides concise, human-crafted UX writing, UI microcopy, and content hierarchy.
  Eliminates AI fluff, verbose descriptions, and corporate buzzwords. Enforces scannability,
  front-loaded phrasing, short active verbs, and strict word count limits across headings,
  cards, tables, tooltips, and empty states.
---

# `ui-copywriting`: Concise, Human-Crafted UX Microcopy & Content Architecture

## Overview

Software interfaces are scanned, not read. Users interact with dashboards, tools, and SaaS products to accomplish tasks—not to read marketing essays or AI-generated filler paragraphs.

When AI agents author UI specs or generate component code, they tend to default to **verbose, bloated corporate filler** (e.g., *"Comprehensive real-time orchestration engine empowering automated workflows across your enterprise"*). This makes products feel synthetic, cheap, and exhausting to scan.

The `ui-copywriting` skill establishes strict, professional UX writing standards that make user interfaces **punchy, scannable, human, and direct**.

---

## 1. The Core Philosophy of Product Copy

1. **Scannability Over Completeness:** Users glance at visual anchors (headings, bold metrics, button labels). Every extra word dilutes their attention.
2. **Front-Loaded Phrasing:** Put the most important information in the first 2–3 words. The eye scans in an F-pattern.
3. **Clarity Over Cleverness:** Direct, unambiguous verbs beat playful or vague terminology.
4. **Human Tone Over Machine Eloquence:** Write like a pragmatic senior engineer or product designer speaking directly to a colleague.

---

## 2. The AI Fluff Ban-List

Never use the following buzzwords or patterns in UI headings, card subtitles, descriptions, tooltips, or empty states:

| Banned AI Buzzwords | Why It Fails | What to Use Instead |
| :--- | :--- | :--- |
| *"seamlessly / seamless"* | Pure filler. Software either works or fails. | Drop completely. State the action directly. |
| *"empower / empowers"* | Corporate marketing jargon. | State what the user can do (*"Configure"*, *"Audit"*). |
| *"robust / holistic"* | Vague praise masquerading as information. | Specify exact capability (*"Automated"*, *"Real-time"*). |
| *"comprehensive overview"* | Redundant. An overview is already comprehensive. | *"Summary"*, *"Metrics"*, or just the topic name. |
| *"single pane of glass"* | Cliché buzzword. | *"Dashboard"*, *"Console"*, or *"Hub"*. |
| *"delve into / explore"* | Overly academic / promotional AI tell. | *"View"*, *"Inspect"*, *"Filter"*. |
| *"leverage / utilizing"* | Stilted and artificial. | *"Use"*, *"Apply"*, or drop entirely. |
| *"streamline / optimize"* | Overused filler when details are omitted. | Explain the specific action (*"Reduce spend"*, *"Automate sync"*). |
| *"in order to"* | Three words where zero or one will do. | *"To"* or omit entirely. |
| *"effortlessly manage"* | Promotional puffery. | *"Manage"*, *"Control"*, or the specific action. |

---

## 3. Strict Word Count & Structural Limits

Every piece of static or dynamic text in a UI belongs to a specific tier with strict length boundaries:

### Tier 1: Page Headings & Modal Titles ($\le$ 4 words)
- **Limit:** 2–4 words maximum.
- **Rules:** Title Case or Sentence Case (match product style). No trailing punctuation.
- ❌ *"Multi-Channel Ad Spend and Performance Overview"*
- ✅ *"Performance Overview"*
- ❌ *"Proactive Keyword Guardian and Conflict Detection"*
- ✅ *"Keyword Guardian"*

### Tier 2: Card Headers & Section Titles ($\le$ 3 words)
- **Limit:** 1–3 words.
- **Rules:** State the noun or metric group immediately.
- ❌ *"Summary of Platform Account Connections"*
- ✅ *"Connected Accounts"*
- ❌ *"Current Spend Pacing and Budget Burn Rate"*
- ✅ *"Budget Pacing"*

### Tier 3: Subtitles & Card Descriptions ($\le$ 12 words)
- **Limit:** Exactly 1 short sentence, 6–12 words.
- **Rules:** Explain the direct user value or the primary action. No introductory fluff (*"This card displays..."*).
- ❌ *"View an updated breakdown of your current spending pacing and track discrepancies across all channels in real time."* (19 words)
- ✅ *"Track actual spend against monthly targets across active channels."* (9 words)
- ❌ *"Manage and configure external data sources to keep your metrics synchronized."* (11 words, but passive)
- ✅ *"Connect advertising channels to sync campaign telemetry."* (7 words)

### Tier 4: Action Buttons & Triggers (2–3 words)
- **Limit:** 2–3 words.
- **Rules:** Always start with an active, imperative verb. Never write *"Click here"*, *"Submit"*, or *"Proceed"*.
- ❌ *"Click here to export the report"*
- ✅ *"Export CSV"*
- ❌ *"Execute Keyword Sync"*
- ✅ *"Sync Keywords"*
- ❌ *"Proceed with Rule Creation"*
- ✅ *"Create Rule"*

### Tier 5: Table Column Headers (1–2 words)
- **Limit:** 1–2 words.
- **Rules:** Concise nouns or abbreviations with units in header or cells.
- ❌ *"Total Spend in USD"*
- ✅ *"Spend"* (with `$` in cells)
- ❌ *"Calculated ROAS Multiple"*
- ✅ *"ROAS"*
- ❌ *"Current Operational Status"*
- ✅ *"Status"*

### Tier 6: Empty States (Exactly 2 Sentences)
- **Limit:** Exactly 2 sentences.
  - Sentence 1: What is absent (3–5 words).
  - Sentence 2: What to do next with clear instruction (5–10 words).
- ❌ *"There are currently no keyword recommendations to display at this time. When our system identifies opportunities or anomalies in your accounts, they will appear here automatically."*
- ✅ **Headline:** *"No keyword recommendations"*  
  **Subtext:** *"All search terms meet target ROAS thresholds. Check back after next sync."*

### Tier 7: Error Messages & Alerts (Direct Cause + Fix)
- **Limit:** 1–2 short sentences.
- **Rules:** State what failed, why, and how to recover. Never blame the user. Avoid cryptic codes alone.
- ❌ *"An unexpected error occurred while processing your request. Please try again later."*
- ✅ *"Google Ads sync failed. Reconnect your account in Settings to restore telemetry."*

---

## 4. UI Copy Transformation Gallery

Study these direct before-and-after transformations:

### Dashboard Telemetry Cards
- ❌ **Before (AI verbose):**  
  Title: *"Aggregate Paid Media Capital Deployment"*  
  Subtitle: *"Comprehensive overview of capital spent across all active ad networks"*  
  Value: *"$142,500.00"*  
  Badge: *"Spending is trending 12% higher compared to last month"*
- ✅ **After (Clean & punchy):**  
  Title: *"Total Spend"*  
  Subtitle: *"Across 4 connected ad networks."*  
  Value: *"$142,500"*  
  Badge: *"+12% vs last month"*

### Table Action Drawers / Sheets
- ❌ **Before (AI verbose):**  
  Title: *"Detailed Search Term Anomaly Investigation Panel"*  
  Description: *"Use this panel to thoroughly inspect all historical bid fluctuations and configure automated exclusion rules."*
- ✅ **After (Clean & punchy):**  
  Title: *"Search Term Details"*  
  Description: *"Review match queries and negative keyword exclusions."*

### Filter Bars & Toolbars
- ❌ **Before (AI verbose):**  
  Placeholder: *"Search through all campaign records by name or account ID..."*  
  Button: *"Apply Selected Filters to Grid"*
- ✅ **After (Clean & punchy):**  
  Placeholder: *"Search campaigns or accounts..."*  
  Button: *"Apply Filters"*

---

## 5. Microcopy Checklist for Coding Agents

When authoring `public/ui-tree/**/*.md` or generating React components in `components/`:

- [ ] **Word count audit:** Are all headings $\le$ 4 words? Are all card descriptions $\le$ 12 words?
- [ ] **Zero AI buzzwords:** Did you purge *"seamlessly"*, *"empowers"*, *"robust"*, *"comprehensive"*, and *"single pane of glass"*?
- [ ] **Action-first buttons:** Does every button start with an imperative verb (*"Connect"*, *"Export"*, *"Save"*, *"Pause"*)?
- [ ] **No conversational preamble:** Did you delete *"Here you can find..."*, *"This section is designed to..."*, *"Welcome to..."*?
- [ ] **Units in place:** Are currency symbols (`$`), percentages (`%`), and durations (`ms`, `s`) placed alongside numbers rather than spelled out in headers?
- [ ] **Two-sentence empty states:** Does the empty state tell the user what is missing and what single step to take next?
```

## File: SKILL.md
size: 11475
sha: d72b70c653f6983d515b9ae4fec1f73e3c852b89
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/SKILL.md

````text
---
name: uicraft
description: >-
  Autonomous UI/UX architecture framework natively integrated with shadcn/ui and
  an open Agent Skills Registry (better-layout, responsive-design, ui-copywriting, webperf, web-design-guidelines, composition-patterns).
  Generates UX-first unstyled UI Trees and Integration-Ready technical specifications
  (technicals.md) from PRDs. Supports structured mutations (update-colors, update-technicals,
  update-philosophy, modify-component, build-code).
---

# `uicraft`: Autonomous UI/UX Architecture Framework (shadcn & Integrations Registry)

## Overview

`uicraft` automates the translation of unstyled Product Requirements Documents (PRDs) into an agent-ready UI/UX architecture and integration-ready frontend.

### The Strategic Division of Labor
1. **Visual Polish is Delegated to `shadcn/ui`:** `shadcn/ui` provides human-tested, mathematically balanced themes, base colors, font stacks, and accessible primitives via **presets** (such as `b6FmyD0j2`, `buFywKm`, or default `b0`).
2. **Partner Skills Ecosystem:** Rather than duplicating instructions, `uicraft` integrates with official and community skills via [references/integrations/registry.md](./references/integrations/registry.md) (`better-layout`, `responsive-design`, `ui-copywriting`, `webperf`, `agent-skills`, `web-design-guidelines`, `composition-patterns`, `vercel-react-view-transitions`).
3. **`uicraft` Focuses 100% on UX Architecture & Integration-Ready Handlers:**
   - User task flows and information hierarchy.
   - Granular component decomposition (layouts, pages, cards, tables, drawers).
   - Interaction states (hover triggers, active modals, keyboard shortcuts, empty states).
   - **Integration-Ready Architecture (`public/technicals.md`):** Maps backend and third-party library dependencies, prescribing typed async service handlers (`lib/services/`) so the UI is completely wired and ready for immediate backend connection (e.g., Supabase, Prisma, REST) with zero UI refactoring.
   - **100% Requirement Traceability** citing verbatim PRD lines.
   - Producing clean, unstyled markdown specifications for coding agents.

---

## Directory Structure of Output

When executed on a client project, `uicraft` manages the following architecture inside the project's target directory (default: `public/`):

```text
public/
├── requirements.md            # Input unstyled PRD
├── config.json               # Framework configuration & preset pointers
├── preset-info.md            # Active shadcn preset metadata (style, baseColor, fonts)
├── philosophy.md             # UX principles, density, and interaction standards
├── technicals.md             # Integration-Ready libraries, domain types & service handlers
└── ui-tree/                  # Hierarchical component tree (zero inline styling)
    ├── layout/
    │   ├── shell.md          # Top-level application shell
    │   ├── sidebar.md        # Collapsible navigation sidebar
    │   └── header.md         # Global header with actions
    ├── [feature-route]/      # Mirrors router structure (e.g. dashboard/)
    │   ├── page.md           # Page composition and grid arrangement
    │   └── [component].md    # Individual component specs
    └── [another-route]/
        ├── page.md
        └── [component].md
```

---

## Mode 1: Scaffold Workflow (New Projects)

When scaffolding a new application from an unstyled PRD, follow these 5 steps in order:

### Step 1: Ingest Requirements & Verify Partner Skills
1. Locate the PRD file (default: `public/requirements.md` or as configured in `config.json`).
2. Extract user personas, route hierarchy, persistent views, and core interactive workflows.
3. **Verify Partner Skills Presence:** Run `bash .agents/skills/uicraft/scripts/install-integrations.sh` to ensure all registered partner skills (`shadcn`, `better-layout`, `responsive-design`, `ui-copywriting`, `webperf`, `web-design-guidelines`, `composition-patterns`, `vercel-react-view-transitions`) are installed in `.agents/skills/`.

### Step 2: Extract Foundations & Author `technicals.md`
1. Read [references/integrations/shadcn.md](./references/integrations/shadcn.md) and [references/philosophy-extraction.md](./references/philosophy-extraction.md).
2. Inspect the project's `components.json` and `globals.css` to identify:
   - The active preset (`style`, `baseColor`, `iconLibrary`, `--radius`).
3. Generate `public/preset-info.md` summarizing the active preset.
4. Generate `public/philosophy.md` defining information density, surface rules, and interaction patterns.
5. Read [references/technicals-specification.md](./references/technicals-specification.md) and author `public/technicals.md`:
   - Identify backend requirements (e.g., Supabase, Auth, Database, Payments).
   - List non-UI package dependencies (`pnpm add ...`).
   - Define domain TypeScript interfaces and typed async service handlers (`lib/services/`).
6. Write `public/config.json`.

### Step 3: Deconstruct into Hierarchical UI Tree
1. Read [references/tree-specification.md](./references/tree-specification.md) and [references/component-schema.md](./references/component-schema.md).
2. Consult [references/integrations/web-design-guidelines.md](./references/integrations/web-design-guidelines.md), [references/integrations/layout-and-alignment.md](./references/integrations/layout-and-alignment.md) (`better-layout`), [references/integrations/responsive-design.md](./references/integrations/responsive-design.md) (`responsive-design`), and [references/integrations/ui-copywriting.md](./references/integrations/ui-copywriting.md) (`ui-copywriting`) for tap target, 2x negative-space hierarchy, shared edge, container adaptivity, and concise, anti-AI microcopy guidelines (headings $\le$ 4 words, subtitles $\le$ 12 words).
3. Create layout specs (`sidebar.md`, `header.md`) and route specs (`[route]/page.md`, `[component].md`).
4. **Enforce Strict Rules on every `.md` file:**
   - Always include the verbatim PRD quote in `## 1. Requirement Traceability`.
   - **Zero style leakage:** Never specify hex codes, pixel dimensions, or hardcoded utility colors.
   - **Zero AI fluff:** Never use bloated buzzwords (*"seamlessly"*, *"empowering"*, *"comprehensive overview"*).
   - Detail hover states, click triggers, empty states, and accessibility attributes.

### Step 4: Audit & Verification
Run the validation script against the output directory:
```bash
bash .agents/skills/uicraft/scripts/validate-ui-tree.sh <output_dir>
# (or via root symlink: bash uicraft/scripts/validate-ui-tree.sh <output_dir>)
```
Ensure 100% of components cite requirements, `technicals.md` exists and is valid, and zero style leaks are detected. The audit MUST pass before proceeding to Step 5.

### Step 5: Autonomous UI Code Generation & Full Verification
Once the UX Tree and technicals pass audit, the agent proceeds immediately to code generation:
1. **Install Technical & UI Dependencies:**
   - Execute package installations specified in `public/technicals.md` (e.g., Supabase client, zod, date-fns).
   - Install required shadcn primitives via `pnpm dlx shadcn@latest add <components...> -y`.
2. **Scaffold Integration-Ready Service Handlers:**
   - Create typed async service handlers in `lib/services/` (or `lib/api/`) matching Section 4 of `public/technicals.md` with realistic mock data and async latency simulation.
3. **Wire Application State:**
   - Connect client state and React Context to the service handlers rather than embedding static inline arrays.
4. **Build Layout Shell & Views (Depth-First):**
   - Step 5a: Build Layout Shell (`layout/shell.md`, `layout/sidebar.md`, `layout/header.md`).
   - Step 5b: Build Feature Routes & Pages (`[route]/page.md`).
   - Step 5c: Build Leaf Components (tables, metric cards, modals, drawers).
   - Apply [references/integrations/layout-and-alignment.md](./references/integrations/layout-and-alignment.md) (`better-layout`), [references/integrations/responsive-design.md](./references/integrations/responsive-design.md) (`responsive-design`), [references/integrations/ui-copywriting.md](./references/integrations/ui-copywriting.md) (`ui-copywriting`), [references/integrations/composition-patterns.md](./references/integrations/composition-patterns.md), and [references/integrations/web-performance.md](./references/integrations/web-performance.md).
   - Style strictly through preset semantic tokens (`bg-card`, `text-foreground`, `border-border`, `font-mono tabular-nums`).
5. **Static Analysis & Lint Verification (`pnpm run lint`):**
   - Run `pnpm run lint` (or project lint script) to verify zero syntax, linting, or typing errors. Address all issues before building.
6. **Compile & Production Build Verification (`pnpm run build`):**
   - Run `pnpm run build` (or project build command) to verify clean compilation with zero TypeScript errors.
7. **Full-App Architecture & Compliance Evaluation (`eval`):**
   - Run `bash .agents/skills/uicraft/scripts/eval-app.sh <project_dir>` and audit both `src/` and `public/` against [references/evaluation-rubric.md](./references/evaluation-rubric.md).
   - Verify 100% spec-to-code alignment, requirement traceability, zero style leaks, and partner skills compliance.

---

## Mode 2: Action Workflow (Structured Mutations)

When modifying an existing project (changing colors, presets, backend services, adding component features, or rebuilding UI), coding agents must **never** edit code directly. Follow [references/action-workflow.md](./references/action-workflow.md):

### Step 1: Match Action & Structured Interview
Match user intent to the [references/actions-catalog.md](./references/actions-catalog.md):
- `action:build-code`: Generate or regenerate application code from an existing, audited `ui-tree/` and `technicals.md`.
- `action:update-technicals`: Modify backend providers, add libraries, or update service handler contracts in `public/technicals.md`.
- `action:update-colors`: Switch shadcn presets (`shadcn apply <preset>`) or tune specific CSS variables in `globals.css`.
- `action:update-philosophy`: Adjust preset geometry (`--radius`), typography scales, or density in `components.json`/`globals.css`.
- `action:modify-component`: Add or modify elements in `ui-tree/` with requirement traceability.

Conduct an interactive interview using `ask_question` to lock in parameters before touching files (if clarification is needed).

### Step 2: Mutate Public Spec Files First (ZERO Code Changes)
Update `public/preset-info.md`, `public/philosophy.md`, `public/technicals.md`, or the targeted `public/ui-tree/**/*.md` files.

### Step 3: Run Audit Gate
```bash
bash .agents/skills/uicraft/scripts/validate-ui-tree.sh <output_dir>
# (or via root symlink: bash uicraft/scripts/validate-ui-tree.sh <output_dir>)
```
Must pass with zero errors before proceeding to code changes.

### Step 4: Synchronize Application Source Code & Verify
1. Install new dependencies or execute corresponding shadcn CLI commands.
2. Update service handlers in `lib/services/` and components in `components/` and `app/`.
3. Run `pnpm run lint` to verify zero linting errors.
4. Run `pnpm run build` to verify clean compilation with zero regressions.
5. Execute full-app evaluation audit: `bash .agents/skills/uicraft/scripts/eval-app.sh <project_dir>` against [references/evaluation-rubric.md](./references/evaluation-rubric.md).
````

## File: README.md
size: 8063
sha: 29d8c89341d88cd7d96f2b3a0616f569a9e6f4b6
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/README.md

````text
# 🎨 `uicraft`: Autonomous UI/UX Architecture Framework for AI Coding Agents

[![Agent Skills Standard](https://img.shields.io/badge/Agent_Skills-Standard_v1-blue.svg)](https://skills.sh)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![shadcn/ui Native](https://img.shields.io/badge/shadcn%2Fui-Native_Tokens-black.svg)](https://ui.shadcn.com)
[![Platform: Cross-Agent](https://img.shields.io/badge/Agents-Antigravity%20%7C%20Claude%20%7C%20Cursor%20%7C%20Codex-purple.svg)](https://skills.sh)

> **`uicraft`** is an open-source architectural meta-framework that transforms how AI coding assistants design and build web applications. It enforces an unstyled, specification-first UI/UX methodology, strictly separates structural information architecture from visual design tokens, and guarantees zero style leaks through automated quality gates.

---

## ⚡ 1-Command Installation

Install `uicraft` into your agent workspace (Antigravity IDE, Claude Code, Cursor, Codex, Windsurf, Amp, or Cline) with a single command:

```bash
npx skills add aicosmo1/uicraft
```

To install globally for all user projects:
```bash
npx skills add aicosmo1/uicraft -g
```

---

## 🛑 The Problem with Agent-Generated UIs

When AI coding agents generate frontends today, they suffer from three universal pitfalls:
1. **Style Leaks & Hallucinated Colors:** Agents inject ad-hoc hex codes (`#3b82f6`) and arbitrary Tailwind utility classes (`bg-blue-600`) scattered across dozens of component files.
2. **Coupled UX & Styling:** Changing a color palette or brand theme breaks structural layouts because visual styling is tightly entangled with information architecture.
3. **Verbose, AI-Fluff Microcopy:** Interfaces get littered with long-winded paragraphs, generic card descriptions, and uninspiring empty states.

---

## 💡 The `uicraft` Solution

`uicraft` decouples UI engineering into two clean, independent tiers:

```mermaid
graph TD
    PRD["📄 Product Requirements (PRD)"] --> UICraft["🎨 uicraft Engine"]
    UICraft --> Specs["📐 Unstyled Spec Layer (public/ui-tree/)"]
    UICraft --> Actions["⚡ Structured Mutations (action:update-colors, etc.)"]
    
    subgraph "Pure Structural Tier"
        Specs --> VSpec["validate-ui-tree.sh (0 Style Leaks)"]
    end
    
    subgraph "Design Token Tier"
        Tokens["🎨 shadcn Tokens & CSS Variables (globals.css)"]
    end
    
    VSpec --> Components["🧱 React Components (components/*)"]
    Tokens --> Components
    
    subgraph "4 Quality Verification Gates"
        Components --> G1["Gate 1: validate-ui-tree.sh"]
        Components --> G2["Gate 2: Zero Style Leak Scan"]
        Components --> G3["Gate 3: pnpm run lint"]
        Components --> G4["Gate 4: pnpm run build"]
    end
    
    G4 --> Shipped["🚀 Production-Grade Clean Web App"]
```

1. **Unstyled UI Trees (`public/ui-tree/`)**: Every component is specified in markdown before any JSX is written. Specs define information hierarchy, state machines, props, and requirement IDs with **zero hardcoded colors**.
2. **Pure Token Binding**: All visual design is delegated to **`shadcn/ui` presets** and semantic CSS variables (`--primary`, `--card`, `--border`, `--foreground`). Swapping an entire brand identity takes 30 seconds by updating CSS variables without touching component markup.
3. **Structured Mutation Actions**: Perform atomic updates to running applications using formal actions (`action:update-colors`, `action:modify-component`, `action:update-philosophy`, `action:update-technicals`, `action:build-code`).
4. **Automated Quality Gates**: Built-in verification scripts enforce spec traceability, run zero-style-leak regex scanners, verify linting, and compile production bundles.

---

## 📦 What's Inside

```
uicraft/
├── SKILL.md                    # Core agent skill instructions (Agent Skills Standard)
├── config.template.json        # Foundational config template for target apps
├── bundled-skills/             # Native bundled skills
│   └── ui-copywriting/         # Concise human-crafted microcopy & anti-AI tone rules
├── references/                 # Deep-dive architecture references
│   ├── action-workflow.md      # Mutation lifecycle & rollback rules
│   ├── actions-catalog.md      # Catalog of all formal actions
│   ├── component-schema.md     # Component spec standard & frontmatter
│   ├── evaluation-rubric.md    # Architecture audit scorecard
│   ├── philosophy-extraction.md# Brand philosophy & design language rules
│   ├── shadcn-integration.md   # Official shadcn integration & preset mapping
│   ├── technicals-specification.md # Engineering constraints & state architecture
│   ├── tree-specification.md   # UI tree decomposition methodology
│   └── integrations/
│       ├── registry.md         # Partner Skills Master Catalog
│       └── ui-copywriting.md   # Microcopy integration guide
└── scripts/                    # Portable quality verification engines
    ├── eval-app.sh             # 4-Gate full-app compliance evaluation
    ├── install-integrations.sh # Autonomous partner skill synchronizer
    └── validate-ui-tree.sh     # Spec validator & style leak scanner
```

---

## 🤝 Partner Skills Ecosystem

`uicraft` natively collaborates with leading agent skills across the open ecosystem:

### 1. Bundled Native Skills
- **`ui-copywriting`** *(Self-contained)*: Enforces human-crafted microcopy standards (headings $\le 4$ words, subtitles $\le 12$ words, front-loaded active verbs, 2-sentence empty states).

### 2. External Ecosystem Integrations
- **`shadcn`** ([`shadcn-ui/ui@shadcn`](https://github.com/shadcn-ui/ui)): Visual presets, Radix primitives, typography.
- **`web-design-guidelines`** ([`vercel-labs/agent-skills@web-design-guidelines`](https://github.com/vercel-labs/agent-skills)): A11y, WCAG contrast, touch targets.
- **`better-layout`** ([`jakubkrehel/skills/skills/better-layout`](https://skills.sh)): Spatial hierarchy, shared edges, baseline alignment.
- **`responsive-design`** ([`wshobson/agents/plugins/ui-design/skills/responsive-design`](https://skills.sh)): Container queries, fluid typography, mobile-first breakpoints.
- **`composition-patterns`** ([`vercel-labs/agent-skills@composition-patterns`](https://github.com/vercel-labs/agent-skills)): Compound components, render props.
- **`webperf`** ([`addyosmani/agent-skills@webperf`](https://github.com/addyosmani/agent-skills)): Core Web Vitals, performance budgets.

To automatically audit and sync partner skills into your project:
```bash
bash .agents/skills/uicraft/scripts/install-integrations.sh
```

---

## 🛡️ The 4 Quality Verification Gates

Run the automated evaluator against any target application:

```bash
bash .agents/skills/uicraft/scripts/eval-app.sh <project_directory>
```

| Gate | Purpose | Standard |
| :--- | :--- | :--- |
| **Gate 1: Specification Integrity** | Audits `public/ui-tree/` | All components trace back to PRD; zero hex codes in markdown |
| **Gate 2: Zero Style Leaks** | Scans application source | Zero inline hex codes (`#[0-9a-f]{3,6}`) and zero hardcoded palette classes |
| **Gate 3: Static Analysis Gate** | Runs `pnpm run lint` | Zero ESLint errors or warnings |
| **Gate 4: Compilation Gate** | Runs `pnpm run build` | Zero compilation or TypeScript build errors |

---

## 🚀 Quick Usage in Your AI Agent

Once installed, simply prompt your AI coding assistant:

> *"Use `uicraft` to build the frontend for this PRD. First establish the unstyled UX Tree in `public/ui-tree/`, run `validate-ui-tree.sh`, and then implement the components using shadcn tokens."*

Or to update styling and component structure without touching logic:

> *"Execute `action:update-colors` using this palette: Gunmetal `#393e41`, Dust Grey `#d3d0cb`, Tuscan Sun `#e7bb41`."*

---

## 📄 License

MIT © [Ali Ahmad](https://github.com/aicosmo1)
````

## File: scripts/eval-app.sh
size: 3899
sha: 7681e84b4715f29167b31955fec5a7e13932e581
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/scripts/eval-app.sh

```text
#!/usr/bin/env bash
set -euo pipefail

# uicraft Full-App Evaluation Audit Script
# Audits both public/ specifications and application source code against uicraft standards.
# Usage: bash eval-app.sh <project_dir>

PROJECT_DIR="${1:-.}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

echo "=========================================================="
echo "🎯 uicraft: Full-App Architecture & Compliance Evaluation"
echo "Project Directory: ${PROJECT_DIR}"
echo "=========================================================="

FAILED=0
PUBLIC_DIR="${PROJECT_DIR}/public"
if [[ ! -d "${PUBLIC_DIR}" && -d "./public" ]]; then
  PUBLIC_DIR="./public"
fi

# 1. Audit public/ UX Tree specifications
echo "1️⃣  Auditing Specifications Layer (public/)..."
if [[ -f "${SCRIPT_DIR}/validate-ui-tree.sh" ]]; then
  if bash "${SCRIPT_DIR}/validate-ui-tree.sh" "${PUBLIC_DIR}"; then
    echo "    ✅ UX Tree & Requirements Traceability Passed."
  else
    echo "    ❌ UX Tree validation failed."
    FAILED=$((FAILED + 1))
  fi
else
  echo "    ⚠️ Warning: validate-ui-tree.sh not found."
fi

# 2. Audit source code for style leaks (hex codes & hardcoded color utilities)
echo "2️⃣  Scanning Source Code for Style Leaks..."
CODE_DIRS=()
for d in "components" "app" "src"; do
  if [[ -d "${PROJECT_DIR}/${d}" ]]; then
    CODE_DIRS+=("${PROJECT_DIR}/${d}")
  fi
done

SRC_HEX_LEAKS=0
SRC_CLASS_LEAKS=0

if [[ ${#CODE_DIRS[@]} -gt 0 ]]; then
  # Scan for inline hex codes in TSX/TS (excluding globals.css or tailwind config)
  HEX_MATCHES=$(grep -rEi --include="*.tsx" --include="*.ts" '#[0-9a-f]{3,6}\b' "${CODE_DIRS[@]}" 2>/dev/null || true)
  if [[ -n "${HEX_MATCHES}" ]]; then
    echo "    ⚠️ Warning: Detected hex color codes in application source code:"
    echo "${HEX_MATCHES}" | head -n 5
    echo "    (Ensure colors are strictly managed via CSS variables in globals.css)"
  else
    echo "    ✅ Zero inline hex codes in component code."
  fi

  # Scan for hardcoded tailwind color classes (bg-blue-500, text-red-600)
  CLASS_MATCHES=$(grep -rEi --include="*.tsx" '\b(bg|text|border)-(red|blue|green|yellow|purple|pink|indigo|emerald|amber|slate|zinc|gray)-[0-9]{2,3}\b' "${CODE_DIRS[@]}" 2>/dev/null || true)
  if [[ -n "${CLASS_MATCHES}" ]]; then
    echo "    ⚠️ Warning: Detected hardcoded Tailwind color utility classes in source code:"
    echo "${CLASS_MATCHES}" | head -n 5
    echo "    (Ensure styling uses semantic tokens: bg-card, text-foreground, border-border)"
  else
    echo "    ✅ Zero hardcoded palette classes in component code."
  fi
else
  echo "    ℹ️  No components/ or app/ source directories found to scan."
fi

# 3. Static Analysis Gate: Linting
echo "3️⃣  Executing Static Analysis Gate (Lint)..."
if grep -q '"lint":' "${PROJECT_DIR}/package.json" 2>/dev/null; then
  echo "    Running pnpm run lint..."
  if (cd "${PROJECT_DIR}" && pnpm run lint); then
    echo "    ✅ Lint gate PASSED with zero errors."
  else
    echo "    ❌ Lint gate FAILED."
    FAILED=$((FAILED + 1))
  fi
else
  echo "    ℹ️  No lint script found in package.json. Skipping."
fi

# 4. Compilation Gate: Production Build
echo "4️⃣  Executing Compilation Gate (Build)..."
if grep -q '"build":' "${PROJECT_DIR}/package.json" 2>/dev/null; then
  echo "    Running pnpm run build..."
  if (cd "${PROJECT_DIR}" && pnpm run build); then
    echo "    ✅ Build gate PASSED with zero errors."
  else
    echo "    ❌ Build gate FAILED."
    FAILED=$((FAILED + 1))
  fi
else
  echo "    ℹ️  No build script found in package.json. Skipping."
fi

echo "=========================================================="
if [[ $FAILED -eq 0 ]]; then
  echo "🎉 EVALUATION PASSED: Application conforms 100% to uicraft standards."
  exit 0
else
  echo "💥 EVALUATION FAILED: Found ${FAILED} error gate(s). Address issues before deployment."
  exit 1
fi
```

## File: scripts/install-integrations.sh
size: 4172
sha: 50f0851bf9dfb2e82f4280fbd8036dc625f6dc2b
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/scripts/install-integrations.sh

```text
#!/usr/bin/env bash
set -euo pipefail

# uicraft Autonomous Skills Registry Synchronizer & Installer
# Distinguishes between:
# 1. External Third-Party Skills: Installed via `npx skills add <package_spec> -y`
# 2. Bundled Native Skills: Self-contained within uicraft/bundled-skills/

TARGET_DIR="${1:-.}"
DRY_RUN=0

for arg in "$@"; do
  if [[ "$arg" == "--dry-run" ]]; then
    DRY_RUN=1
  fi
done

SKILLS_DIR="${TARGET_DIR}/.agents/skills"

# Search up to repo root if not found directly
if [[ ! -d "${SKILLS_DIR}" && -d "./.agents/skills" ]]; then
  SKILLS_DIR="./.agents/skills"
fi

UICRAFT_BUNDLED_DIR="${SKILLS_DIR}/uicraft/bundled-skills"

echo "=========================================="
echo "📦 uicraft: Checking Partner Skills Registry"
echo "Skills Directory:  ${SKILLS_DIR}"
echo "Bundled Directory: ${UICRAFT_BUNDLED_DIR}"
echo "=========================================="

# 1. Bundled Native Skills (Self-Contained inside uicraft)
# Format: "skill_name|description"
BUNDLED_SKILLS=(
  "ui-copywriting|Concise Human-Crafted UI Microcopy & Anti-AI Tone"
)

echo "--- 1. Bundled Native Skills ---"
for item in "${BUNDLED_SKILLS[@]}"; do
  IFS="|" read -r SKILL_NAME DESC <<< "$item"
  
  if [[ -e "${SKILLS_DIR}/${SKILL_NAME}" || -L "${SKILLS_DIR}/${SKILL_NAME}" ]]; then
    echo "  ✅ Bundled & Active: ${SKILL_NAME} (${DESC})"
  else
    echo "  📦 Linking Bundled Skill: ${SKILL_NAME} -> uicraft/bundled-skills/${SKILL_NAME}"
    if [[ $DRY_RUN -eq 0 ]]; then
      if [[ -d "${UICRAFT_BUNDLED_DIR}/${SKILL_NAME}" ]]; then
        (cd "${SKILLS_DIR}" && ln -s "uicraft/bundled-skills/${SKILL_NAME}" "${SKILL_NAME}")
        echo "     ✨ Successfully linked bundled skill: ${SKILL_NAME}"
      else
        echo "     ❌ Error: Bundled skill source not found at ${UICRAFT_BUNDLED_DIR}/${SKILL_NAME}"
      fi
    else
      echo "     [Dry-run] Would link: ${SKILLS_DIR}/${SKILL_NAME} -> uicraft/bundled-skills/${SKILL_NAME}"
    fi
  fi
done

# 2. External Third-Party Skills (Managed via npx skills add)
# Format: "skill_dir_name|package_spec|description"
EXTERNAL_SKILLS=(
  "shadcn|shadcn-ui/ui@shadcn|Official shadcn/ui Presets & Primitives"
  "webperf|addyosmani/agent-skills@webperf|Addy Osmani Core Web Vitals & Web Performance"
  "agent-skills|addyosmani/agent-skills|Addy Osmani Engineering Suite & Code Review"
  "web-design-guidelines|vercel-labs/agent-skills@web-design-guidelines|Vercel Web Design, A11y & Contrast Guidelines"
  "better-layout|jakubkrehel/skills/skills/better-layout|Unstyled Spatial Hierarchy, Shared Edges & Baseline Alignment"
  "responsive-design|wshobson/agents/plugins/ui-design/skills/responsive-design|Container Queries, Fluid Grids & Breakpoint Adaptivity"
  "composition-patterns|vercel-labs/agent-skills@composition-patterns|Vercel React Composition & Compound Components"
  "vercel-react-view-transitions|vercel-labs/agent-skills@vercel-react-view-transitions|Vercel React View Transitions"
)

echo "--- 2. External Third-Party Skills ---"
MISSING_EXTERNAL=0

for item in "${EXTERNAL_SKILLS[@]}"; do
  IFS="|" read -r SKILL_DIR PKG_SPEC DESC <<< "$item"
  
  if [[ -e "${SKILLS_DIR}/${SKILL_DIR}" || -L "${SKILLS_DIR}/${SKILL_DIR}" ]]; then
    echo "  ✅ Installed: ${SKILL_DIR} (${DESC})"
  else
    echo "  ⚠️ Missing External Skill: ${SKILL_DIR} -> ${PKG_SPEC}"
    MISSING_EXTERNAL=$((MISSING_EXTERNAL + 1))
    
    if [[ $DRY_RUN -eq 0 ]]; then
      echo "     🚀 Installing via: npx skills add ${PKG_SPEC} -y ..."
      npx skills add "${PKG_SPEC}" -y || {
        echo "     ⚠️ Note: Installation command completed with status $?. Proceeding."
      }
    else
      echo "     [Dry-run] Would execute: npx skills add ${PKG_SPEC} -y"
    fi
  fi
done

echo "=========================================="
if [[ $MISSING_EXTERNAL -eq 0 ]]; then
  echo "🎉 All partner skills (Bundled & External) are active and ready in ${SKILLS_DIR}."
else
  if [[ $DRY_RUN -eq 1 ]]; then
    echo "🔍 Dry-run complete. ${MISSING_EXTERNAL} external partner skill(s) missing."
  else
    echo "✨ Completed external skills synchronization."
  fi
fi
echo "=========================================="
```

## File: scripts/validate-ui-tree.sh
size: 3425
sha: 2cfb8e8b834dd5f012d6fd7b0b2243980321cffb
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/scripts/validate-ui-tree.sh

```text
#!/usr/bin/env bash
set -euo pipefail

# uicraft UI Tree Validation Script (shadcn-Native)
# Usage: bash validate-ui-tree.sh <target_dir>

TARGET_DIR="${1:-.}"
if [[ -d "${TARGET_DIR}/public/ui-tree" ]]; then
  TARGET_DIR="${TARGET_DIR}/public"
fi

echo "========================================"
echo "🔍 uicraft: Validating UX Architecture"
echo "Target Directory: ${TARGET_DIR}"
echo "========================================"

FAILED=0

# 1. Check foundational files
echo -n "Checking foundational files (config.json, philosophy.md, technicals.md)... "
FOUND_MISSING=0
for FILE in "config.json" "philosophy.md"; do
  if [[ ! -f "${TARGET_DIR}/${FILE}" ]]; then
    echo -e "\n  ❌ Missing required file: ${TARGET_DIR}/${FILE}"
    FOUND_MISSING=1
    FAILED=1
  fi
done

# Check technicals.md if configured or present
if [[ -f "${TARGET_DIR}/technicals.md" ]]; then
  # Verify technicals.md has no style leaks
  TECH_LEAKS=$(grep -rEi '#[0-9a-f]{3,6}\b' "${TARGET_DIR}/technicals.md" || true)
  if [[ -n "${TECH_LEAKS}" ]]; then
    echo -e "\n  ❌ Detected hex color codes in technicals.md:"
    echo "${TECH_LEAKS}"
    FAILED=1
  fi
elif grep -q '"technicalsFile"' "${TARGET_DIR}/config.json" 2>/dev/null; then
  echo -e "\n  ❌ Missing configured technicals.md: ${TARGET_DIR}/technicals.md"
  FOUND_MISSING=1
  FAILED=1
fi

if [[ $FOUND_MISSING -eq 0 && $FAILED -eq 0 ]]; then
  echo "✅ OK"
fi

# 2. Check UI Tree directory existence
TREE_DIR="${TARGET_DIR}/ui-tree"
if [[ ! -d "${TREE_DIR}" ]]; then
  echo "❌ Missing ui-tree directory at: ${TREE_DIR}"
  exit 1
fi

# 3. Check for style leaks in all ui-tree markdown files
echo -n "Scanning ui-tree for style leaks (hex codes, hardcoded color classes)... "
LEAKS=0

# Regex for hex colors (#123, #123456)
HEX_MATCHES=$(grep -rEi --include="*.md" '#[0-9a-f]{3,6}\b' "${TREE_DIR}" || true)
if [[ -n "${HEX_MATCHES}" ]]; then
  echo -e "\n  ❌ Detected hex color codes in UI tree:"
  echo "${HEX_MATCHES}"
  LEAKS=1
  FAILED=1
fi

# Regex for direct tailwind color classes (e.g. bg-blue-500, text-red-600)
CLASS_MATCHES=$(grep -rEi --include="*.md" '\b(bg|text|border)-(red|blue|green|yellow|purple|pink|indigo|emerald|amber|slate|zinc|gray)-[0-9]{2,3}\b' "${TREE_DIR}" || true)
if [[ -n "${CLASS_MATCHES}" ]]; then
  echo -e "\n  ❌ Detected hardcoded Tailwind color utility classes in UI tree:"
  echo "${CLASS_MATCHES}"
  LEAKS=1
  FAILED=1
fi

if [[ $LEAKS -eq 0 ]]; then
  echo "✅ Zero style leaks detected (Visual styling cleanly delegated to shadcn)"
fi

# 4. Check Requirement Traceability in all component specs
echo -n "Verifying Requirement Traceability in component files... "
MISSING_TRACE=0
TOTAL_SPECS=0

while IFS= read -r FILE; do
  TOTAL_SPECS=$((TOTAL_SPECS + 1))
  # Check if Section 1 exists and has a blockquote
  if ! grep -q "## 1. Requirement Traceability" "$FILE" || ! grep -q "^>" "$FILE"; then
    echo -e "\n  ❌ File missing requirement traceability blockquote: ${FILE}"
    MISSING_TRACE=$((MISSING_TRACE + 1))
    FAILED=1
  fi
done < <(find "${TREE_DIR}" -type f -name "*.md")

if [[ $MISSING_TRACE -eq 0 ]]; then
  echo "✅ All ${TOTAL_SPECS} specs trace back to requirements"
fi

echo "========================================"
if [[ $FAILED -eq 0 ]]; then
  echo "🎉 Validation PASSED: UX Tree conforms to uicraft specifications."
  exit 0
else
  echo "💥 Validation FAILED: Address the issues above."
  exit 1
fi
```

## File: references/action-workflow.md
size: 2418
sha: 29f1504e467e2ffb2dd2956f01bccbdf18f8379c
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/action-workflow.md

````text
# `uicraft` Action Execution Runbook

This document defines the strict, non-negotiable step-by-step workflow coding agents must follow when executing an action command.

---

## The 4-Step Action Lifecycle

```text
[User Request]
       │
       ▼
[Step 1: Match Action & Structured Interview]
  - Identify action from actions-catalog.md
  - Ask user structured questions (using ask_question tool or clear modal)
  - Lock in parameters before touching files
       │
       ▼
[Step 2: Mutate Public Spec Files (ZERO CODE CHANGES)]
  - Edit public/philosophy.md, public/colors.md, or public/ui-tree/**/*.md
  - Keep zero inline color classes in ui-tree
  - Preserve requirement traceability
       │
       ▼
[Step 3: Run Automated Audit]
  - Execute: bash uicraft/scripts/validate-ui-tree.sh <output_dir>
  - Must pass with 0 errors before proceeding
       │
       ▼
[Step 4: Propagate to Application Source Code & Verify]
  - Update CSS variables, Tailwind tokens, or component files in src/ / app/ / components/
  - Run lint verification: pnpm run lint
  - Run build command: pnpm run build
  - Run full-app evaluation: bash uicraft/scripts/eval-app.sh <project_dir>
  - Verify zero TypeScript, lint, or architectural regressions
```

---

## Detailed Rules per Step

### Rule 1: No Unclarified Edits
Never guess visual preferences when a user asks for a design change (e.g., "make fonts bigger"). Always clarify the target scale, boundaries, and scope using the questionnaire defined in [actions-catalog.md](./actions-catalog.md).

### Rule 2: Spec Invariant (Specs Precede Code)
Never touch `.tsx`, `.ts`, or `.css` files before the markdown specification files in `public/` reflect the intended change. The `public/` directory is the single source of truth for the project's design system and UI architecture.

### Rule 3: Tree Audit Gate
Always run `validate-ui-tree.sh` immediately after editing any markdown file in `public/`. If the script reports a style leak or missing requirement trace, fix the specification immediately before touching any code.

### Rule 4: Verification & Evaluation Gate
Always execute `pnpm run lint` followed by `pnpm run build` after updating code. Following a clean build, execute `bash uicraft/scripts/eval-app.sh <project_dir>` and audit both `public/` and `src/` against [evaluation-rubric.md](./evaluation-rubric.md) to confirm 100% architectural compliance.
````

## File: references/actions-catalog.md
size: 6606
sha: d9c80d9ca034d36d2bd3ac2d439f7fe940af27b0
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/actions-catalog.md

```text
# `uicraft` Actions Catalog

This catalog defines the official registry of structured mutation actions supported by `uicraft`. In all actions, **specifications in `public/` must be updated and audited before touching application source code**.

---

## 1. `action:build-code` (alias: `action:generate-ui`)

### Purpose
Autonomously generate or regenerate application source code in `components/` and `app/` (or `src/`) directly from the existing, audited `public/ui-tree/`, `public/preset-info.md`, and `public/philosophy.md`.

### Triggers
- "Build the code in src"
- "Generate UI from public ui-tree"
- "action:build-code"
- "action:generate-ui"

### Execution Flow
1. Verify audit: Ensure `bash uicraft/scripts/validate-ui-tree.sh <output_dir>` passes.
2. Install primitives: Scan component specs for shadcn primitives and run `pnpm dlx shadcn@latest add <primitives...> -y`.
3. Traverse `ui-tree/` depth-first:
   - Shell & Navigation (`layout/shell.md`, `layout/sidebar.md`, `layout/header.md`)
   - Route pages (`[route]/page.md`)
   - Leaf components (tables, cards, modals, sheets)
4. Verify lint: Run `pnpm run lint` and ensure zero linting errors.
5. Verify build: Run `pnpm run build` and ensure zero compilation errors.
6. Evaluate compliance: Run `bash uicraft/scripts/eval-app.sh <project_dir>` and audit against `references/evaluation-rubric.md`.

---

## 2. `action:update-colors`

### Purpose
Update the visual theme, colors, or palette preset using shadcn's preset architecture or semantic CSS variables.

### Triggers
- "Change the theme / apply a new preset"
- "Update primary color / change brand accent"
- "Switch between dark and light mode"
- "Apply preset buFywKm or b0"

### Structured Questionnaire Template
1. **Mutation Type:**
   - **Preset-Level Switch (Recommended):** Apply a complete preset code or URL from [ui.shadcn.com/create](https://ui.shadcn.com/create) (e.g., `buFywKm`, `b0`).
   - **Token-Level Tuning:** Adjust a specific semantic variable (e.g. `--primary`, `--accent`, `--destructive`) directly in `globals.css`.
2. **Parameters:**
   - If preset: What is the preset code or URL?
   - If token: What is the target color (OKLCH, HSL, or hex)?
3. **Theme Target:** Applies to light mode (`:root`), dark mode (`.dark`), or both?

### Target Spec Files
- `public/preset-info.md`
- `public/philosophy.md`

### Downstream Code Targets
- If preset switch: Run `pnpm dlx shadcn@latest apply <preset> --yes`
- If token tuning: Update `:root` / `.dark` CSS variables in `app/globals.css`
- Run `pnpm run lint` and `pnpm run build`
- Run evaluation audit: `bash uicraft/scripts/eval-app.sh <project_dir>`

---

## 3. `action:update-philosophy`

### Purpose
Update global architectural rules, geometry (border radius), information density, or component styling convention.

### Triggers
- "Change border radiuses across all cards and buttons"
- "Make the interface more compact / denser"
- "Switch component style (e.g. to base-nova, new-york, or default)"
- "Update typography hierarchy rules"

### Structured Questionnaire Template
1. **Target Dimension:**
   - Component Geometry: Change base border radius (`--radius`).
   - Information Density: Adjust padding/spacing standards (`p-4` vs `p-6`, compact table rows).
   - Component Style: Switch style in `components.json` (`base-nova`, `new-york`, `default`).
   - Typography Hierarchy: Update scaling standards in `philosophy.md`.
2. **Scope:** Does this apply to all cards, tables, and buttons globally?

### Target Spec Files
- `public/philosophy.md`
- `public/preset-info.md`

### Downstream Code Targets
- `components.json` (if style changes)
- `app/globals.css` (if `--radius` or font variables change)
- Shared layouts and components in `components/` and `app/`
- Run `pnpm run lint` and `pnpm run build`
- Run evaluation audit: `bash uicraft/scripts/eval-app.sh <project_dir>`

---

## 4. `action:modify-component`

### Purpose
Add, remove, or modify elements, layout positioning, interactive states, or user flows in a specific component spec in `ui-tree/`.

### Triggers
- "Add a filter dropdown to the incident table"
- "Add an export button to the header"
- "Modify the notification drawer layout"
- "Add a new metric card to the overview dashboard"

### Structured Questionnaire Template
1. **Target Component:** Which component in `ui-tree/` is being modified?
2. **Requirement Traceability:** What verbatim line from `requirements.md` (or new requirement) justifies this addition?
3. **States & Interactions:** What are the default, hover, active, loading, and empty states?
4. **Recommended shadcn Primitive:** Which primitive from `@/components/ui/` should be used (e.g. `Dialog`, `DropdownMenu`, `Sheet`, `Table`)?

### Target Spec Files
- `public/ui-tree/[path]/[component].md`

### Downstream Code Targets
- The corresponding component in `components/` or `app/`
- Run `pnpm dlx shadcn@latest add <component> -y` if a new primitive is required
- Run `pnpm run lint` and `pnpm run build`
- Run evaluation audit: `bash uicraft/scripts/eval-app.sh <project_dir>`

---

## 5. `action:update-technicals`

### Purpose
Add, modify, or swap backend data providers (e.g., Supabase, Neon, Prisma, Firebase), register new external utility libraries (e.g., `zod`, `date-fns`), or update typed domain contracts and async service handlers in `public/technicals.md`.

### Triggers
- "Add Supabase backend integration"
- "Switch database provider to Prisma / PostgreSQL"
- "Add validation library zod"
- "Update webhook dispatch service handler contract"
- "action:update-technicals"

### Structured Questionnaire Template
1. **Target Technical Layer:**
   - Backend / BaaS Provider: (e.g. Supabase, Firebase, Neon, Prisma, REST API)
   - Authentication Provider: (e.g. Supabase Auth, Clerk, NextAuth)
   - Utility / Data Library: (e.g. `zod`, `date-fns`, `recharts`, `tanstack/react-query`)
2. **Package Modifications:** Which npm packages must be installed or uninstalled?
3. **Data Contracts & Handlers:** What TypeScript models and service handler signatures (`lib/services/*.ts`) need to be added or updated?
4. **Environment Variables:** What secret or public keys are required?

### Target Spec Files
- `public/technicals.md`
- `public/config.json`

### Downstream Code Targets
- Run package manager: `pnpm add <packages...>`
- Update service handler definitions in `lib/services/*`
- Update application context or server action bindings
- Run `pnpm run lint` and `pnpm run build` to verify clean compilation with zero regressions
- Run evaluation audit: `bash uicraft/scripts/eval-app.sh <project_dir>`

```

## File: references/component-schema.md
size: 2292
sha: 0e0908994baa219ffad5f158aef7f5a686db3d31
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/component-schema.md

````text
# Component Specification Schema

Every component in the `ui-tree/` hierarchy must conform to this schema.

## Format Specification

```markdown
# Component: [Component Name]
**Path:** `[ui-tree relative path, e.g. ui-tree/dashboard/stats-grid.md]`
**Parent:** `[Parent container or layout, e.g. ui-tree/dashboard/page.md]`

## 1. Requirement Traceability
> "[Exact verbatim quotation from requirements.md]"
*(Optional: Note explaining the business goal or user role)*

## 2. Semantic Role & Layout Placement
- **Component Type:** [e.g., Card Grid, Data Table, Navigation Item, Sheet Drawer]
- **Placement:** [Exact location within parent, e.g. Top row of main content area, sticky header right side]
- **Recommended Primitive:** [shadcn component, e.g. Card, Table, Badge, Tooltip, Sheet]

## 3. Structural Elements & Hierarchy
- [Element 1]: [Semantic type, displayed data, icon, label]
- [Element 2]: [Semantic type, displayed data, icon, label]
- [Child Subcomponents]: [Pointers to nested component files if applicable]

## 4. State & Interactions
- **Default State:** [Initial view, data display]
- **Hover / Focus:** [Hover highlights, tooltip text, keyboard focus outlines]
- **Active / Trigger:** [Click behavior, route change, modal trigger, acknowledgment flow]
- **Empty / Loading / Error:** [Skeleton loaders, zero-data illustration, retry prompts]

## 5. Accessibility & Semantics
- **ARIA Roles:** [e.g. role="status", role="alert", role="navigation"]
- **Keyboard Shortcuts:** [e.g. Tab order, Enter/Space activation, Esc to dismiss]
```

## Anti-Pattern Checklist (Must Pass)
- ❌ **No hex codes** (`#ffffff`, `#000000`, etc.)
- ❌ **No direct styling classes** (`bg-blue-600`, `text-red-500`, `font-bold text-xl`)
- ❌ **No pixel dimensions** (`width: 320px`, `margin-top: 15px`)
- ❌ **No bloated AI marketing copy** (*"seamlessly"*, *"empowering"*, *"comprehensive overview"*, *"robust"*)
- ❌ **No overly long headings or descriptions** (Headings must be $\le$ 4 words; subtitles $\le$ 12 words)
- ✅ **All styles deferred to global semantic tokens** (`bg-card`, `text-foreground`, `border-border`)
- ✅ **Must have verbatim quote in Section 1**
- ✅ **Concise, human-crafted microcopy (`ui-copywriting`):** Action-first verbs on buttons, 2-sentence empty states
````

## File: references/evaluation-rubric.md
size: 6410
sha: c7c6b3abccca807aac6e1cc370112bf1869d595f
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/evaluation-rubric.md

````text
# `uicraft`: Full-App Architecture & Compliance Evaluation Rubric

This document defines the official **Evaluation Rubric** that coding agents must execute after completing code generation and verifying `pnpm run build`. 

The goal of this evaluation is to perform an end-to-end audit of both the **specification layer (`public/`)** and the **application source code (`src/` / `app/` / `components/` / `lib/`)** to guarantee 100% compliance with `uicraft` architectural standards and partner skills.

---

## The 7 Evaluation Dimensions

| Dimension | Scope | Target Standard | Partner Skill Reference |
| :--- | :--- | :--- | :--- |
| **1. Spec-to-Code Alignment** | `public/ui-tree/` $\leftrightarrow$ `components/` | 100% parity. Every spec is implemented; zero orphaned specs or components. | [tree-specification.md](./tree-specification.md) |
| **2. Requirement Traceability** | `public/requirements.md` $\leftrightarrow$ Specs | 100% of specs cite verbatim PRD lines. Feature workflows match requirements. | [component-schema.md](./component-schema.md) |
| **3. Design Token Invariant** | `globals.css` $\leftrightarrow$ Code | Zero inline hex codes (`#123456`) or arbitrary utility colors (`bg-blue-500`). | [shadcn.md](./integrations/shadcn.md) |
| **4. Spatial Layout & Edges** | Components & Layout | 2× spacing ratio, optical baseline alignment, control clearance, no flex blowout (`min-w-0`). | [layout-and-alignment.md](./integrations/layout-and-alignment.md) |
| **5. Container Adaptivity** | Grids & Wrappers | `@container` queries on parent wrappers, intrinsic tracks (`minmax(280px, 1fr)`). | [responsive-design.md](./integrations/responsive-design.md) |
| **6. Microcopy & Anti-AI Tone** | Headings & UI text | Headings $\le$ 4 words, subtitles $\le$ 12 words, active verbs, 2-sentence empty states, zero AI fluff. | [ui-copywriting.md](./integrations/ui-copywriting.md) |
| **7. Integration Handlers** | `lib/services/` $\leftrightarrow$ UI | Typed async handlers in `lib/services/`, realistic mock data, zero static mock arrays in UI. | [technicals-specification.md](./technicals-specification.md) |

---

## Detailed Evaluation Checklist

### Dimension 1: Spec-to-Code Alignment & Tree Integrity
- [ ] Every component file in `public/ui-tree/**/*.md` has a corresponding React component in `components/` or `app/`.
- [ ] Route structures in `app/` (or `src/routes/`) mirror the directory structure in `public/ui-tree/`.
- [ ] No extraneous, untracked component files exist without an architectural spec in `ui-tree/`.

### Dimension 2: Requirement Traceability
- [ ] Every markdown spec in `public/ui-tree/` includes Section 1 with a verbatim quotation citing `requirements.md`.
- [ ] Every leaf component and interactive trigger satisfies the verbatim user flow prescribed in the PRD.

### Dimension 3: Design Token Invariant (Zero Style Leaks)
- [ ] `validate-ui-tree.sh` passes with 0 style leaks detected.
- [ ] Source code uses semantic tokens exclusively: `bg-card`, `bg-background`, `text-foreground`, `text-muted-foreground`, `border-border`, `bg-primary`, `bg-secondary`, `bg-destructive`.
- [ ] Zero inline hex colors exist in `.tsx` files (except in dedicated SVG chart definitions or CSS variable declarations in `globals.css`).
- [ ] Zero ad-hoc color classes (e.g. `text-red-500`, `bg-blue-600`, `border-green-400`)—all state colors use semantic badge variants (`variant="destructive"`, `variant="outline"`, `variant="secondary"`).

### Dimension 4: Spatial Hierarchy & Shared Edges (`better-layout`)
- [ ] **Optical Baseline Alignment:** All icon-and-label pairings use `inline-flex items-center gap-1.5` with explicit sizes (`size-3.5` or `size-4`).
- [ ] **2× Spacing Ratio Rule:** The gap between distinct component sections is at least 2× the internal gap (e.g., `gap-2` inside controls, `gap-6` between cards).
- [ ] **Equal-Height Tracks:** Multi-column card rows use `grid auto-rows-fr` and children declare `h-full flex flex-col justify-between`.
- [ ] **Control Clearance:** Bordered controls maintain $\ge$ 12px clearance (`gap-3`); borderless action buttons maintain $\ge$ 20px clearance (`gap-5`).
- [ ] **Flex Blowout Safeguard:** Every flex item displaying truncated text or monospace numbers declares `min-w-0`.

### Dimension 5: Responsive Adaptivity (`responsive-design`)
- [ ] Major composite containers declare `@container` on their parent wrapper.
- [ ] Multi-column grids declare intrinsic sizing (`grid-cols-[repeat(auto-fit,minmax(280px,1fr))]` or container breakpoints `@md:`, `@lg:`).
- [ ] Tables include horizontal overflow containment (`overflow-x-auto min-w-[...]`).
- [ ] Progressive disclosure collapses secondary metadata into tooltips or icons on compact screens.

### Dimension 6: UI Microcopy & Anti-AI Tone (`ui-copywriting`)
- [ ] **Headings:** All page headings and card titles are $\le$ 4 words (*"Keyword Guardian"*, *"Budget Pacing"*).
- [ ] **Subtitles:** All card descriptions are $\le$ 12 words in a single concise sentence.
- [ ] **Action Triggers:** All button labels start with an active imperative verb (*"Export CSV"*, *"Sync Keywords"*) and are 2–3 words.
- [ ] **Zero AI Fluff:** Purged all buzzwords: *"seamlessly"*, *"empowering"*, *"comprehensive overview"*, *"robust"*, *"single pane of glass"*, *"delve into"*.
- [ ] **Empty States:** Exactly 2 sentences: Sentence 1 (What is absent) + Sentence 2 (What action to take).

### Dimension 7: Integration Handlers (`technicals.md`)
- [ ] Typed domain interfaces exist in `lib/types/` matching Section 3 of `technicals.md`.
- [ ] Typed async service handlers exist in `lib/services/` matching Section 4 of `technicals.md`.
- [ ] UI components read data from services or context providers, with zero static mock arrays hardcoded directly in JSX templates.

---

## Evaluation Gate Protocol

When completing Step 5 of Scaffold Workflow or Step 4 of Action Workflow:

1. **Lint Verification:**
   ```bash
   pnpm run lint
   ```
   *Must exit with code 0 (zero ESLint errors or unhandled warnings).*

2. **Build Verification:**
   ```bash
   pnpm run build
   ```
   *Must exit with code 0 (zero TypeScript errors, clean bundle compilation).*

3. **Evaluation Audit Execution:**
   ```bash
   bash .agents/skills/uicraft/scripts/eval-app.sh <project_dir>
   ```
   *Review all 7 dimensions and provide a structured Evaluation Scorecard in the final walkthrough report.*
````

## File: references/integrations/composition-patterns.md
size: 1966
sha: 6a9edd25001d83e3dd639613878fb363e61613a0
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/composition-patterns.md

````text
# `uicraft` Integration: React Composition Patterns (`composition-patterns`)

`uicraft` integrates with **`composition-patterns`** (from Vercel Labs) to ensure generated React components avoid rigid prop-drilling and leverage modern compound component architectures.

---

## 1. Skill Reference & Installation

- **Skill Name:** `composition-patterns`
- **Source Repository:** `https://github.com/vercel-labs/agent-skills.git` (`@composition-patterns`)
- **Local Location:** `.agents/skills/composition-patterns/`
- **Installation Command:**
  ```bash
  npx skills add vercel-labs/agent-skills@composition-patterns -y
  ```

---

## 2. Core Architectural Patterns

### 1. Compound Component Architecture
Instead of "monster components" that take 30 arbitrary props (`<Card title="..." hasButton buttonIcon="..." />`), `uicraft` decomposes components into composable primitives:
```tsx
<Card>
  <CardHeader>
    <CardTitle>Recent Transactions</CardTitle>
    <CardDescription>Live telemetry stream</CardDescription>
  </CardHeader>
  <CardContent>
    <TransactionTable />
  </CardContent>
</Card>
```

### 2. State Encapsulation via Context
- Global domain state (such as active environment, search queries, active keys, or webhook endpoints) lives in dedicated providers (`context/gateway-context.tsx`).
- Individual leaf components consume only the specific hooks they need (`useGatewayContext()`), eliminating deep prop drilling.

### 3. Slot Patterns & Headless Decoupling
- Components accept `children` or render slots rather than hardcoding child markup.
- For triggers and overlays, components expose triggers (e.g. `<DialogTrigger>`, `<SheetTrigger>`) that wrap interactive elements seamlessly.

---

## 3. Application in `uicraft` Tree Specs

In `public/ui-tree/**/*.md`:
- `## 3. Structural Elements & Hierarchy` details the child slots and compound pieces.
- Specifications explicitly mandate compound decomposition rather than monolithic configurations.
````

## File: references/integrations/engineering-suite.md
size: 2229
sha: 0ebcf3c3d0425538d3e5ff88eb9b1dc767511f5c
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/engineering-suite.md

````text
# `uicraft` Integration: Addy Osmani Engineering Suite (`agent-skills`)

`uicraft` integrates with **`addyosmani/agent-skills`**, a collection of production-grade engineering workflows maintained by Google Chrome engineering lead Addy Osmani.

---

## 1. Skill Reference & Installation

- **Skill Name:** `agent-skills`
- **Source Repository:** `https://github.com/addyosmani/agent-skills.git`
- **Local Location:** `.agents/skills/agent-skills/`
- **Installation Command:**
  ```bash
  npx skills add addyosmani/agent-skills -y
  ```

---

## 2. Workflows Leveraged by `uicraft`

The Addy Osmani Engineering Suite provides core disciplines that reinforce `uicraft`'s architectural rigor:

### 1. Spec-Driven Engineering (`/spec`)
- **Principle:** Never touch production code without an explicit specification.
- **In `uicraft`:** This is the bedrock of `uicraft`. PRDs (`requirements.md`) are deconstructed into atomic, traceable component markdown specifications before any code is generated in Step 5.

### 2. Atomic Planning (`/plan`)
- **Principle:** Break multi-step features into small, testable, and reviewable tasks.
- **In `uicraft`:** The hierarchical UI tree naturally divides work into isolated units:
  - Layout Shell -> Feature Pages -> Reusable Cards -> Interactive Modals/Drawers.
  - Each `.md` spec file is small, focused, and self-contained (under 50 lines).

### 3. Rigorous Code Health & Review (`/review`)
- **Principle:** Eliminate anti-patterns, leaky abstractions, memory leaks, and excessive re-renders.
- **In `uicraft`:** During Step 5, coding agents apply the `/review` checklist:
  - Clean TypeScript interfaces.
  - Proper React Hook dependencies.
  - Elimination of magic numbers or hardcoded inline styles.
  - Proper cleanup in `useEffect` and timer listeners (e.g. `clearTimeout` on copied feedback).

---

## 3. Integration Checklist for Coding Agents

When executing Step 5 under `uicraft`, the agent verifies:
- [ ] Every component has an unambiguous TypeScript interface exported.
- [ ] No component exceeds 250 lines of code; complex views decompose into leaf files.
- [ ] State mutations are predictable and isolated.
- [ ] Memory leaks from intervals or observers are cleanly disposed.
````

## File: references/integrations/layout-and-alignment.md
size: 2063
sha: 5a4f459a230d5b2f7917e289d8aec745c67ef7fd
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/layout-and-alignment.md

```text
# `uicraft` Integration: Spatial Layout, Alignment & Shared Edges (`better-layout`)

This reference defines how `uicraft` integrates with the `better-layout` partner skill to ensure composite UI layouts assemble with pixel-perfect alignment and robust spatial hierarchy.

---

## 1. Division of Responsibility

| Domain | Responsible Skill | Enforcement |
| :--- | :--- | :--- |
| **Theme, Colors & Radii** | `shadcn/ui` & `globals.css` | `--primary`, `--background`, `--radius`, `--card` semantic tokens. |
| **UX Architecture & Tree** | `uicraft` | Product requirements, route mapping, component hierarchy, unstyled markdown specs. |
| **Spatial Alignment & Geometry** | **`better-layout`** | Shared edges, 2× negative space ratio, optical baselines, control clearance. |

---

## 2. Rules Enforced During Step 3 (Tree Deconstruction)

When generating unstyled component specs in `public/ui-tree/`:
1. **Specify Spatial Relationships, Not CSS Hex/Colors:**
   - Define whether elements share an edge or are inset.
   - Prescribe negative-space groupings (e.g. "Action buttons grouped with 12px clearance, separated from content by 24px margin").
2. **Never leak style properties:** Never write background colors, hex codes, or arbitrary borders in `ui-tree/`.

---

## 3. Rules Enforced During Step 5 (Code Generation)

When the coding agent writes composite components:
1. **Optical Baseline Alignment:**
   - Icons paired with text must use `inline-flex items-center gap-1.5` with explicit sizes (`size-3.5` or `size-4`) so icons never sit 2px above or below the text baseline.
2. **Equal-Height Card Tracks:**
   - Any multi-column card row must use `grid auto-rows-fr` or flex `h-full flex-col justify-between` to ensure sibling cards share identical bottom edges.
3. **Flex Blowout Safeguard:**
   - Any flex element containing truncated text must declare `min-w-0` to prevent overflowing its container bounds.
4. **Control Clearance:**
   - Adjacent borderless icon buttons must have `gap-4` to `gap-5` (minimum 20px) to prevent overlapping tap targets.
```

## File: references/integrations/registry.md
size: 6305
sha: 06c118178d7665b4a98f24491a699bf68f5018da
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/registry.md

````text
# `uicraft`: Integrations Skill Registry

`uicraft` operates as an open UX & architectural orchestrator. Rather than duplicating existing industry guidelines or hardcoding external rules, `uicraft` integrates with official and community **Agent Skills** managed via the `skills` CLI ecosystem (`npx skills add`).

---

## 1. Architectural Philosophy: Reference Over Duplication

1. **Self-Contained Modularity:** Partner skills live in `.agents/skills/<skill-name>/` with their own `SKILL.md` definitions, references, and scripts.
2. **Zero Bloat:** `uicraft` maintains **boundary contracts** and references to these skills. When a task requires performance budgets, accessibility audits, or compound component patterns, the agent dynamically consults the corresponding installed skill.
3. **Autonomous Presence:** `uicraft` includes an automated check script [`install-integrations.sh`](../../scripts/install-integrations.sh). If any registered partner skill is not yet installed in `.agents/skills/`, `uicraft` can autonomously install it using `npx skills add`.

---

## 2. Master Integrations Catalog

### A. External Ecosystem Skills (Installed via `npx skills add`)
| Partner Skill | Package Spec / Origin | Focus & Rule Enforcement | Dedicated Guide |
| :--- | :--- | :--- | :--- |
| **`shadcn`** | [`shadcn-ui/ui@shadcn`](https://github.com/shadcn-ui/ui) | Visual presets (`--preset`), base color tokens, Base UI / Radix primitives, typography. | [shadcn.md](./shadcn.md) |
| **`webperf`** | [`addyosmani/agent-skills@webperf`](https://github.com/addyosmani/agent-skills) | Core Web Vitals (LCP, INP, CLS), zero layout shifts, lazy loading drawers, hydration optimization. | [web-performance.md](./web-performance.md) |
| **`agent-skills`** | [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) | Spec-driven engineering (`/spec`), code quality reviews (`/review`), architecture cleanliness. | [engineering-suite.md](./engineering-suite.md) |
| **`web-design-guidelines`** | [`vercel-labs/agent-skills@web-design-guidelines`](https://github.com/vercel-labs/agent-skills) | Accessibility (WCAG AA), minimum 44px tap targets, focus trapping, screen-reader semantics. | [web-design-guidelines.md](./web-design-guidelines.md) |
| **`better-layout`** | [`jakubkrehel/skills@better-layout`](https://github.com/jakubkrehel/skills) | Unstyled spatial grouping, shared-edge alignment, 2x spacing ratio, optical baseline harmony, control clearance. | [layout-and-alignment.md](./layout-and-alignment.md) |
| **`responsive-design`** | [`wshobson/agents@responsive-design`](https://github.com/wshobson/agents) | Container queries (`@container`), fluid grid math (auto-fit/minmax), flex blowout prevention, progressive disclosure. | [responsive-design.md](./responsive-design.md) |
| **`composition-patterns`** | [`vercel-labs/agent-skills@composition-patterns`](https://github.com/vercel-labs/agent-skills) | Advanced React compound components, flexible layouts, avoiding prop drilling, slot patterns. | [composition-patterns.md](./composition-patterns.md) |
| **`vercel-react-view-transitions`** | [`vercel-labs/agent-skills@vercel-react-view-transitions`](https://github.com/vercel-labs/agent-skills) | Fluid page transitions, shared layout morphing, navigation animations. | [view-transitions.md](./view-transitions.md) |

### B. Bundled Native Skills (Self-Contained inside `uicraft/bundled-skills/`)
| Bundled Skill | Internal Location | Focus & Rule Enforcement | Dedicated Guide |
| :--- | :--- | :--- | :--- |
| **`ui-copywriting`** | `uicraft/bundled-skills/ui-copywriting` | Human-crafted UI microcopy, concise headings ($\le$ 4 words), subtitles ($\le$ 12 words), zero AI fluff, front-loaded action verbs. | [ui-copywriting.md](./ui-copywriting.md) |

---

## 3. Autonomous Skill Verification & Installation

To check status or synchronize partner skills, run:

```bash
# Dry run to see status:
bash .agents/skills/uicraft/scripts/install-integrations.sh --dry-run

# Autonomous synchronization:
bash .agents/skills/uicraft/scripts/install-integrations.sh
```

- **Bundled Skills (`ui-copywriting`):** Automatically verified and linked from `uicraft/bundled-skills/` with zero network calls.
- **External Skills:** Installed automatically using `npx skills add <package_spec> -y` if not already installed.

---

## 4. How `uicraft` Consults Partner Skills Across the 5 Steps

```mermaid
sequenceDiagram
  autonumber
  actor Agent as Coding Agent
  participant UIC as uicraft
  participant REG as Integrations Registry
  participant OUT as Project (public/)
  participant CODE as Source Code (src/)

  Note over UIC: Step 1: Ingest & Check
  UIC->>REG: Verify partner skills in .agents/skills/
  Note over UIC: Step 2: Extract & Specify
  UIC->>OUT: Generate preset-info.md, philosophy.md, technicals.md
  Note over UIC: Step 3: Deconstruct Tree
  UIC->>REG: Consult web-design-guidelines, better-layout & ui-copywriting
  UIC->>OUT: Write unstyled ui-tree/ specs
  Note over UIC: Step 4: Audit Gate
  UIC->>OUT: validate-ui-tree.sh (0 style leaks, 100% PRD trace)
  Note over UIC: Step 5: Code Generation
  Agent->>REG: Consult composition-patterns, webperf & ui-copywriting
  Agent->>OUT: Read technicals.md (Integration-Ready Handlers)
  Agent->>CODE: Implement components, install libraries, wire handlers
```

1. **In Step 1 (Ingest):** Runs `install-integrations.sh` to ensure all necessary skills are present.
2. **In Step 2 (Extract):** Leverages `shadcn` for preset styles and writes `public/technicals.md` for backend/library dependencies.
3. **In Step 3 (Tree Deconstruction):** Uses `web-design-guidelines`, `better-layout`, `responsive-design`, and `ui-copywriting` to dictate accessible structures, minimum tap targets, 2x negative space hierarchy, responsive disclosure boundaries, and concise, fluff-free headings/subtitles without leaking styles.
4. **In Step 5 (Code Generation):** Uses `better-layout` for optical baseline alignment and shared-edge insets, `responsive-design` for container queries (`@container`) and intrinsic fluid grid tracks, `ui-copywriting` for punchy action-first button labels, short telemetry descriptions, and two-sentence empty states, `webperf` to avoid layout shifts, and `composition-patterns` for robust component architecture.
````

## File: references/integrations/responsive-design.md
size: 1823
sha: 7ed0d9230b59adcb15495ef5b9333ee3c267b788
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/responsive-design.md

```text
# `uicraft` Integration: Responsive Design & Container Queries (`responsive-design`)

This reference defines how `uicraft` integrates with the `responsive-design` partner skill to ensure application layouts adapt seamlessly across all viewport sizes and container constraints.

---

## 1. The Dynamic Shell Problem

In modern dashboard shells, the available main content width is **not equal to the browser viewport**:
- When the shadcn sidebar is expanded: Available content width = `100vw - 16rem` (`256px`).
- When the sidebar is collapsed: Available content width = `100vw - 3rem` (`48px`).

Relying solely on viewport media queries (`@media (min-width: 1024px)`) causes layout collision when the sidebar is open on laptops (1024px–1280px).

---

## 2. Rules Enforced During Step 3 (Tree Deconstruction)

In `public/ui-tree/`:
1. **Define Progressive Disclosure Hierarchy:**
   - In Section 4 (State & Interactions), explicitly define how non-critical labels collapse when horizontal space is constrained.
2. **Specify Container Containment:**
   - Note which composite sections require container-aware adaptation independent of browser window width.

---

## 3. Rules Enforced During Step 5 (Code Generation)

1. **Container Query Declaration:**
   - Declare `@container` on composite parent wrappers (card grids, toolbars, headers).
   - Use container query classes (e.g. `@sm:flex-row`, `@lg:grid-cols-4`) for internal component layout.
2. **Intrinsic Grid Sizing:**
   - Use `grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))` instead of rigid viewport columns.
3. **Progressive Disclosure Implementation:**
   - Use responsive text spans: `hidden md:inline` for secondary label words.
   - Truncate long strings with progressive max-width limits (e.g., `max-w-[120px] md:max-w-[200px] xl:max-w-none`).
```

## File: references/integrations/shadcn.md
size: 2940
sha: 14ce3abeeafc59d27fc2d68e4bc16d0d81a669f4
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/shadcn.md

````text
# `uicraft` Integration: official `shadcn/ui` Skill & Presets

`uicraft` delegates all visual design tokens, base color palettes, and accessible component primitives to **shadcn/ui**. This allows `uicraft` to focus 100% on **UX Architecture, Information Hierarchy, and Structural Component Trees**.

---

## 1. Skill Reference & Installation

- **Skill Name:** `shadcn`
- **Source Repository:** `https://github.com/shadcn-ui/ui.git` (`@shadcn`)
- **Local Location:** `.agents/skills/shadcn/`
- **Installation Command:**
  ```bash
  npx skills add shadcn-ui/ui@shadcn -y
  ```

---

## 2. The Power of shadcn Presets

Modern shadcn projects use **presets** (created visually via [ui.shadcn.com/create](https://ui.shadcn.com/create) or referenced by preset codes such as `buFywKm`, `b6FmyD0j2`, or default `b0`).

A preset packages the entire visual design system:
1. **Style**: `base-nova`, `base-maia`, `new-york`, or `default`
2. **Base Color**: `taupe`, `neutral`, `zinc`, `slate`, `stone`, `gray`
3. **Theme & CSS Variables**: OKLCH / HSL variables in `globals.css`
4. **Typography**: Body font and heading font families
5. **Icon Library**: `lucide`, etc.
6. **Geometry**: Base border radius (`--radius`)

### Project Initialization with a Preset
```bash
pnpm dlx shadcn@latest init --preset <code|url> --template next -y
```

### Applying or Switching Presets on Existing Projects
```bash
pnpm dlx shadcn@latest apply <preset-code-or-url> --yes
```

---

## 3. How `uicraft` Reads Client Project Configuration

When `uicraft` runs on a client codebase, it **never invents new colors or fonts**. Instead, it inspects:

### 1. `components.json`
- `style`: The active component architecture (e.g. `base-maia`).
- `tailwind.baseColor`: Base hue family.
- `tailwind.css`: Path to the stylesheet (typically `app/globals.css`).
- `iconLibrary`: Icon pack (e.g. `lucide`).
- `aliases.ui`: Directory where shadcn primitives live (e.g. `@/components/ui`).

### 2. `globals.css`
- Base border radius: `--radius`.
- Semantic surface tokens: `--background`, `--foreground`, `--card`, `--muted`, `--border`.
- Primary & Accent tokens: `--primary`, `--accent`, `--secondary`.
- Status tokens: `--destructive`, etc.

`uicraft` exports a concise summary to `public/preset-info.md` and `public/philosophy.md` for coding agents to reference.

---

## 4. Primitive Guidelines (Radix UI vs Base UI)

Depending on the preset style chosen, shadcn generates components using either Radix UI or Base UI (`@base-ui/react`):
- **Radix UI (`new-york`, `default`):** Utilizes `asChild` composition.
- **Base UI (`base-maia`, `base-nova`):** Does not use `asChild`. Trigger components directly accept trigger contents and styles, and anchor tags are styled using `className={cn(buttonVariants(...))}` directly.

`uicraft` code generation in Step 5 checks `package.json` for `@base-ui/react` and generates syntax perfectly matched to the installed primitive engine.
````

## File: references/integrations/ui-copywriting.md
size: 2881
sha: 823aceef070aaf3fb59434284ce3c27fb6b93b77
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/ui-copywriting.md

```text
# `uicraft` Integration: UX Microcopy & Anti-AI Tone (`ui-copywriting`)

This reference defines how `uicraft` integrates with the `ui-copywriting` partner skill to ensure all static text, headings, descriptions, button labels, and empty states are punchy, scannable, human-crafted, and free of AI fluff.

---

## 1. Division of Responsibility

| Domain | Responsible Skill | Enforcement |
| :--- | :--- | :--- |
| **Theme, Colors & Radii** | `shadcn/ui` & `globals.css` | `--primary`, `--background`, `--radius`, `--card` semantic tokens. |
| **UX Architecture & Tree** | `uicraft` | Product requirements, route mapping, component hierarchy, unstyled markdown specs. |
| **Spatial Alignment & Geometry** | `better-layout` | Shared edges, 2× negative space ratio, optical baselines, control clearance. |
| **Content, Headings & Microcopy** | **`ui-copywriting`** | Concise headings ($\le$ 4 words), short subtitles ($\le$ 12 words), active verbs, zero AI filler words. |

---

## 2. Rules Enforced During Step 3 (Tree Deconstruction)

When generating unstyled component specs in `public/ui-tree/**/*.md`:
1. **Hard Word Count Limits on Structural Elements:**
   - **Titles & Headings:** Maximum 2–4 words (*"Keyword Guardian"*, *"Budget Pacing"*).
   - **Subtitles & Descriptions:** Exactly 1 sentence, $\le$ 12 words (*"Review search terms draining budget before negative keyword sync."*).
   - **Action Triggers:** 2–3 words starting with an active imperative verb (*"Sync Keywords"*, *"Export CSV"*).
2. **Zero AI Fluff in Component Specs:**
   - Never write phrases like *"A comprehensive view empowering users to seamlessly manage..."* in `ui-tree/` markdown files.
   - Write pragmatic, direct functional descriptions: *"Displays live ad spend, target burn rate, and pacing variance."*
3. **Two-Sentence Empty State Specifications:**
   - Sentence 1: What is absent (*"No active alerts."*).
   - Sentence 2: What action to take next (*"Connect a channel to begin monitoring."*).

---

## 3. Rules Enforced During Step 5 (Code Generation)

When the coding agent implements components in `components/` and `app/`:
1. **Purge Synthetic AI Preamble:**
   - Never render phrases like *"Welcome to your overview"* or *"Here you can easily explore..."*.
   - Render the data group or active noun directly.
2. **Front-Loaded Column Headers:**
   - Table headers must be 1–2 words maximum (*"Spend"*, *"ROAS"*, *"Status"*, *"Actions"*).
   - Place currency symbols (`$`) and units (`%`, `x`) in data cells, not in headers.
3. **Action-First Button Labels:**
   - Primary and secondary buttons must never say *"Submit"*, *"Proceed"*, or *"Click here"*.
   - Use direct verb phrases: *"Create Rule"*, *"Download Report"*, *"Archive Term"*.
4. **Scannable Status Badges:**
   - Keep status pills to 1–2 words: *"Live"*, *"Paused"*, *"Critical"*, *"In Sync"*, *"+14% vs Target"*.
```

## File: references/integrations/view-transitions.md
size: 1836
sha: f4b5be8a0d10365dbc0bc8384e3adf26c6104299
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/view-transitions.md

````text
# `uicraft` Integration: React View Transitions (`vercel-react-view-transitions`)

`uicraft` integrates with **`vercel-react-view-transitions`** to enable native, fluid browser view transitions across pages and complex layout states without jarring white flashes or abrupt UI jumps.

---

## 1. Skill Reference & Installation

- **Skill Name:** `vercel-react-view-transitions`
- **Source Repository:** `https://github.com/vercel-labs/agent-skills.git` (`@vercel-react-view-transitions`)
- **Local Location:** `.agents/skills/vercel-react-view-transitions/`
- **Installation Command:**
  ```bash
  npx skills add vercel-labs/agent-skills@vercel-react-view-transitions -y
  ```

---

## 2. When to Apply View Transitions in `uicraft`

View transitions provide high perceived performance in modern web applications:

### 1. Route Navigation
- When navigating between core dashboard views (e.g. `/` -> `/api-keys` -> `/webhooks`), shared layout shells (sidebar, top header) remain stable while the central viewport content smoothly cross-fades.

### 2. State & Mode Morphing
- When toggling between environments (e.g. "Production" <-> "Staging"), the environment indicator badge and underlying telemetry numbers morph smoothly rather than re-rendering abruptly.

### 3. Drawer & Modal Expansions
- When clicking a row in a data table to open an inspect sheet, the row visually connects to the expanding slide-over drawer using browser transition roots.

---

## 3. Implementation Blueprint in Step 5

For Next.js App Router projects, the coding agent follows the transition wrapper pattern:
- Wrap links with `<Link>` or transition boundaries.
- Utilize CSS `@view-transition` properties defined in `globals.css` with zero inline styling.
- Ensure fallback behavior remains fully functional on browsers lacking View Transition API support.
````

## File: references/integrations/web-design-guidelines.md
size: 2541
sha: 77896f86cbb9c203061ac559843aa711795b4e8d
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/web-design-guidelines.md

````text
# `uicraft` Integration: Vercel Web Design & Accessibility Guidelines

`uicraft` integrates with **`web-design-guidelines`** (from Vercel Labs) to ensure every component adheres to accessible, ergonomic, and modern design standards.

---

## 1. Skill Reference & Installation

- **Skill Name:** `web-design-guidelines`
- **Source Repository:** `https://github.com/vercel-labs/agent-skills.git` (`@web-design-guidelines`)
- **Local Location:** `.agents/skills/web-design-guidelines/`
- **Installation Command:**
  ```bash
  npx skills add vercel-labs/agent-skills@web-design-guidelines -y
  ```

---

## 2. Accessibility & Ergonomic Standards

When deconstructing UI trees (Step 3) and writing code (Step 5), `uicraft` enforces:

### 1. Touch Targets & Ergonomics
- **Minimum 44x44px Tap Targets:** Buttons, icon triggers, and dropdown toggles on touch surfaces must maintain an effective tap boundary of at least `44x44px` (using `size-9` / `h-10` with generous padding or invisible pseudo-element expansion).
- **Adequate Spacing:** Interactive elements must have a minimum `8px` gap between adjacent targets to prevent accidental taps.

### 2. Contrast & Visual Clarity (WCAG AA)
- **Semantic Text Tokens:** Never use low-contrast arbitrary gray shades. Use `text-foreground` for primary headings, `text-muted-foreground` for secondary metadata, and `text-card-foreground` on surface cards.
- **Visual State Feedback:** Every interactive element must define distinct `:hover`, `:active`, `:focus-visible`, and `:disabled` states.

### 3. Screen Reader Landmarks & Keyboard Navigation
- **Landmark Elements:**
  - `header role="banner"` for top application bars.
  - `aside role="navigation"` or `aria-label="..."` for sidebars.
  - `main role="main"` for the primary content container.
  - `section role="region" aria-label="..."` for distinct dashboard panels.
- **Focus Rings:**
  - Clear focus indicator: `focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 outline-none`.
- **Keyboard Shortcuts:**
  - Dialogs and sheets dismiss on `Escape`.
  - Accessible dialog triggers trap focus while active and restore focus to trigger buttons on dismiss.

---

## 3. UI Tree Spec Schema Compliance

In `public/ui-tree/**/*.md`, `## 5. Accessibility & Semantics` is mandatory:
```markdown
## 5. Accessibility & Semantics
- **ARIA Landmark:** `role="region" aria-label="Gateway Telemetry Metrics"`
- **Values:** `aria-live="polite"` for metric updates.
- **Touch Target:** Minimum 44px tap zone on mobile viewports.
```
````

## File: references/integrations/web-performance.md
size: 2810
sha: 29eb7b50163202f94187e5461caae329016e2e2d
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/integrations/web-performance.md

````text
# `uicraft` Integration: Web Performance & Core Web Vitals (`webperf`)

`uicraft` integrates with **`webperf`** (from Addy Osmani's agent skills suite) to guarantee that every generated UI architecture is optimized for real-world speed, zero layout shifts, and responsive interactions from day one.

---

## 1. Skill Reference & Installation

- **Skill Name:** `webperf`
- **Source Repository:** `https://github.com/addyosmani/agent-skills.git` (`@webperf`)
- **Local Location:** `.agents/skills/webperf/`
- **Installation Command:**
  ```bash
  npx skills add addyosmani/agent-skills@webperf -y
  ```

---

## 2. Core Web Vitals Enforced by `uicraft`

When deconstructing UI trees (Step 3) and generating code (Step 5), `uicraft` enforces the following web performance rules:

### 1. Cumulative Layout Shift (CLS < 0.1)
- **Monospace Tabular Numerals:** All real-time telemetry metrics, timestamps, and currency counters must use `tabular-nums font-mono` so changing numbers do not cause container width jitter.
- **Skeleton Placeholders:** Initial loading states must reserve the exact dimensions of data tables, metric cards, and charts using skeleton blocks.
- **Explicit Aspect Ratios:** Avatar icons, image media, and embedded graphs must have predefined sizing (`size-7`, `h-16`, `aspect-video`).

### 2. Interaction to Next Paint (INP < 200ms)
- **Optimistic UI Updates:** Switches, toggles, and status badges must update state immediately on user click, with background async synchronization.
- **Deferred Modal & Drawer Rendering:** Complex dialog overlays, JSON viewers, and side drawers must be rendered on-demand (e.g. conditional rendering inside `<Sheet>` or `<Dialog>`), preventing heavy DOM nodes from blocking main thread hydration.
- **Micro-Tasks & Debounced Search:** Search inputs filtering large table datasets must use lightweight memoization or debouncing.

### 3. Largest Contentful Paint (LCP < 2.5s)
- **Server Component Rendering:** Layout shells, navigation bars, and static documentation links render as React Server Components where possible.
- **Client Boundary Minimization:** `"use client"` is isolated to interactive leaves (e.g., table filters, dialog buttons, theme toggles) rather than wrapping entire page bodies.

---

## 3. How `uicraft` Encodes Performance in Specifications

In each component spec (`public/ui-tree/**/*.md`), the `## 4. State & Interactions` section explicitly includes performance directives:
```markdown
## 4. State & Interactions
- **Numerals:** Formatted with tabular numbers (tabular-nums font-mono) to prevent layout jitter on metric ticks.
- **Drawer Rendering:** Body payload inspector is lazily hydrated only when the row is clicked.
```

Coding agents in Step 5 follow these instructions to produce lean, high-performing React components.
````

## File: references/philosophy-extraction.md
size: 3062
sha: 6228da0fd7847295713d16eb946234e193ee4126
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/philosophy-extraction.md

````text
# Design Philosophy: shadcn Preset Derivation & UX-First Architecture

In `uicraft`, **visual styling is a solved problem**. `shadcn/ui` provides human-tested, mathematically balanced design systems via presets (such as `buFywKm` or default `b0`).

`uicraft` extracts the project's visual foundations directly from the active shadcn preset, freeing 100% of the agent's focus for **UX Architecture and Information Hierarchy**.

---

## 1. Extracting the Preset

When analyzing a client project, `uicraft` inspects:

1. **`components.json`**:
   - `style`: Determines primitive component styling (`base-nova`, `new-york`, `default`).
   - `tailwind.baseColor`: Determines the neutral tonal palette (`neutral`, `zinc`, `slate`, `stone`).
   - `iconLibrary`: Determines the iconography package (e.g., `lucide-react`).
2. **`globals.css`**:
   - Reads `--radius` to determine the geometry standard.
   - Reads CSS variables (`--background`, `--foreground`, `--primary`, `--border`) to confirm theme coverage.

---

## 2. Generating `public/preset-info.md`

`uicraft` generates a concise summary in the project's output directory (`public/preset-info.md`):

```markdown
# Active shadcn Preset Information

- **Preset Source:** `components.json` / `globals.css`
- **Style:** [e.g. base-nova]
- **Base Color:** [e.g. neutral]
- **Icon Library:** [e.g. lucide]
- **Base Radius:** [e.g. 0.625rem]
- **Stylesheet:** [e.g. app/globals.css]

> **Note for Coding Agents:** All component colors, border styles, and font tokens are managed natively by this preset. Do not introduce arbitrary CSS classes or custom color schemes.
```

---

## 3. Generating `public/philosophy.md`

`uicraft` produces `public/philosophy.md` to define the **Information Architecture & Density Rules** for the project:

### Surface & Elevation Principles
- Avoid drop shadows; surfaces are defined by single-pixel borders (`border border-border`) and tonal card backgrounds (`bg-card`).
- Containers (Cards, Modals, Tables) follow `rounded-lg` or the preset's `--radius`.
- Interactive controls (Buttons, Inputs, Badges) follow `rounded-md`.

### Information Density
- Balanced spacing: `p-4` or `p-6` for content containers, `gap-4` or `gap-6` for responsive grids.
- Data tables and telemetry consoles use monospace tabular numbers (`tabular-nums font-mono`) to prevent layout shifts.

### Micro-interactions & Accessibility
- Hover transitions: Snappy transitions (`duration-150`).
- Keyboard focus: High-visibility focus ring (`focus-visible:ring-2 focus-visible:ring-ring`).
- Tooltips: 150ms delay on icon-only triggers.
- Empty states: Purpose-built, centered containers with clear instructions.

---

## 4. The Golden Rule of `uicraft` UI Trees
Because visual tokens are already locked in by the shadcn preset:
- **Zero Style Classes in `ui-tree`:** Component specifications in `ui-tree/**/*.md` must **never** mention colors, font sizes, or pixel values.
- **100% Focus on UX Structure:** Specs describe user workflows, data elements, state transitions, and verbatim requirement citations.
````

## File: references/shadcn-integration.md
size: 3726
sha: 6fe5294a36480766be0f33956a2f4b278aa6fe1e
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/shadcn-integration.md

````text
# `uicraft`: Official shadcn/ui Skill & Preset Integration

`uicraft` delegates all visual design tokens, color palettes, and component primitive behaviors to **shadcn/ui**. This allows `uicraft` to focus 100% of its intelligence on **UX Architecture, Information Hierarchy, and Structural Component Trees**.

---

## 1. Version-Controlled Skill Integration

`uicraft` works hand-in-hand with the official `shadcn` skill published by the shadcn team:

- **Source Repository:** `https://github.com/shadcn-ui/ui.git` (`@shadcn`)
- **Local Location:** `.agents/skills/shadcn/`
- **Lockfile Management:** Tracked in consumer workspace's `skills-lock.json` under `skills.shadcn`:
  ```json
  "shadcn": {
    "source": "shadcn-ui/ui",
    "sourceType": "github",
    "skillPath": "skills/shadcn/SKILL.md",
    "computedHash": "..."
  }
  ```

### Updating the Underlying shadcn Skill
To pull the latest official component guidelines, registry patterns, and CLI capabilities from GitHub at any time, run:
```bash
npx skills update shadcn -y
```

---

## 2. The Power of shadcn Presets

Modern shadcn projects use **presets** (created visually via [ui.shadcn.com/create](https://ui.shadcn.com/create) or referenced by preset codes such as `buFywKm` or default `b0`).

A preset packages the entire visual design system:
1. **Style**: `base-nova`, `new-york`, or `default`
2. **Base Color**: `neutral`, `zinc`, `slate`, `stone`, `gray`
3. **Theme & CSS Variables**: OKLCH / HSL variables in `globals.css`
4. **Typography**: Body font and heading font families
5. **Icon Library**: `lucide`, etc.
6. **Geometry**: Base border radius (`--radius`)

### Project Initialization with a Preset
When scaffolding a project, users run:
```bash
pnpm dlx shadcn@latest init --preset <code|url> --template next -y
# Example default:
pnpm dlx shadcn@latest init --preset b0 --template next -y
```

### Applying or Switching Presets on Existing Projects
To update or change an entire theme preset later:
```bash
pnpm dlx shadcn@latest apply <preset-code-or-url> --yes
```

---

## 3. How `uicraft` Reads Client Project Configuration

When `uicraft` is invoked on a client codebase, it **never invents new colors or fonts**. Instead, it inspects two files:

### 1. `components.json`
`uicraft` extracts:
- `style`: The active component architecture (e.g., `base-nova`).
- `tailwind.baseColor`: Neutral, zinc, slate, etc.
- `tailwind.css`: Path to the stylesheet (typically `app/globals.css`).
- `iconLibrary`: Icon pack (e.g. `lucide`).
- `aliases.ui`: Directory where shadcn primitives live (e.g. `@/components/ui`).

### 2. `globals.css`
`uicraft` extracts:
- Base border radius: `--radius`.
- Semantic surface tokens: `--background`, `--foreground`, `--card`, `--muted`, `--border`.
- Primary & Accent tokens: `--primary`, `--accent`, `--secondary`.
- Status tokens: `--destructive`, etc.

`uicraft` exports a concise summary to `public/preset-info.md` and `public/philosophy.md` for coding agents to reference.

---

## 4. The Separation of Concerns

| Responsibility | Handled By | Artifacts / Tools |
| :--- | :--- | :--- |
| **Visual Tokens, Colors & Geometry** | `shadcn/ui` Preset | `components.json`, `globals.css`, `pnpm dlx shadcn@latest apply` |
| **Component Primitives** | Official `shadcn` Skill | `pnpm dlx shadcn@latest add <component>`, `@/components/ui/*` |
| **UX Architecture & Structure** | **`uicraft` Framework** | `public/ui-tree/**/*.md`, `public/preset-info.md`, `requirements.md` |
| **Implementation** | Coding Agent | Traverses `ui-tree`, adds needed shadcn primitives, builds `src/` |

By respecting this boundary, `uicraft` guarantees that generated applications look human-designed, accessible, and clean from day one.
````

## File: references/technicals-specification.md
size: 5245
sha: 639a4569b945ae3dd088ebcfd5b99db63cf24a50
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/technicals-specification.md

````text
# `uicraft`: Integration-Ready Technicals Specification (`technicals.md`)

## 1. Overview & Strategic Role

When `uicraft` translates an unstyled PRD (`requirements.md`) into a project architecture, it produces three foundational documents in `public/`:
1. [`preset-info.md`](./philosophy-extraction.md): The visual design tokens, base color, and geometry (delegated to shadcn presets).
2. [`philosophy.md`](./philosophy-extraction.md): The UX density, typography rhythm, and interaction standards.
3. **`technicals.md`**: The **Integration-Ready Technical Architecture** detailing external libraries, domain data contracts, and backend service handlers.

---

## 2. The "Integration-Ready" Architecture

### The Core Problem
Often, frontend code generated by coding agents hardcodes state directly inside JSX buttons or components. When the engineering team later connects a real database (e.g., Supabase, Prisma, Firebase, or an internal REST/gRPC API), they must refactor the entire UI layer, rewrite forms, and rewire callbacks.

### The `uicraft` Solution: Integration-Ready from Day One
`uicraft` mandates that Step 5 code generation produces an **Integration-Ready frontend**:
1. **Typed Service Handlers (`lib/services/*` or `lib/api/*`):** All data operations (fetch, create, update, delete, test ping) are defined as clean async functions with realistic TypeScript signatures.
2. **Complete UI State Wiring:** Components, tables, forms, and modals bind exclusively to these service handlers. Loading indicators, error banners, and optimistic visual feedback are fully built into the UI.
3. **Zero UI Refactoring:** When the real backend is connected, developers or backend agents only configure environment variables and implement the internal logic of the service handlers. **The UI requires zero modifications.**

---

## 3. Required Structure of `public/technicals.md`

Every `public/technicals.md` generated in Step 2 must follow this exact standard schema:

### Section 1: Required Libraries & Installation Commands
Lists all non-UI packages needed to satisfy the PRD requirements (e.g., BaaS SDKs, data validation, utilities):
```markdown
## 1. Required Packages & Dependencies
Run the following package manager command to install necessary libraries:
```bash
pnpm add @supabase/supabase-js zod date-fns lucide-react
```
```

### Section 2: Backend Architecture & Service Mapping
Identifies backend systems mentioned or implied by `requirements.md`:
- **Database / BaaS:** (e.g. Supabase, PostgreSQL, Prisma, MongoDB)
- **Authentication:** (e.g. Supabase Auth, Clerk, NextAuth)
- **External APIs & Gateways:** (e.g. Stripe, AWS S3, Resend)
- **Real-Time / Webhooks:** (e.g. Webhook signature verification, WebSockets)

### Section 3: Domain Data Contracts (TypeScript Interfaces)
Specifies unambiguous data models representing backend records:
```typescript
export interface ApiKeyRecord {
  id: string
  name: string
  token_hash: string
  environment: "Production" | "Staging"
  created_at: string
  last_used_at: string | null
  is_revoked: boolean
}
```

### Section 4: Service Handlers Blueprint
Prescribes the exact file paths and function signatures for data handlers:
```markdown
## 4. Service Handlers Blueprint (`lib/services/`)
- `lib/services/api-keys.ts`:
  - `fetchApiKeys(env?: string): Promise<ApiKeyRecord[]>`
  - `generateApiKey(data: CreateKeyInput): Promise<ApiKeyRecord>`
  - `revokeApiKey(id: string): Promise<{ success: boolean }>`
- `lib/services/webhooks.ts`:
  - `fetchWebhookEndpoints(): Promise<WebhookEndpoint[]>`
  - `testPingWebhook(id: string): Promise<{ statusCode: number; latencyMs: number }>`
  - `createWebhookEndpoint(data: CreateWebhookInput): Promise<WebhookEndpoint>`
```

### Section 5: Environment Variables Template (`.env.example`)
Specifies the environment keys required for real integration:
```bash
# Backend Credentials Template
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
```

---

## 4. Step 5 Execution Workflow for Coding Agents

When generating code in Step 5, the coding agent follows this integration contract:

```mermaid
flowchart LR
  TECH["public/technicals.md"] --> INST["1. Install Dependencies<br/>(pnpm add ...)"]
  INST --> SVC["2. Scaffold Handlers<br/>(lib/services/*.ts with mock async)"]
  SVC --> CTX["3. Wire State / Context<br/>(context/*-context.tsx)"]
  CTX --> UI["4. Build Components<br/>(components/* & app/*)"]
```

1. **Install Dependencies:** Executes the package install command from Section 1 of `technicals.md`.
2. **Scaffold Service Handlers:** Creates `lib/services/` (or `lib/api/`) implementing the exact function signatures from Section 4. Initial implementations return realistic mock data with simulated network latency (`await new Promise(r => setTimeout(r, 200))`).
3. **Wire Context & State:** Central state providers consume the service handlers rather than embedding static inline arrays.
4. **Build UI Components:** Views and forms call context actions, displaying loading spinners, success toasts, and error alerts.

**Outcome:** The application is visually stunning, fully interactive, and 100% ready for backend deployment.
````

## File: references/tree-specification.md
size: 2162
sha: 98a5aae057fd3c7cf7d1a600351e0c73f695ec95
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/references/tree-specification.md

````text
# UI Tree Specification Guidelines

This document specifies the rules and structure for generating the hierarchical `ui-tree/` directory.

## 1. Directory Tree Hierarchy
The `ui-tree/` directory should mirror the client application's mental model and routing architecture:

```text
ui-tree/
├── layout/
│   ├── shell.md              # Application container, sidebar provider, main content area
│   ├── sidebar.md            # Primary navigation sidebar & items
│   └── header.md             # Top navigation, global actions, user status
├── [route-1]/                # Feature route (e.g., dashboard)
│   ├── page.md               # Layout composition of this view
│   ├── [child-component-1].md
│   └── [child-component-2].md
└── [route-2]/                # Secondary feature route (e.g., notifications)
    ├── page.md
    └── [child-component].md
```

## 2. File Organization Rules
1. **One file per distinct UI unit**: If a component has state, triggers actions, or renders independently (e.g., a table, a metrics card grid, an incident drawer), give it its own `.md` file.
2. **Page Composition (`page.md`)**: Every route must contain a `page.md`. This file explains how the subcomponents are arranged (e.g., 2-column layout, responsive grid, drawer trigger) without specifying styling.
3. **No Stylistic Descriptions**:
   - ❌ WRONG: "A red button with 8px rounded corners and white bold text"
   - ✅ RIGHT: "A destructive action button labeled 'Acknowledge Incident', disabled if incident is already acknowledged"

## 3. Component Deconstruction Process
1. Read the user requirement line.
2. Identify the core user intent (view data, filter items, navigate, take action).
3. Select appropriate semantic primitives (e.g., from `shadcn/ui`: `Table`, `Badge`, `Sheet`, `Card`, `Tooltip`).
4. Detail the interaction lifecycle:
   - Initial render state
   - User hover state (show tooltip, cursor change)
   - User focus state (keyboard navigation)
   - User active/trigger state (modal open, toast notification, route change)
   - Empty/error states (when zero records exist)
````

## File: .gitignore
size: 235
sha: b4afb38ec972521a5ff856867ec0d681c9615921
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/.gitignore

```text
# Operating System & Editor Files
.DS_Store
Thumbs.db
*.swp
*.swo
*~
.vscode/
.idea/

# Node & Package Managers
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Test & Temp Artifacts
.tmp/
scratch/
*.log
```

## File: config.template.json
size: 935
sha: f5e59112846792a2d29f132a99cd3e58171b2fdf
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/config.template.json

```text
{
  "framework": "uicraft",
  "version": "1.2.0",
  "componentLibrary": "shadcn/ui",
  "shadcn": {
    "componentsJson": "components.json",
    "globalsCss": "app/globals.css",
    "defaultPreset": "b0"
  },
  "integrations": {
    "autoInstallMissing": true,
    "registryPath": "uicraft/references/integrations",
    "skills": [
      "shadcn",
      "webperf",
      "agent-skills",
      "web-design-guidelines",
      "composition-patterns",
      "vercel-react-view-transitions"
    ]
  },
  "paths": {
    "requirementsFile": "public/requirements.md",
    "outputDir": "public",
    "treeDir": "public/ui-tree",
    "presetInfoFile": "public/preset-info.md",
    "philosophyFile": "public/philosophy.md",
    "technicalsFile": "public/technicals.md"
  },
  "rules": {
    "enforceRequirementTraceability": true,
    "strictNoStyleLeakage": true,
    "integrationReadyHandlers": true,
    "defaultTraversal": "depth-first"
  }
}
```

## File: LICENSE
size: 1066
sha: 44e8fb35451d5edab6314d86cc4b3c155148ba07
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/LICENSE

```text
MIT License

Copyright (c) 2026 Ali Ahmad

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## File: package.json
size: 758
sha: 46f34524b11810ce8d4fb55226d76dfaec1aac70
upstream: https://github.com/aicosmo1/uicraft/blob/HEAD/package.json

```text
{
  "name": "uicraft",
  "version": "1.0.0",
  "description": "Autonomous UI/UX architecture framework natively integrated with shadcn/ui and Agent Skills Registry",
  "author": "Ali Ahmad",
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/aicosmo1/uicraft.git"
  },
  "homepage": "https://github.com/aicosmo1/uicraft#readme",
  "keywords": [
    "agent-skills",
    "skills",
    "ai-agents",
    "antigravity",
    "claude-code",
    "cursor",
    "codex",
    "windsurf",
    "shadcn-ui",
    "ui-ux",
    "nextjs",
    "tailwind"
  ],
  "scripts": {
    "validate": "bash scripts/validate-ui-tree.sh",
    "eval": "bash scripts/eval-app.sh",
    "install:integrations": "bash scripts/install-integrations.sh"
  }
}
```
