# AI-Assisted Development Patterns **Version:** 1.0.0 **Last Updated:** 2026-03-14 **Applies To:** ALL AI-driven development workflows, vibe coding sessions, agent-generated code --- ## Purpose This document defines how AI agents should build software at high velocity. Guardrails aren't constraints on speed — they're what enable it. When agents know the boundaries, they spend tokens on building instead of safety-checking. **Core Principle:** The fastest development happens when agents follow proven patterns instead of inventing new ones. --- ## The Vibe Coding Workflow Vibe coding is AI-driven rapid development where agents generate, iterate, and ship at maximum speed. The guardrails in this framework make vibe coding safe by default. ### The Speed Equation | Without Guardrails | With Guardrails | |---|---| | Agent generates code | Agent generates code | | Agent second-guesses safety | ~~Safety check~~ (built-in) | | Agent asks user for confirmation | ~~Confirmation~~ (pre-authorized) | | Agent re-reads files for context | ~~Re-read~~ (trust the maps) | | Agent checks accessibility | ~~Manual a11y~~ (patterns include it) | | **Result: 40% of tokens on building** | **Result: 90% of tokens on building** | --- ## Decision Matrix: Ask vs Decide vs Halt Not all decisions carry equal risk. Use this matrix to determine when agents should proceed autonomously, when to ask, and when to halt. ### Risk Level: LOW — Decide Autonomously | Action | Example | Why Safe | |--------|---------|----------| | UI component generation | Build a button, modal, card | Pre-validated patterns exist | | Styling changes | Colors, spacing, typography | Design tokens constrain choices | | Test writing | Unit tests, integration tests | Tests are additive, low-risk | | Documentation updates | Comments, README sections | Non-breaking, easily reversed | | Refactoring within scope | Rename variable, extract function | Scoped and verifiable | ### Risk Level: MEDIUM — Ask Before Proceeding | Action | Example | Why Ask | |--------|---------|---------| | New dependency addition | Adding a package | Supply chain risk | | API schema changes | New endpoint, field change | Affects consumers | | Database migrations | Schema change | Data integrity risk | | Configuration changes | Environment variables | Deployment impact | | Cross-module refactoring | Changing shared interfaces | Cascade risk | ### Risk Level: HIGH — Halt and Confirm | Action | Example | Why Halt | |--------|---------|----------| | Authentication changes | Login flow, token handling | Security-critical | | Payment integration | Billing, IAP, subscriptions | Financial risk | | Data model changes | User schema, permissions | Data loss risk | | Infrastructure changes | Deploy config, CI/CD | Production impact | | Deletion of any kind | Files, data, accounts | Irreversible | --- ## Design-Intent Preservation When iterating rapidly, agents must preserve the original design intent across generations. ### Style Anchors Lock design decisions that should survive iteration: ```typescript // STYLE ANCHOR: Do not modify these design tokens const DESIGN_ANCHORS = { colorPrimary: '#2563eb', // Brand blue — locked borderRadius: '8px', // Consistent rounding — locked fontFamily: 'Inter', // Typography — locked spacingUnit: 4, // 4px grid — locked } as const; ``` ```rust // STYLE ANCHOR: Layout constants — do not modify during iteration const GRID_COLUMNS: u32 = 12; // Locked const GUTTER_WIDTH: f32 = 16.0; // Locked const MAX_CONTENT_WIDTH: f32 = 1200.0; // Locked ``` ```go // STYLE ANCHOR: Design tokens — locked across iterations var DesignAnchors = struct { ColorPrimary string BorderRadius string MaxWidth int }{ ColorPrimary: "#2563eb", // Locked BorderRadius: "8px", // Locked MaxWidth: 1200, // Locked } ``` ### Intent Logs When making changes, log what was intended vs what was changed: ``` INTENT: Add dark mode toggle to settings CHANGED: settings/ThemeToggle.tsx (new component) CHANGED: settings/index.tsx (added toggle to layout) PRESERVED: All existing settings, color tokens, layout structure ``` --- ## Prompt-to-UI Scaffolding ### Component Generation Flow 1. **Parse prompt** → Extract requirements (a11y, performance, ethics) 2. **Select pattern** → Match to existing UI pattern from 2026_UI_UX_STANDARD.md 3. **Apply constraints** → WCAG 3.0+, performance budget, ethical review 4. **Generate code** → Using design tokens and anchored styles 5. **Verify output** → Automated checks (lint, a11y, performance) ### Scaffold Templates When generating UI components, start from these scaffolds rather than blank files: ```typescript // Standard accessible component scaffold interface ComponentProps { /** Required for accessibility */ 'aria-label': string; /** Visual state */ variant?: 'primary' | 'secondary' | 'ghost'; /** Size following 4px grid */ size?: 'sm' | 'md' | 'lg'; } export function Component({ 'aria-label': ariaLabel, variant = 'primary', size = 'md' }: ComponentProps) { return (